Monday, May 18, 2009

Add a Shape file Programatically


Dear all

find this steps to understand the arcobject code for Adding shape file programatically

This sample, which can easily be changed to support different data types, opens a shapefile on your local disk and adds the contents to the map as a feature layer. In this sample, you will be adding a control button and writing the code for it.


Start ArcMap.
Open an existing map document(.mxd) or add layers to the empty (Untitled) map document.
Click Tools and click Customize.
Click the Commands tab.
Click the drop-down arrow on the Save in combo box and click the map document in which the new command will be saved.
Scroll through the Categories list and click [UIControls].
Click New UIControl.
Click to select the UIButtonControl as the UIControl Type.
Click Create.
Click and drag the new Project.UIButtonControl1 in the Commands list and drop it on any toolbar.
Click Close.
Right-click the newly placed control and click View Source. This opens the Visual Basic Editor.
In the ThisDocument (Code) window, click the Procedure Box drop-down arrow (the one on the right of the window) and choose Click. This adds the wrapper code for the procedure you are creating.
Copy and paste the following code between the two wrapper code lines (between Private Sub UIButtonControl1_Click() and End Sub). Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New ShapefileWorkspaceFactory
Dim pWorkSpace As IFeatureWorkspace
'Change C:\Source to the source location of the shapefile you wish to add
Set pWorkSpace = pWorkspaceFactory.OpenFromFile("C:\GISQuery\", 0)
Dim pClass As IFeatureClass
'Change USStates to the name of the shapefile you wish to add
Set pClass = pWorkSpace.OpenFeatureClass("GISQuery")
Dim pLayer As IFeatureLayer
Set pLayer = New FeatureLayer
Set pLayer.FeatureClass = pClass
pLayer.Name = pClass.AliasName
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
pMxDoc.AddLayer pLayer
pMxDoc.ActiveView.PartialRefresh esriViewGeography, pLayer, Nothing
Go to line 5, Set pWorkSpace = pWorkspaceFactory.OpenFromFile("C:\Source", 0), and change C:\Source to the source location of the shapefile you want to add.
Go to line 8, Set pClass = pWorkSpace.OpenFeatureClass("GISQuery"), and change GISQuery to the name of the shapefile you want to add.
Close the Visual Basic Editor.
Click the new button in ArcMap to add the feature class to the map.



Monday, May 11, 2009

IdentityTool Sample code,



Dear All

ArcMap has an Identity tool which is used to view the information of an feature based on user clicks.
It also contains most of the interfaced used in arcobjects, some of them are
IFeatureLayer
IFeatureClass
ISpatialfilter
IMXdocument
IApplication



and many more, if you want to learn about this then study this tool, it will help you a lot to understand this.

Email me to get the code of this tool
Follow this link to download, and email me if you like this

Saturday, May 9, 2009

Select By Attribute Query Code in ArcMap


Hi all

As we have seen the Select By attribute query command in ArcMap many times and prefebly we have been used it many times. Do you know something interesting about this tool. This Development of this tool will teach you a lot about arcobject because most of the arcobjects are used here in the code.

So if you can write the code or understand the code of "Select By Attribute" then you would known as a good programmer of ArcObjects.

I have developed this command for all those new comers of Arcobjects who want to learn arcobject in a very short span of time.
Please email me your request so that i can transfer this code to you.
and i have a lot of other codes also which are very good to learn about this Arcobject.
contact at
or you can also leave a comment on this site with your id.
follow this link to download the sample code and email me if you like this
http://rapidshare.com/files/234459990/QueryByAttributeCommand.zip

Friday, May 8, 2009

GIS Basics


Let Me explain the GIS Basics here, so that you should also aware about the GIS Technology, These question comes in everyone life who is working on GIS Technology, sometime we don't know the answer, so Here You are.


A GIS can be distinguished by listing the types of questions it can (or should be able to) answer as opposed to being described: a) through formal definitions, and b) through its ability to carry out spatial operations, and linking data sets together with location as the common key. There are five generic questions that a sophisticated GIS can answer:
1 - Location What is at ...? The first of these questions seeks to find out what exists at a particular location described in various ways (e.g., place name, post or zip code, or geographic references).
2 - Situation/Condition Where does it exist? The second question is the converse of the first and requires spatial analysis to answer. Instead of identifying what exists at a given location, a location is found where certain conditions are satisfied (e.g., an unforested section of land of at least 2000 square meters in size, within 100 meters of a road, and with soils suitable for supporting buildings).
3 - Trends What has changed since...? The third question involves both of the first two, and seeks to find the differences within an area over time.
4 - Patterns What spatial patterns exist? The fourth question is more sophisticated; the question is asked to determine whether cancer is a major cause of death among residents near a nuclear power station or how many anomalies there are that don't fit a predetermined pattern and where they are located.
5 - Modeling What if...? The fifth question is posed to determine what happens, for example, if a new road is added to a network, or if a toxic substance seeps into the local groundwater supply. (Answering this type of question requires both geographic as well as other information, and possibly scientific laws.)

GIS Query


GISQuery is a interface between Problem and Solution, As GIS is a well known Technology of today's World. So there are thousands of guys who want the solution of their query, but they do not find any link on web related to problem.

This is a place where you can write your query to us and all the followers of this blog will get back to you with the solution.