<?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: Get intersected polygons geometry based on polygon in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-intersected-polygons-geometry-based-on/m-p/716793#M66614</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some progress on intersecting the polygon inside of multiple polygon but I want to split into individual&amp;nbsp;geometry with respective objectID. Is there&amp;nbsp;anyway or API reference to achieve this geoprocessing task?&lt;/P&gt;&lt;P&gt;Here is the snippet:&lt;/P&gt;&lt;P&gt;//query overlapping feature on ExistingPolygon&lt;BR /&gt; ExistingPolygon.queryFeatures(queryOverlappingOuterPolygon, function(overlappingFeatureSet) {&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; var queryOverlappingOuterPolygon = new Query();&lt;BR /&gt; queryOverlappingOuterPolygon.geometry = addedFeature.geometry;&lt;BR /&gt; queryOverlappingOuterPolygon.outSpatialReference = map.spatialReference;&lt;BR /&gt; queryOverlappingOuterPolygon.spatialReference = Query.SPATIAL_INTERSECTS;&lt;BR /&gt; &lt;BR /&gt; //query overlapping features on IntersectingPolygon&lt;BR /&gt; ExistingPolygon.queryFeatures(queryOverlappingOuterPolygon, function(overlappingFeatureSet) {&lt;BR /&gt; if(overlappingFeatureSet.features.length == 0 || overlappingFeatureSet.features.length == 1) {&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; var geometryArr = [];&lt;BR /&gt; for(var index = 0; index &amp;lt; overlappingFeatureSet.features.length; index++) {&lt;BR /&gt; if(addedFeature.attributes["OBJECTID_1"] !== overlappingFeatureSet.features[index].attributes["OBJECTID_1"]) {&lt;BR /&gt; geometryArr.push(overlappingFeatureSet.features[index].geometry);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; //union of all overlapping features&lt;BR /&gt; var unionGeometry = geometryEngine.union(geometryArr);&lt;BR /&gt; //modify added feature geometry so that the feature does not overlap other features in IntersectingPolygon&lt;BR /&gt; var differenceGeometry = geometryEngine.intersect(addedFeature.geometry, unionGeometry);&lt;BR /&gt; addedFeature.geometry = differenceGeometry;&lt;BR /&gt; IntersectingPolygon.applyEdits(null, [addedFeature], null);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/396707_pastedImage_3.png" style="width: 447px; height: 425px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Feb 2018 15:27:26 GMT</pubDate>
    <dc:creator>KushendraShah1</dc:creator>
    <dc:date>2018-02-15T15:27:26Z</dc:date>
    <item>
      <title>Get intersected polygons geometry based on polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-intersected-polygons-geometry-based-on/m-p/716792#M66613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need help on getting polygons based on intersecting polygon in web map using arcgis javascript api. Say there is base polygon A and when the user edit polygon B over the multiple polygon A, the polygon B gets intersected/splited based on polygon A (please see the attached figure). So far I can do inside the base polygon but is there way I can query to obtain the geometry outside of the base polygon Is there any code snippet or sample/template to achieve this task?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my snippet:&lt;/P&gt;&lt;P&gt;IntersectingPolygon.on("edits-complete", modifyFeature);&lt;/P&gt;&lt;P&gt;function modifyFeature(evt) {&lt;BR /&gt; var queryFeatureWithId = new Query();&lt;BR /&gt; queryFeatureWithId.objectIds = [evt.adds[0].objectId];&lt;BR /&gt; queryFeatureWithId.outFields = ["*"];&lt;BR /&gt; queryFeatureWithId.num = 1;&lt;BR /&gt; queryFeatureWithId.outSpatialReference = map.spatialReference;&lt;BR /&gt; queryFeatureWithId.spatialRelationship = Query.SPATIAL_INTERSECTS;&lt;BR /&gt; queryFeatureWithId.returnGeometry = true;&lt;BR /&gt; &lt;BR /&gt; var addedFeature = null;&lt;BR /&gt; var addedFeatureObjectId = evt.adds[0].objectId;&lt;BR /&gt; &lt;BR /&gt; //use the feature's object id to get the feature's geometry&lt;BR /&gt; IntersectingPolygon.queryFeatures(queryFeatureWithId, function(featureSet){&lt;BR /&gt; if(featureSet.features.length == 0) {&lt;BR /&gt; return; &lt;BR /&gt; }&lt;BR /&gt; addedFeature = featureSet.features[0];&lt;BR /&gt; &lt;BR /&gt; var queryOverlappingOuterPolygon = new Query();&lt;BR /&gt; queryOverlappingOuterPolygon.geometry = addedFeature.geometry;&lt;BR /&gt; queryOverlappingOuterPolygon.num = 1;&lt;BR /&gt; queryOverlappingOuterPolygon.outSpatialReference = map.spatialReference;&lt;BR /&gt; queryOverlappingOuterPolygon.spatialRelationship = Query.SPATIAL_REL_RELATION;&lt;BR /&gt; &lt;BR /&gt; //query overlapping feature on ExistingPolygon&lt;BR /&gt; ExistingPolygon.queryFeatures(queryOverlappingOuterPolygon, function(overlappingFeatureSet) {&lt;BR /&gt; if(overlappingFeatureSet.features.length == 0) {&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; var differenceGeometry = geometryEngine.intersect(addedFeature.geometry, overlappingFeatureSet.features[0].geometry);&lt;BR /&gt; //modify added feature geometry so that the feature resides within the boundary of outer polygon feature&lt;BR /&gt; addedFeature.geometry = differenceGeometry;&lt;BR /&gt; IntersectingPolygon.applyEdits(null, [addedFeature], null);&lt;BR /&gt; &lt;BR /&gt; var queryOverlappingInnerPolygon = new Query();&lt;BR /&gt; queryOverlappingInnerPolygon.geometry = addedFeature.geometry;&lt;BR /&gt; queryOverlappingInnerPolygon.outSpatialReference = map.spatialReference;&lt;BR /&gt; queryOverlappingInnerPolygon.spatialReference = Query.SPATIAL_INTERSECTS;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; });&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kush&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 20:50:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-intersected-polygons-geometry-based-on/m-p/716792#M66613</guid>
      <dc:creator>KushendraShah1</dc:creator>
      <dc:date>2018-01-31T20:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get intersected polygons geometry based on polygon</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-intersected-polygons-geometry-based-on/m-p/716793#M66614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some progress on intersecting the polygon inside of multiple polygon but I want to split into individual&amp;nbsp;geometry with respective objectID. Is there&amp;nbsp;anyway or API reference to achieve this geoprocessing task?&lt;/P&gt;&lt;P&gt;Here is the snippet:&lt;/P&gt;&lt;P&gt;//query overlapping feature on ExistingPolygon&lt;BR /&gt; ExistingPolygon.queryFeatures(queryOverlappingOuterPolygon, function(overlappingFeatureSet) {&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; var queryOverlappingOuterPolygon = new Query();&lt;BR /&gt; queryOverlappingOuterPolygon.geometry = addedFeature.geometry;&lt;BR /&gt; queryOverlappingOuterPolygon.outSpatialReference = map.spatialReference;&lt;BR /&gt; queryOverlappingOuterPolygon.spatialReference = Query.SPATIAL_INTERSECTS;&lt;BR /&gt; &lt;BR /&gt; //query overlapping features on IntersectingPolygon&lt;BR /&gt; ExistingPolygon.queryFeatures(queryOverlappingOuterPolygon, function(overlappingFeatureSet) {&lt;BR /&gt; if(overlappingFeatureSet.features.length == 0 || overlappingFeatureSet.features.length == 1) {&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; var geometryArr = [];&lt;BR /&gt; for(var index = 0; index &amp;lt; overlappingFeatureSet.features.length; index++) {&lt;BR /&gt; if(addedFeature.attributes["OBJECTID_1"] !== overlappingFeatureSet.features[index].attributes["OBJECTID_1"]) {&lt;BR /&gt; geometryArr.push(overlappingFeatureSet.features[index].geometry);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; //union of all overlapping features&lt;BR /&gt; var unionGeometry = geometryEngine.union(geometryArr);&lt;BR /&gt; //modify added feature geometry so that the feature does not overlap other features in IntersectingPolygon&lt;BR /&gt; var differenceGeometry = geometryEngine.intersect(addedFeature.geometry, unionGeometry);&lt;BR /&gt; addedFeature.geometry = differenceGeometry;&lt;BR /&gt; IntersectingPolygon.applyEdits(null, [addedFeature], null);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/396707_pastedImage_3.png" style="width: 447px; height: 425px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:27:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-intersected-polygons-geometry-based-on/m-p/716793#M66614</guid>
      <dc:creator>KushendraShah1</dc:creator>
      <dc:date>2018-02-15T15:27:26Z</dc:date>
    </item>
  </channel>
</rss>

