Search code examples
javascriptgisesriesri-maps

Want to merge group of tracts with esri using javascript


I am using Esri web with javascript to create a heat map of tracts. There are groups of tracts that represent one area so I want to merge and remove the bounders between them. How can I do this?

This is How I draw the tracts:

var featureLayer = new FeatureLayer({
                    url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tract_Areas_analysis_trim/FeatureServer/0",
                    outFields: ["*"],
                    renderer: renderer,
                    definitionExpression: "FIPS IN (" + fips + ")"
                });

Solution

  • Well, It seems clear that your want to create one large polygon out of too many small polygons(group of tracts).

    Follow below steps to achieve this-

    1. don't add feature layer on the map
    2. Create an empty map with basemap and add a graphics layer on it.
    3. query the group of tracts from the layer using esri query task and store the geometry in an array.
    4. use esri gemetryEngine union method and pass the array to it.
    5. union will return a big ploygon without the inner boundaries of 'group of tracts'.
    6. create an esri graphics with new polygon symbol and union polygon geometry.
    7. Add that graphics to the previously added graphics layer.

    Feel free to shoot your further queries.

    Hoping this will help you :)