Find object on map

750
5
Jump to solution
03-25-2012 08:26 AM
RomanChyzh
New Contributor III
Hello
Where i can find sourcecode for finding objects on map in ArcEngine?
i need this option in my application but in some modify type

Please help me
It is very important!
0 Kudos
1 Solution

Accepted Solutions
GeorgeFaraj
Occasional Contributor III
Hello
Where i can find sourcecode for finding objects on map in ArcEngine?
i need this option in my application but in some modify type

Please help me
It is very important!


This is how you do a search to return an IFeatureCursor so you can iterate thru the found records:

IFeatureClass featureClass = featureLayerToSearch.FeatureClass; string filterClause = "Name = 'London'"; IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = filterClause; IFeatureCursor featureCursor = featureClass.Search( queryFilter, true );


Read up on each of these objects and you should be able to figure out how to vary your code to get what you want.

View solution in original post

0 Kudos
5 Replies
GeorgeFaraj
Occasional Contributor III
Hello
Where i can find sourcecode for finding objects on map in ArcEngine?
i need this option in my application but in some modify type

Please help me
It is very important!


This is how you do a search to return an IFeatureCursor so you can iterate thru the found records:

IFeatureClass featureClass = featureLayerToSearch.FeatureClass; string filterClause = "Name = 'London'"; IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = filterClause; IFeatureCursor featureCursor = featureClass.Search( queryFilter, true );


Read up on each of these objects and you should be able to figure out how to vary your code to get what you want.
0 Kudos
RomanChyzh
New Contributor III
This is how you do a search to return an IFeatureCursor so you can iterate thru the found records:

IFeatureClass featureClass = featureLayerToSearch.FeatureClass;
string filterClause = "Name = 'London'";
IQueryFilter queryFilter = new QueryFilterClass();
queryFilter.WhereClause = filterClause;
IFeatureCursor featureCursor = featureClass.Search( queryFilter, true );


Read up on each of these objects and you should be able to figure out how to vary your code to get what you want.


😮 thank you

but how i can iterate thru records..? and can i write the city's name  in textbox? i try do this with textbox but not successful
0 Kudos
GeorgeFaraj
Occasional Contributor III
😮 thank you

but how i can iterate thru records..? and can i write the city's name  in textbox? i try do this with textbox but not successful


Don't really know about ArcMap.  I only use ArcEngine. So I can't offer direction on the ArcMap user interface. I thought you wanted help on ArcEngine programming.

If you want programming help then look up IFeatureCursor:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IFeatureCursor_Interface...
0 Kudos
RomanChyzh
New Contributor III
Don't really know about ArcMap.  I only use ArcEngine. So I can't offer direction on the ArcMap user interface. I thought you wanted help on ArcEngine programming.

If you want programming help then look up IFeatureCursor:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IFeatureCursor_Interface...


no, from arcmap i just take map templates... when i create standart arcengine app i add to toolbox elements such as map inquiry// find ... when i built app and click on button find ---> a little window appears where i can write name of city which i want find, etc. so i need smth like this "find" but modify a little..)) i think you understand me 🙂
0 Kudos
GeorgeFaraj
Occasional Contributor III
no, from arcmap i just take map templates... when i create standart arcengine app i add to toolbox elements such as map inquiry// find ... when i built app and click on button find ---> a little window appears where i can write name of city which i want find, etc. so i need smth like this "find" but modify a little..)) i think you understand me 🙂


Based on your graphic break it down logically.  You need a form that shows the feature fields available and a textbox to input a search term. You can use IFeatureClass.Fields.get_Field() and .FieldCount to loop over the layer and get the fields for the combobox and then use the field name the user selects and the text they type in the textbox to build a where clause and search using the code I've already detailed. If you need help building a form and getting input from it then go look for more general programming sites - that's not really an ArcGis issue.
0 Kudos