<?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: spatial filter for relationship query? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303104#M27828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you explain a bit more what you like to accomplish?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 16:36:24 GMT</pubDate>
    <dc:creator>JasonZou</dc:creator>
    <dc:date>2013-11-22T16:36:24Z</dc:date>
    <item>
      <title>spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303100#M27824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a spatial filter property for relationship queries like there is for normal queries? I was not able to find one, but it seems strange that you wouldn't be able to specify the geometry for your relationship query...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 14:46:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303100#M27824</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-11-22T14:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303101#M27825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes. Check out the Constants property on the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/query-amd.html" rel="nofollow noopener noreferrer" target="_blank"&gt;query class&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Constant Description&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_CONTAINS Part or all of a feature from feature class 1 is contained within a feature from feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_CROSSES The feature from feature class 1 crosses a feature from feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_ENVELOPEINTERSECTS The envelope of feature class 1 intersects with the envelope of feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_INDEXINTERSECTS The envelope of the query feature class intersects the index entry for the target feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_INTERSECTS Part of a feature from feature class 1 is contained in a feature from feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_OVERLAPS Features from feature class 1 overlap features in feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_RELATION Allows specification of any relationship defined using the Shape Comparison Language.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_TOUCHES The feature from feature class 1 touches the border of a feature from feature class 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPATIAL_REL_WITHIN The feature from feature class 1 is completely enclosed by the feature from feature class 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lets assume the variable 'feature' is a &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/graphic-amd.html" rel="nofollow noopener noreferrer" target="_blank"&gt;graphic&lt;/A&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
queryTask = new QueryTask(...url to your service...)
query = new Query();

query.geometry = feature.geometry;
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.returnGeometry = true;
query.outFields = ["myField", "myOtherField"];
...etc with the other query parameters...

queryTask.execute(query);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will return any features from the queried service which intersect the geometry of 'feature'.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303101#M27825</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2021-12-11T14:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303102#M27826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;....whoops. You were probably referring to &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/relationshipquery-amd.html"&gt;RelationshipQuery&lt;/A&gt;&lt;SPAN&gt;. My bad.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:07:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303102#M27826</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2013-11-22T16:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303103#M27827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;that would be correct, but it is a nice explanation regardless! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess that the only thing I can do is perform a normal query against my relationship query results in order to use a spatial filter...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:21:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303103#M27827</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-11-22T16:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303104#M27828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you explain a bit more what you like to accomplish?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:36:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303104#M27828</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-11-22T16:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303105#M27829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I execute my relationship query, instead of showing all related records, I only want those that intersect with a particular geometry (in this case, county boundaries). It does not appear though the following is a valid relationship query parameter;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;myRelationshipQuery.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know if there are any alternative approaches to refine my relationship query results to a particular spatial region&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:48:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303105#M27829</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-11-22T16:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303106#M27830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see. Unfortunately, I don't see a direct way to do that. What you can do is to use &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/geometryservice-amd.html#intersect"&gt;geometryService.intersect(geometries,geometry,callback?,errback?)&lt;/A&gt;&lt;SPAN&gt; to filter the geometries returned from the relationship query.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 17:05:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303106#M27830</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-11-22T17:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303107#M27831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried your suggestion and it looks like I did not construct the intersect correctly...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to take an extra step after my relationship query completes and reproject my output. The reproject works fine but my intersect breaks before I'm even able to step into it, so it's not liking the parameters I'm providing. I first provide an array of my reprojected graphics' geometry, then the geometry of my "firstGraphic" with which to intersect, and a callback. I'm not sure where I'm going wrong with the intersect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
documents.queryRelatedFeatures(queryRecPoint, function(relatedRecords) {
 fset = relatedRecords[fsetObjectIDArrayPoint[0]];
 for(var i=0, il = fset.features.length; i &amp;lt; il; i++){
&amp;nbsp; thirdGraphics = fset.features&lt;I&gt;;
&amp;nbsp; params = new esri.tasks.ProjectParameters();
&amp;nbsp; params.geometries = [thirdGraphics.geometry];
&amp;nbsp; params.outSR = map.spatialReference;
&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; //gsvc is my geometry service
&amp;nbsp; gsvc.project(params, function(features){
&amp;nbsp;&amp;nbsp; newPoints = features[0];
&amp;nbsp;&amp;nbsp; projectedGraphicPoint = new esri.Graphic(newPoints);
&amp;nbsp; });
&amp;nbsp; gsvc.intersect([projectedGraphicPoint.geometry], firstGraphic.geometry, function(intFeature){
&amp;nbsp;&amp;nbsp; var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,200,200]), 1), new dojo.Color([0,0,200,0.25]));
&amp;nbsp;&amp;nbsp; var intersectGraphic = new esri.Graphic(intFeature);
&amp;nbsp;&amp;nbsp; intersectGraphic.setSymbol(symbol);
&amp;nbsp;&amp;nbsp; intersectGraphic.setInfoTemplate(infoTemplate);
&amp;nbsp;&amp;nbsp; map.graphics.add(intersectGraphic);
&amp;nbsp; });
});
&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:32:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303107#M27831</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2021-12-11T14:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303108#M27832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try the below code. It should be much more efficient than loop through each geometry for reproject and intersect operations. If not working still, please point out which line failed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;documents.queryRelatedFeatures(queryRecPoint, function (relatedRecords) { &amp;nbsp;&amp;nbsp;&amp;nbsp; fset = relatedRecords[fsetObjectIDArrayPoint[0]]; &amp;nbsp;&amp;nbsp;&amp;nbsp; params = new esri.tasks.ProjectParameters(); &amp;nbsp;&amp;nbsp;&amp;nbsp; params.geometries = array.map(fset.features, function (aFeature) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return aFeature.geometry; &amp;nbsp;&amp;nbsp;&amp;nbsp; }); &amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSR = map.spatialReference; &amp;nbsp;&amp;nbsp;&amp;nbsp; //gsvc is my geometry service &amp;nbsp;&amp;nbsp;&amp;nbsp; gsvc.project(params, function (geoms) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gsvc.intersect(geoms, firstGraphic.geometry, function (intGeoms) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 200, 200]), 1), new dojo.Color([0, 0, 200, 0.25])); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.forEach(intGeoms, function (aGeom) { &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; var intersectGraphic = new esri.Graphic(aGeom, symbol, null, infoTemplate); &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; map.graphics.add(intersectGraphic); &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; }); });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 21:18:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303108#M27832</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-11-22T21:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: spatial filter for relationship query?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303109#M27833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The intersect tool was just what I needed. Many thanks for the helpful code sample!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 15:05:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/spatial-filter-for-relationship-query/m-p/303109#M27833</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-12-02T15:05:55Z</dc:date>
    </item>
  </channel>
</rss>

