Simple SOE Question but stuck

3360
2
11-12-2015 08:43 AM
RaymondIrwin
New Contributor II

We have a map service that presents a boundary. It has one layer, a polygon which is the boundary.

Working on an simple SOE that takes a point and runs an intersect to return a boolean.

Have passed in point working fine.  In fact, everything seems to be working fine, except how to get polygon.

How do I get the geometry of the layer from server object to run intersect?

Using 10.3 .NET SDK and ArcObjects.

This is my first SOE, too, so probably missing something obvious, but after 3 days of trying, need some help.

Thanks

0 Kudos
2 Replies
nicogis
MVP Frequent Contributor

from your jsonobject convert in IGeometry (arcobjects)

Conversion.ToGeometry(jsonObjectGeometry, esriGeometryType.esriGeometryPoint); 

in arcobjects use a spatialfilter on featureclass with your IGeometry

here you can see how get featureclass from service in soe

      

 
IFeatureClass
 GetFeatureClass(IMapServer3
 mapServer, int
 layerID)
        {
            IMapServerDataAccess
 dataAccess = (IMapServerDataAccess
)mapServer;
            return
 dataAccess.GetDataSource(mapServer.DefaultMapName, layerID) as
 IFeatureClass
;
        }

Return your client a json using ToJsonObject

JsonObject jsonResultsGeometry = Conversion.ToJsonObject(polygonGeometry); 

You can see this sample (spatial query soe) that it does your same task (input point and return polygons) http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//000100000nwp000000

DrewDowling
Occasional Contributor III

I couldn't figure out how to use IMapServerDataAccess until I read this. Thank you so much.

0 Kudos