Search code examples
polygonarcgisarcgis-js-apioutline

Need to outline several contiguous areas on map


I am working with maps that are based upon the lot and block survey system. So, for example, my house could be a parcel identified by block 34, lot 2. For every block, there are usually multiple lots and they are all within the same contiguous area. My users can query for block and lot, and the map will zoom in and display that exact block/lot and outline it. What they want to do is to show all lots for a specified block and draw an outline around the entire block.

I can use the JavaScript API and QueryTask execute() method to get all of the lots/features for a block. However, I do not know if there is a way to aggregate the feature data such that I can calculate and draw a border surrounding them all.

I have tried the executeForExtent() method and it works, but the extent, of course, is a rectangle, which means that while the outline will encompass all of the lots, the edges will have partials of other blocks and lots.

I know it's possible because I have seen it, but I do not have access to that code or the folks who developed it.

Does anybody know of a way to create an outline such as the one I'm describing?

TIA


Solution

  • I think you're looking for a way to calculate a convex hull which you can do with the geometry engine in the ArcGIS API for JavaScript. See https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#convexHull

    Update: or maybe better the union method as suggested by @cabesuon in a comment below. Same basic principle - use the GeometryEngine :)