Esri / esri-leaflet-vector

Display ArcGIS Online vector basemaps w/ Esri Leaflet
52 stars 53 forks source link

Add support for a proxy #190

Closed pdiddyb closed 12 months ago

pdiddyb commented 1 year ago

Describe the problem

I do not see a parameter to add a proxy to proxy when adding a L.esri.Vector.vectorTileLayer. I can add the proxy to the portalUrl, but after the initial calls it will start making requests for tiles to the server address from the service.

Describe the proposed solution

If we had a proxy parameter then we would be set that. Currently I am trying this by prepending the proxy to the portalUrl:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: proxyUrl + '?' + portalURL,
      });

If we had a proxy parameter then it would look like this:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: portalURL,
        proxy: proxyUrl,
      });

Alternatives considered

No response

Additional Information

No response

gavinr-maps commented 1 year ago

@pdiddyb thank you for the report. Could you please update the request with a replication case?

pdiddyb commented 1 year ago

@gavinr-maps We went ahead and added a proxy property. I made PR 193

patrickarlt commented 12 months ago

@pdiddyb I would recommend using the style option io transform the style after it retrieved from teh portal:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: proxyUrl + '?' + portalURL,
        style: (portalStyle) => {
          // modify URLs in the portal style to point to your proxy.
          return portalStyle
        }
      });

Testing and implementation of a proxy parameter opens up quite a bit of maintenance surface area. Additionally documenting exactly what and which proxy to use and what the proxy supports will be difficult and add additional surface area and support to the API.