get coordinate by objectid

Feb 25, 2009 at 3:13 PM
hi all

can eny one help me ?
how i can get coordinate for point depend on objectid for this point ?
 thanks


Coordinator
Feb 25, 2009 at 4:37 PM
Hi moh, you can use provider.GetGeometryByID if you only wan the geometry or provider.GetFeature if you want attributes as well hth jd
Feb 25, 2009 at 8:21 PM
thanks  johndiss

i mean :
i have objectid for row in the shape (point shape) and i want coordinate x and y for this point
 
Coordinator
Feb 25, 2009 at 8:32 PM
Hi moh,
say you have access to a FeatureDataRow you can get the Geometry from row.Geometry then depending on the type of geometry it is you may want to do different things.
if you only have the id then you would use the original provider to retrieve either the FeatureDataRow or just the Geometry.
So if the id is 202 and it came from a Shapefile provider:

FeatureDataRow fdr = shapefileProvider.GetFeature((uint)202);
Geometry g = fdr.Geometry;
Point p = g.GetBoundingBox().GetCentroid(); //depending on the type of geometry you may want to do different things here - for instance if g is a Point you dont need to get the BoundingBox or centroid..

hth jd
Feb 26, 2009 at 7:46 AM
thanks
thanks more