0

I am making an online map using ArcGIS JavaScript 4.20.

I have a polygon feature that I want to render as points (I have points all over Norway, not just as this example):

Polygon features

I am using the simple renderer with this code:

    const map = new Map({
    basemap: "hybrid" // Basemap layer service
        });
        
const polygonAsPointRenderer = {
    type: "simple",
    symbol: { type: "simple-marker", color: [247, 53, 53, 1] }
}

const view = new MapView({
    map: map,
    center: [9, 62], // Longitude, latitude
    zoom: 5, // Zoom level
    container: "viewDiv" // Div element
        });
        
const featureLayer = new FeatureLayer({
  url: "my feature layer",
  renderer: polygonAsPointRenderer
      });
        map.add(featureLayer);

});

At a small scale, it looks like this:

Small scale point

But I want it to map _all_points, like it does when I zoom in to large scale:

large scale

Do I have to add something to the renderer?

5
  • 1
    try to change your zoom paramater in your viewer ? but if you are really high scale it will render all points .. they are just superposed. Commented Sep 23, 2021 at 10:22
  • I have points all over Norway, so it should'nt be superimposed for the whole country. Commented Sep 23, 2021 at 11:15
  • How many points are there? Could it be that only the first 1000 are retrieved from the service, and that those are all in the same area?
    – Berend
    Commented Sep 23, 2021 at 12:03
  • 1
    maybe look at how polygonAsPointRenderer work. It could be that it generalize your polygons into 1 polygon then render the centroid of this. What does the basic output look at large scale zoom without the renderer ? Commented Sep 23, 2021 at 12:16
  • Yeah, it does not render all the polygons when I turn off the renderer. The problem is apparently due to that. Thank you. Commented Sep 23, 2021 at 13:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.