<?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 How to use QueryParameters to get features contained in an area? in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660724#M4546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to select features according to a QueryParameters object.&lt;/P&gt;&lt;P&gt;I don't understand why I get all features when I call&amp;nbsp;queryFeaturesAsync&amp;nbsp;whereas I expect a subset of it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried in vain to change the value of&amp;nbsp;SpatialRelationship, set an envelope or set max features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;Point&lt;/SPAN&gt; gps = &lt;SPAN&gt;new &lt;/SPAN&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;Point&lt;/SPAN&gt;(-&lt;SPAN style="color: #0000ff;"&gt;1.640235&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;48.127568&lt;/SPAN&gt;, SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());&lt;/PRE&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;Polygon searchGeometry = GeometryEngine.&lt;SPAN&gt;buffer&lt;/SPAN&gt;(gps, &lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;QueryParameters queryParams = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;QueryParameters();&lt;BR /&gt;queryParams.setGeometry(searchGeometry);&lt;BR /&gt;queryParams.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);&lt;BR /&gt;queryParams.setOutSpatialReference(SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());&lt;BR /&gt;queryParams.setSpatialRelationship(QueryParameters.SpatialRelationship.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;CONTAINS&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;ListenableFuture&amp;lt;FeatureQueryResult&amp;gt; results = geoDbTable.queryFeaturesAsync(queryParams);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;results.addDoneListener(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Runnable() {&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #808000;"&gt; @Override &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;run() {&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;FeatureQueryResult fqr = &lt;SPAN style="color: #660e7a;"&gt;results&lt;/SPAN&gt;.get();&lt;BR /&gt;&lt;BR /&gt; List result = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;ArrayList();&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;counter = &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;;&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;while &lt;/SPAN&gt;(fqr.iterator().hasNext()){&lt;BR /&gt; counter+=&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;;&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(counter%&lt;SPAN style="color: #0000ff;"&gt;100 &lt;/SPAN&gt;== &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;) {&lt;BR /&gt; Log.&lt;SPAN&gt;d&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"FeatureQueryResult"&lt;/SPAN&gt;, Long.&lt;SPAN&gt;toString&lt;/SPAN&gt;(counter));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;}
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;}&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:57:47 GMT</pubDate>
    <dc:creator>GaelDurand</dc:creator>
    <dc:date>2021-12-12T03:57:47Z</dc:date>
    <item>
      <title>How to use QueryParameters to get features contained in an area?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660724#M4546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to select features according to a QueryParameters object.&lt;/P&gt;&lt;P&gt;I don't understand why I get all features when I call&amp;nbsp;queryFeaturesAsync&amp;nbsp;whereas I expect a subset of it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried in vain to change the value of&amp;nbsp;SpatialRelationship, set an envelope or set max features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;Point&lt;/SPAN&gt; gps = &lt;SPAN&gt;new &lt;/SPAN&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;Point&lt;/SPAN&gt;(-&lt;SPAN style="color: #0000ff;"&gt;1.640235&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;48.127568&lt;/SPAN&gt;, SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());&lt;/PRE&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;Polygon searchGeometry = GeometryEngine.&lt;SPAN&gt;buffer&lt;/SPAN&gt;(gps, &lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;QueryParameters queryParams = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;QueryParameters();&lt;BR /&gt;queryParams.setGeometry(searchGeometry);&lt;BR /&gt;queryParams.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);&lt;BR /&gt;queryParams.setOutSpatialReference(SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());&lt;BR /&gt;queryParams.setSpatialRelationship(QueryParameters.SpatialRelationship.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;CONTAINS&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;ListenableFuture&amp;lt;FeatureQueryResult&amp;gt; results = geoDbTable.queryFeaturesAsync(queryParams);&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;results.addDoneListener(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Runnable() {&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #808000;"&gt; @Override &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;run() {&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;FeatureQueryResult fqr = &lt;SPAN style="color: #660e7a;"&gt;results&lt;/SPAN&gt;.get();&lt;BR /&gt;&lt;BR /&gt; List result = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;ArrayList();&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;counter = &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;;&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;while &lt;/SPAN&gt;(fqr.iterator().hasNext()){&lt;BR /&gt; counter+=&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;;&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(counter%&lt;SPAN style="color: #0000ff;"&gt;100 &lt;/SPAN&gt;== &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;) {&lt;BR /&gt; Log.&lt;SPAN&gt;d&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"FeatureQueryResult"&lt;/SPAN&gt;, Long.&lt;SPAN&gt;toString&lt;/SPAN&gt;(counter));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;}
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;}&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:57:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660724#M4546</guid>
      <dc:creator>GaelDurand</dc:creator>
      <dc:date>2021-12-12T03:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use QueryParameters to get features contained in an area?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660725#M4547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe that your searchGeometry takes on the spatial reference of the point that you are buffering. &amp;nbsp;Therefore, I believe you created a 500 degree buffer which will encompass the globe twice over. &amp;nbsp;You may want to pick a different spatial reference to use like web mercator which is measured in meters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2017 12:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660725#M4547</guid>
      <dc:creator>AlexanderNohe1</dc:creator>
      <dc:date>2017-09-18T12:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use QueryParameters to get features contained in an area?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660726#M4548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I followed your advice by&amp;nbsp;converting from WGS 84 to Web Mercator, but the result is the same.&lt;/P&gt;&lt;P&gt;It's as if&amp;nbsp;queryParams&amp;nbsp;was useless whichever&amp;nbsp;Spatial Reference I chose.&lt;/P&gt;&lt;P&gt;Moreover, I got more than 500 features while this method should&amp;nbsp;only return 500 features because of&amp;nbsp;setMaxFeatures(500).&lt;/P&gt;&lt;P&gt;Do you see what's wrong with my code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Point gps = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Point(-&lt;SPAN style="color: #0000ff;"&gt;1.640235&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;48.127568&lt;/SPAN&gt;, SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());
Point mercator = CoordinateFormatter.&lt;SPAN&gt;fromUtm&lt;/SPAN&gt;(CoordinateFormatter.&lt;SPAN&gt;toUtm&lt;/SPAN&gt;(gps, CoordinateFormatter.UtmConversionMode.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;LATITUDE_BAND_INDICATORS&lt;/SPAN&gt;, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;true&lt;/SPAN&gt;), 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpatialReferences.&lt;SPAN&gt;getWebMercator&lt;/SPAN&gt;(), CoordinateFormatter.UtmConversionMode.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;LATITUDE_BAND_INDICATORS&lt;/SPAN&gt;);

TextSymbol textSymbol =
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;TextSymbol(&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Test"&lt;/SPAN&gt;, Color.&lt;SPAN&gt;rgb&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;255&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextSymbol.HorizontalAlignment.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;CENTER&lt;/SPAN&gt;, TextSymbol.VerticalAlignment.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;BOTTOM&lt;/SPAN&gt;);
Graphic textGraphic = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Graphic(mercator, textSymbol);
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mGraphicsOverlayETARE&lt;/SPAN&gt;.getGraphics().add(textGraphic);
&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;Polygon searchGeometry = GeometryEngine.&lt;SPAN&gt;buffer&lt;/SPAN&gt;(mercator, &lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);

&lt;SPAN style="color: #808080;"&gt;// create a query to find which features are contained by the query geometry
&lt;/SPAN&gt;QueryParameters queryParams = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;QueryParameters();
queryParams.setGeometry(searchGeometry);
queryParams.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;500&lt;/SPAN&gt;);
queryParams.setOutSpatialReference(SpatialReferences.&lt;SPAN&gt;getWebMercator&lt;/SPAN&gt;());
queryParams.setSpatialRelationship(QueryParameters.SpatialRelationship.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;CONTAINS&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:57:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660726#M4548</guid>
      <dc:creator>GaelDurand</dc:creator>
      <dc:date>2021-12-12T03:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use QueryParameters to get features contained in an area?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660727#M4549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rather than doing the CoordinateFormatter class, I would encourage you to use GeometryEngine::Project(). &amp;nbsp;This will project the point to the correct spatial reference which you can then pass in (might be a little more straightforward than what you have there). &amp;nbsp;When doing this, are you seeing different results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where are you executing this query? &amp;nbsp;Can we see that line of code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 13:27:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-use-queryparameters-to-get-features/m-p/660727#M4549</guid>
      <dc:creator>AlexanderNohe1</dc:creator>
      <dc:date>2017-09-20T13:27:40Z</dc:date>
    </item>
  </channel>
</rss>

