<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get returnCentroid to work when querying Feature Service layer in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049852#M3811</link>
    <description>&lt;P&gt;There &lt;EM&gt;is &lt;/EM&gt;still a way to get the centroids, if you don't mind doing some Python.&lt;/P&gt;&lt;P&gt;Once you query the layer out to a &lt;EM&gt;spatially enabled dataframe&lt;/EM&gt;, you can call the&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.GeoSeriesAccessor.centroid" target="_self"&gt; &lt;STRONG&gt;centroid&lt;/STRONG&gt; property&lt;/A&gt; on a GeoSeries Accessor of the dataframe's &lt;STRONG&gt;SHAPE&lt;/STRONG&gt; column.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sdf = lines_service.layers[0].query(as_df=True)

gsa = arcgis.features.GeoSeriesAccessor(sdf['SHAPE'])

gsa.centroid&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which returns:&lt;/P&gt;&lt;PRE&gt;0     (986305.7876933983, 1833079.8610554787)
1     (960080.7627723165, 1827236.9255665324)
2     (943782.9728523004, 1822116.2102860417)
3      (920423.2422279464, 1823134.951778373)
4     (991925.4577918178, 1758800.7325564628)
5     (916942.1624821002, 1776554.3496633286)
6     (927332.5836300697, 1748540.1104202385)
7     (952494.8496332371, 1765384.4943458117)&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;And just to confirm, the layer I'm running it on has the return centroid property set to &lt;STRONG&gt;False&lt;/STRONG&gt;. The difference here is that I'm asking the dataframe for the centroid, not the REST endpoint.&lt;/P&gt;&lt;P&gt;I don't know if that's applicable to what you're trying to do with the data, but wanted to make sure you knew about it.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Apr 2021 21:49:08 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-04-21T21:49:08Z</dc:date>
    <item>
      <title>How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048879#M3799</link>
      <description>&lt;P&gt;According to the documentation here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's a parameter, returnCentroid. According to the documentation Notes:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Note:&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;The layer metadata returns&amp;nbsp;supportsReturningGeometryCentroid&amp;nbsp;in the&amp;nbsp;advancedQueryCapabilities&amp;nbsp;metadata object. &lt;FONT color="#FF0000"&gt;The absence of the&amp;nbsp;supportsReturningGeometryCentroid&amp;nbsp;property means that the server does not support the&amp;nbsp;returnCentroid&amp;nbsp;parameter.&lt;/FONT&gt; Line and point data will return&amp;nbsp;supportReturningGeometryCentroid&amp;nbsp;as&amp;nbsp;false.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Question: I'm trying to figure out how to make the server support the returnCentroid parameter, because in our case, the supportsReturningGeometryCentroid property does not exist. FYI: We're on 10.8 so I know this is supposed to be supported in our version.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 20:07:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048879#M3799</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-04-19T20:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048889#M3800</link>
      <description>&lt;P&gt;The underlying service in question was published from the ArcMap engine, not ArcGIS PRO (if that matters).&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 20:30:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048889#M3800</guid>
      <dc:creator>pfoppe</dc:creator>
      <dc:date>2021-04-19T20:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048901#M3801</link>
      <description>&lt;P&gt;That property would be contained within the larger advancedQueryCapabilities:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;"advancedQueryCapabilities": {
  "supportsPagination": true,
  "supportsQueryWithDistance": true,
  "supportsReturningQueryExtent": true,
  "supportsStatistics": true,
  "supportsOrderBy": true,
  "supportsDistinct": true,
  "supportsQueryWithResultType": true,
  "supportsSqlExpression": true,
  "supportsReturningGeometryCentroid": true
}&lt;/LI-CODE&gt;&lt;P&gt;Do you see anything in that object?&lt;/P&gt;&lt;P&gt;What is the data source you're querying? Is it hosted, or a registered service on a server?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 21:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048901#M3801</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-19T21:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048908#M3802</link>
      <description>&lt;P&gt;Thanks for the response. Data is hosted in a File Geodatabase on a back-end File system that is registered with a stand-alone (not federated) ArcGIS Server v10.8.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 22:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1048908#M3802</guid>
      <dc:creator>pfoppe</dc:creator>
      <dc:date>2021-04-19T22:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049074#M3803</link>
      <description>&lt;P&gt;Hm. I wonder if that's somehow related. I don't have experience with using file-based resources through a server, so I don't even have any layers to test this with.&lt;/P&gt;&lt;P&gt;Can you use the returnCentroid capability with other layers that are either Hosted Feature Layers or published from an Enterprise Geodatabase?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 13:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049074#M3803</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-20T13:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049107#M3805</link>
      <description>&lt;P&gt;Thanks for the response Josh.&amp;nbsp; I think I may have figured it out.&amp;nbsp; I think(???) it ONLY works on Feature Services.&amp;nbsp; Not on Map Services.&amp;nbsp; I didn't even think of that as I just assumed all queries work on Map Services.&amp;nbsp; I'm not sure if this would be a bug in the REST-based functionality, or it's as intended? I'm testing my theory today.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 13:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049107#M3805</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-04-20T13:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049109#M3806</link>
      <description>&lt;P&gt;Oh, that sounds like it would be the issue. There are a number of things that just don't see, to work the same against a map service vs a feature service. Post back how your test goes, I'm curious to hear!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:00:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049109#M3806</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-20T14:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049419#M3808</link>
      <description>&lt;P&gt;OK, that was it.&amp;nbsp; You have to setup the service as a "FeatureService" with Query capabilities turned on. Then, it looks like you can return the centroids.&amp;nbsp; is it a Bug or a Feature??&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 00:07:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049419#M3808</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-04-21T00:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049563#M3809</link>
      <description>&lt;P&gt;A feature, I believe.&lt;/P&gt;&lt;P&gt;Though I'm of the mindset that anyone who wants my data should be able to get at it as easily as possible, I know there are situations in which tighter control over data access would be desirable.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 14:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049563#M3809</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-21T14:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049840#M3810</link>
      <description>&lt;P&gt;so re-reading the documentation on this. Turns out it's not possible on my linear data... ugh..&lt;/P&gt;&lt;P&gt;Used to return the geometry centroid associated with each feature returned. If&amp;nbsp;&lt;SPAN&gt;true&lt;/SPAN&gt;, the result includes the geometry centroid. The default is&amp;nbsp;&lt;SPAN&gt;false&lt;/SPAN&gt;. &lt;FONT color="#FF0000"&gt;Currently, this parameter is not supported for polygon data&lt;/FONT&gt; and is ignored for&amp;nbsp;&lt;SPAN&gt;count&lt;/SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN&gt;objectID&lt;/SPAN&gt;&amp;nbsp;queries. This parameter is only supported on layer-level queries.&lt;/P&gt;&lt;H5&gt;Note:&lt;/H5&gt;&lt;P&gt;The layer metadata returns&amp;nbsp;&lt;SPAN&gt;supportsReturningGeometryCentroid&lt;/SPAN&gt;&amp;nbsp;in the&amp;nbsp;&lt;SPAN&gt;advancedQueryCapabilities&lt;/SPAN&gt;&amp;nbsp;metadata object. The absence of the&amp;nbsp;&lt;SPAN&gt;supportsReturningGeometryCentroid&lt;/SPAN&gt;&amp;nbsp;property means that the server does not support the&amp;nbsp;&lt;SPAN&gt;returnCentroid&lt;/SPAN&gt;&amp;nbsp;parameter. &lt;FONT color="#FF0000"&gt;Line and point data will return&amp;nbsp;&lt;SPAN&gt;supportReturningGeometryCentroid&lt;/SPAN&gt;&amp;nbsp;as&amp;nbsp;&lt;SPAN&gt;false&lt;/SPAN&gt;.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 21:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049840#M3810</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-04-21T21:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049852#M3811</link>
      <description>&lt;P&gt;There &lt;EM&gt;is &lt;/EM&gt;still a way to get the centroids, if you don't mind doing some Python.&lt;/P&gt;&lt;P&gt;Once you query the layer out to a &lt;EM&gt;spatially enabled dataframe&lt;/EM&gt;, you can call the&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.GeoSeriesAccessor.centroid" target="_self"&gt; &lt;STRONG&gt;centroid&lt;/STRONG&gt; property&lt;/A&gt; on a GeoSeries Accessor of the dataframe's &lt;STRONG&gt;SHAPE&lt;/STRONG&gt; column.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sdf = lines_service.layers[0].query(as_df=True)

gsa = arcgis.features.GeoSeriesAccessor(sdf['SHAPE'])

gsa.centroid&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which returns:&lt;/P&gt;&lt;PRE&gt;0     (986305.7876933983, 1833079.8610554787)
1     (960080.7627723165, 1827236.9255665324)
2     (943782.9728523004, 1822116.2102860417)
3      (920423.2422279464, 1823134.951778373)
4     (991925.4577918178, 1758800.7325564628)
5     (916942.1624821002, 1776554.3496633286)
6     (927332.5836300697, 1748540.1104202385)
7     (952494.8496332371, 1765384.4943458117)&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;And just to confirm, the layer I'm running it on has the return centroid property set to &lt;STRONG&gt;False&lt;/STRONG&gt;. The difference here is that I'm asking the dataframe for the centroid, not the REST endpoint.&lt;/P&gt;&lt;P&gt;I don't know if that's applicable to what you're trying to do with the data, but wanted to make sure you knew about it.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 21:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1049852#M3811</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-21T21:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1050115#M3816</link>
      <description>&lt;P&gt;Thanks Josh. I'm actually doing this using the JavaScript API. I could possibly do a request using the geometry service to get the center for each geometry passed in, but trying to keep this thing fast as I may have to do it for tens of thousands of lines at a time on a public-facing app, so speed is key. Thanks again for your help.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Karen&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 15:21:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1050115#M3816</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-04-22T15:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get returnCentroid to work when querying Feature Service layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1610852#M4982</link>
      <description>&lt;P&gt;In 2025, I confirmed that only FeatureServer( feature service ) have returnCentroid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any arcgis online ( esri hosted ) have this, because esri hosted only provide featureServer(feature service), esri don't provide hosted map-server(or map-service).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to host yourself for a map-server(map-service)&lt;/P&gt;&lt;P&gt;here is sample&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="https://services.arcgis.com/aA3snZwJfFkVyDuP/ArcGIS/rest/services/BDC_Cities_and_Communities/FeatureServer/0?f=pjson" href="https://services.arcgis.com/aA3snZwJfFkVyDuP/ArcGIS/rest/services/BDC_Cities_and_Communities/FeatureServer/0?f=pjson" target="_self"&gt;https://services.arcgis.com/aA3snZwJfFkVyDuP/ArcGIS/rest/services/BDC_Cities_and_Communities/FeatureServer/0?f=pjson&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hp_571.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131281i0A0C9E6FAB045945/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hp_571.png" alt="hp_571.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While MapServer ( map service ) don't have&amp;nbsp;returnCentroid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is sample&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="https://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_StreetMap/MapServer/0?f=pjson" href="https://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_StreetMap/MapServer/0?f=pjson" target="_self"&gt;https://public.gis.lacounty.gov/public/rest/services/LACounty_Cache/LACounty_StreetMap/MapServer/0?f=pjson&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hp_572.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131282iE1E582B9F644FCB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hp_572.png" alt="hp_572.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 17:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-get-returncentroid-to-work-when-querying/m-p/1610852#M4982</guid>
      <dc:creator>hoogw</dc:creator>
      <dc:date>2025-05-01T17:19:04Z</dc:date>
    </item>
  </channel>
</rss>

