<?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: Populate featureTable with centroid only geometry from feature service in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1669173#M638</link>
    <description>&lt;P&gt;Thank you for the detailed and thorough response.&amp;nbsp; I'm not quite sure the route we'll go but I think you pretty much covered all options there.&amp;nbsp; Thank you.&amp;nbsp; I will be putting in a request for that via in the native SDK's Ideas.&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Tue, 02 Dec 2025 16:23:16 GMT</pubDate>
    <dc:creator>ForrestKaye</dc:creator>
    <dc:date>2025-12-02T16:23:16Z</dc:date>
    <item>
      <title>Populate featureTable with centroid only geometry from feature service</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668332#M634</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I was wondering if it is possible to populate a FeatureTable from a Feature Service with the centroid only geometry.&amp;nbsp; Looking through the documentation and attempting this does not make it seem possible with the maps SDK.&amp;nbsp; I could do it by pinging the FeatureService directly and using the returnCentroid parameter but that does not seem to be exposed in the SDK.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; If this is not possible can I put an enhancement request in for it?&amp;nbsp; Use case is this: Querying polygon features hosted in a service. I do not want to return the entire geometry for performance reasons. I want to sort the features by nearest location to the user.&amp;nbsp; Having access to the centroid would satisfy my sorting and performance needs.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 22:14:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668332#M634</guid>
      <dc:creator>ForrestKaye</dc:creator>
      <dc:date>2025-11-24T22:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Populate featureTable with centroid only geometry from feature service</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668345#M635</link>
      <description>&lt;P&gt;Hi Forrest, thanks for posting. You are right, currently our SDK doesn't support the&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;returnCentroid&lt;/EM&gt; parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Some (SDK-client-side) alternatives that may be worth a try: &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/geometryengine/labelpoint(for:)" target="_self"&gt;GeometryEngine.labelPoint(for:)&lt;/A&gt;, or &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/envelope/center" target="_blank" rel="noopener"&gt;Envelope.center&lt;/A&gt;, for a rough estimate if the polygon is simple. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As they may not be suitable for your use case,&amp;nbsp;please feel free to post in&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-maps-sdks-native-ideas/idb-p/arcgis-runtime-sdks-ideas" target="_blank" rel="noopener"&gt;Native SDKs Ideas&lt;/A&gt;&amp;nbsp;with your use case.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 23:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668345#M635</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2025-11-24T23:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Populate featureTable with centroid only geometry from feature service</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668617#M636</link>
      <description>&lt;P&gt;Hi Ting,&lt;/P&gt;&lt;P&gt;So for my intended workflow those will not work for me as I am populating my feature table with null geometries (queryParameters.returnGeometry = false) So will not have any geometry to get either the label point or the envelop center.&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first I had thought that some bare bones spatial data (label point or envelop center) did come through on the query even if the returnGeometry = null. But that does not seem to be the case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Hope was that I could get a minimal about of spatial data on my polygon so I can then sort them via distance to my users.&amp;nbsp; This would keep my queries performant as the geometries are quite complex and also avoid errors I had seen on the service alerting me too many queries had been performed querying complex geometries and would need to wait 60 seconds before performing more queries.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 20:26:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668617#M636</guid>
      <dc:creator>ForrestKaye</dc:creator>
      <dc:date>2025-11-25T20:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Populate featureTable with centroid only geometry from feature service</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668687#M637</link>
      <description>&lt;P&gt;Thanks for explaining your use case. I agree that not to fetch the complex geometry is a big time saver. Unfortunately, we haven't quite matched up with all the parameters that the REST API provides yet.&lt;/P&gt;&lt;P&gt;So if you want this feature, a few options to consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create a feature request in&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-maps-sdks-native-ideas/idb-p/arcgis-runtime-sdks-ideas" target="_blank" rel="noopener"&gt;Native SDKs Ideas&lt;/A&gt; board with your use case. Thus, this feature request can be triaged by our PMs.&lt;/LI&gt;&lt;LI&gt;Maybe include a pre-computed field in the feature table for the centroid, if you have control over that feature table.&lt;/LI&gt;&lt;LI&gt;Make a raw URLRequest to the REST API endpoint, and parse the response as you need. The URL structure for the GET request is relatively straightforward:&amp;nbsp;&lt;A href="https://YOUR_FEATURE_SERVER/FeatureServer/0/query?f=json&amp;amp;outFields=OBJECTID,STATE_NAME&amp;amp;where=1%3D1&amp;amp;outSR=4326&amp;amp;returnDistinctValues=false&amp;amp;returnGeometry=false&amp;amp;returnM=false&amp;amp;returnZ=false&amp;amp;returnCentroid=true&amp;amp;token=YOUR_API_KEY" target="_blank" rel="noopener"&gt;https://YOUR_FEATURE_SERVER/FeatureServer/0/query?f=json&amp;amp;outFields=OBJECTID,STATE_NAME&amp;amp;where=1%3D1&amp;amp;outSR=4326&amp;amp;returnDistinctValues=false&amp;amp;returnGeometry=false&amp;amp;returnM=false&amp;amp;returnZ=false&amp;amp;returnCentroid=true&amp;amp;token=YOUR_API_KEY&lt;/A&gt;&amp;nbsp;&lt;UL&gt;&lt;LI&gt;simply swap the feature server and API key from the URL&lt;/LI&gt;&lt;LI&gt;or create the request in Swift such as&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="swift"&gt;let baseURL = URL(string: "https://…/FeatureServer/0/query")!
var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false)!
components.queryItems = [
    URLQueryItem(name: "f", value: "json"),
    URLQueryItem(name: "outFields", value: "OBJECTID,STATE_NAME"),
    URLQueryItem(name: "where", value: "1=1"),
    URLQueryItem(name: "outSR", value: "4326"),
    URLQueryItem(name: "returnDistinctValues", value: "false"),
    URLQueryItem(name: "returnGeometry", value: "false"),
    URLQueryItem(name: "returnM", value: "false"),
    URLQueryItem(name: "returnZ", value: "false"),
    URLQueryItem(name: "returnCentroid", value: "true"),
    URLQueryItem(name: "token", value: "YOUR_API_KEY")
]
guard let finalURL = components.url else {
    fatalError("Invalid URL components")
}
var request = URLRequest(url: finalURL)
request.httpMethod = "GET"&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;It is possible to use&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/datataskinterceptor" target="_blank" rel="noopener"&gt;DataTaskInterceptor&lt;/A&gt; to intercept the query response and get the centroids from there, but I don't recommend doing that to introduce some fragile code logics. Nonetheless, I sent you a DM with a code snippet in case you want to give it a try.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 00:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1668687#M637</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2025-11-26T00:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Populate featureTable with centroid only geometry from feature service</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1669173#M638</link>
      <description>&lt;P&gt;Thank you for the detailed and thorough response.&amp;nbsp; I'm not quite sure the route we'll go but I think you pretty much covered all options there.&amp;nbsp; Thank you.&amp;nbsp; I will be putting in a request for that via in the native SDK's Ideas.&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 16:23:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/populate-featuretable-with-centroid-only-geometry/m-p/1669173#M638</guid>
      <dc:creator>ForrestKaye</dc:creator>
      <dc:date>2025-12-02T16:23:16Z</dc:date>
    </item>
  </channel>
</rss>

