0

I have an old esri-leaflet map that queries and displays a feature from a published feature service. I'm migrating the dashboard that uses this map to a new server that requires https. I keep getting this error, and I have no idea what's wrong.

Uncaught TypeError

Old code (works great):

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="json2.js"></script>
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri- leaflet.js"></script>
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet-renderers/0.0.1-beta.3/esri-leaflet-renderers.js"></script>

New code:

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js"></script>
<script src="https://unpkg.com/esri-leaflet@3"></script>
<script src="https://unpkg.com/esri-leaflet-renderers@3"></script>

This is where it fails, trying to query the feature layer:

q="OBJECTID="+params.objectid;
n=params.name;

project = L.esri.featureLayer(
  'https://dmdmaps.cabq.gov/serverext/rest/services/Public/Active_CABQ_Construction_Projects/FeatureServer/1',
  { where:q }
).addTo(map);   

Any ideas on how to fix this?

1 Answer 1

1

the API signature to instantiate a featureLayer changed at version 1.x of esri leaflet.

L.esri.featureLayer({ url, where })

https://github.com//Esri/esri-leaflet/wiki/FAQ#upgrading-the-version-of-esri-leaflet-used-in-my-app-broke-everything

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.