Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Display graphic objects from spatialquery result on arcmap
Cynthia
11y
1.4k
1
Reply
Hello experts,
Hey , i am new to arcobject so need a help... I have to display those points on arcmap that lies inside the envelope.I am explainingwhat i have done so far. I have one point feature class say featureclass having (lat/lon)detail.I opened it and used one ARCGIS Snippet i.e. GetActiveviewFromArcmap() and constructed one envelope as mentioned below-:
Iactiveview pactiveview=GetActiveviewFromArcmap(m_application);
Ienvelope penvelope=new EnvelopeClass();
penvelope=pactiveview.extent;
penvelope.QueryCoord(out minx, out miny,out maxX,out maxY);
Ispatialfilter sp=New IspatialfilterClass();
sp.geometry=penvelope;
sp.geometryfield=featureclass.shapefieldname;
sp.spatialrel=esrispatialrelenum.esrispatialrelIntersects;
Ifeaturecursor fc=featureclass.Search(sp,false);
IgraphicContainer pgc;
Ielement pElement;
pElement=new MarkerElementClass();
Ipoint ppoint=new PointClass();
Ifeature feature=featurecursor.NextFeature();
while(feature!=null)
{double x=Convert.ToDouble(feature.get_value(featureclass.fields.findfield("LAT")));
double y=Convert.ToDouble(feature.get_value(featureclass.fields.findfield("LON")));
ppoint.PutCoord(x,y);
pElement.Geometry=ppoint;
ppoint.AddElement(pElement,0);
pActiveview.Refresh();
featurecursor.NextFeature();}
The problem is it is displaying only one graphic object(point) on arcmap though there are 19 features satisfying the spatial query.I want that when i click the tool all features (point)/graphic object display on map at once.
Thanks in advance
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Debugging VB COM objects used in Classic ASP during runtime
Register COM interop