2

I have a Site reference feature service data in polygons served up by ArcGIS Server. I need to get the centroid coordinate of a polygon by the Id but can’t find a method out of the box.

I’m working on a GeoEvent Processor Service that will use this Site service to grab a centroid from a site Id. So far I believe my options are:

  • Custom GP service, python – takes in polygon rings, returns point
  • Server Object Extension – same as above
  • Sql view, query layer served up as a feature service that uses STCentroid (The database uses a SQL GEOGRAPHY type) on the Site layer. Would query the layer by ID to return the geometry.

The first two options keep me on track with a service orientated architecture however it certainly seems overkill to be writing an SOE for one function. The final option could be a ‘goer’ but it means my logic is coupled to SQL Server.

  • 1
    I'm having trouble understanding what your question is. What are you trying to ask? – Devdatta Tengshe Feb 5 '14 at 6:06
  • Be sure to use the edit button beneath your Question when clarifying it. – PolyGeo Feb 5 '14 at 6:16
1

"I need to get the centroid coordinate of a polygon by the Id"

First you'll need to get a reference to the polygon via its ID. You can do this with a QueryTask.

You'll then have access to the polygon's geometry, so you can use the getCentroid method on the shape.

0

I realised that the LabelPoints method over REST for ArcGIS Server Geometry service returns a polygon centroid (point) for an input Geometry.

This is more favourable than having a query at the database level.

0

There are several GeoEvent processors available on their GitHub gallery that allow you to extract a centroid. This one is ready-compiled, supported, and can be downloaded and added to your GeoEvent (via GeoEvent Manager) to allow you to calculate centroids from polygons.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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