6

I am pretty new to this and I am not sure I understand all the concepts, so I might be using words wrongly or obviously not getting some details right.

We mean to do those calculations within our program using the ArcObjects API. This is an issue related to how to use the ArcObjects API to achieve the desired result

We want to do a proximity search. From a given point in projected coordinates, I want to look for objects (I think the word in ArcGIS is 'features') within a given distance given in meters (or some other real-world unit). Keep in mind here that the objects are not contained in an ArcGIS database: we have the objects in projected coordinates in some other, external, list. All I want is to convert the distance from meters to a projected distance, given in projected units, whatever that is.

3
  • what are you working with?? rasters or shapefiles ??
    – Gago-Silva
    Commented Jan 25, 2013 at 16:35
  • By "projected" distance do you mean great circle (or geodesic) distance? Commented Jan 26, 2013 at 4:23
  • did you mean that you have coordinates(x,y list) stored in another format(like excel) and want to do a proximity analysis on that?
    – vinayan
    Commented Jan 28, 2013 at 13:12

2 Answers 2

4

So if you have your "objects" with coordinates in a list. You can easily bring them into ArcMap as a point feature class from csv, xls, mdb. Remember longitude = xcoord, latitude = ycoord. If you know the projection that the objects, you can set that, but it's not necessary. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s50000001z000000

If you know the object coordinates are in meters. You can then use the proximity toolset to find the objects within certain meters of a point. You might want to create a seperate point feature class that contains "start" points. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/An_overview_of_the_Proximity_toolset/000800000018000000/

Edits
About projections... (you should probably read up on this), you say you have "objects" in a projected coord system (PCS). A PCS has a unit -- it is either feet or meters (it could be another linear unit but it's not) -- that is the projected unit. A PCS takes a round section of earth and flattens it to an xy plane. So if you have an input point, you need to use the same PCS to get a valid distance (distance will be in the PCS units) -- OR -- if you have an input point in geographic coordinates, you need to project it to your PCS before measuring distance to get a valid result.

If both are in geographic coordinates then you can do a geodesic length calculation. You need to make an API call to somewhere to get this. Or project them to a PCS for a simple calculation.

Btw, PCSs have very different characteristics depending on which PCS, and only some PCSs give good distance approximations e.g. State Plane. Google/Bing/Esri online maps, which use mercator, is extremely poor unless at equator.


About ArcObjects...
First, given your experience level with GIS, are you sure you want to use ArcObjects directly? Learning curve is big with all the wrapped COM and huge API. Python scripting with the arcpy.py library is recommended for most automation scenarios. You may want to check that out. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/A_quick_tour_of_ArcPy/000v00000001000000/

Second, one of the easier things to do in ArcObjects is to call the geoprocessing tools, like the proximity tools (but even easier with python). Fairly straight forward http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/How_to_run_a_geoprocessing_tool/0001000003rr000000/

Third, you could go the Geometry library and get closer to the bare metal with IProximityOperator, ITopologicalOperator, IRelationalOperator, etc http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Overview/002m0000047r000000/

1
  • Sorry, we mean to do those calculations within our program using the ArcObjects API. This is not a end-user issue but rather an issue related to how to use the ArcObjects API to achieve the desired result. Commented Jan 25, 2013 at 20:39
2

If you are looking for some features within a distance from a point from a feature class, then may be you can follow IFeatureClass.Search Method.

Code snippet:

public List<IFeature> GetFeaturesWithinPolygon(IFeatureClass featureClass, IPoint point, double expandSize)
{
    IEnvelope envelope = point.Envelop;
    envelope.Expand(expandSize, expandSize, false);
    ISpatialReference spatialReferance = ArcMap.Document.FocusMap.SpatialReference;
    string shapeFieldName = featureClass.ShapeFieldName;
    ISpatialFilter spatialFilter = new SpatialFilter();
    spatialFilter.Geometry = envelope;
    spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
    spatialFilter.set_OutputSpatialReference(shapeFieldName, spatialReferance);

    IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);

    IFeature feature;
    var features = new List<IFeature>();
    while ((feature = featureCursor.NextFeature()) != null)
        features.Add(feature);
    return features;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.