Select to view content in your preferred language

How to make client-side feature layer draw across the IDL?

382
1
02-09-2023 04:06 PM
platmoskito
New Contributor II

When a polygon is drawn on a server-side feature layer across the IDL I'm able to successfully cross the IDL (and not go the long way around the globe), by adding 360 degrees to my negative longitudes. I would like to know what the Feature Server is doing on the backend to make it possible for the geometry to plot on either side of the IDL. I tried drawing a polygon across the IDL with a client-side feature layer, but could only get it to show on one side of the IDL. 

I tried cutting the geometry along the IDL before calling client-side featureLayer's `applyEdits` (code below) but it's still not working. I think the feature server is doing something else to the shape on the backend to make it draw correctly. What am I doing wrong or not doing to get client-side feature layer to behave like server-side feature layer across the IDL?

    const IDLSplitter = new Polyline({
      paths: [
        [
          [180, -90],
          [180, 90]
        ]
      ],
      spatialReference: polygon.spatialReference
    });
    const cutGeometry = geometryEngine.cut(polygon, IDLSplitter);
0 Kudos
1 Reply
SamEngel
New Contributor II

Hey @platmoskito! Depending on the spatial reference you're working in, maybe the normalize utils could help? https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-normalizeUtils.h...