1

I have a hard time adding a simple feature layer from my ArcGIS Online account to a Leaflet project. This is my approach:

<script src="https://unpkg.com/esri-leaflet/dist/esri-leaflet.js"></script>

  var esri = L.esri.featureLayer({
           url: "https://services3.arcgis.com/G1WwgjpwOa4JbyeG/arcgis/rest/services/Datensatz/FeatureServer",
           style: function () {
             return { color: "#70ca49", weight: 2 };
           }
         }).addTo(map);

So nothing too complicated here, but it just wont't load the layer. When I inspect the Code in my browser it says:

"Failed to load resource: the server responded with a status of 400 ()".

I uploaded the leaflet project on a webserver if you want to check it: www.wasserwiki.eu/Wasserwiki_App_Mobile

2

1 Answer 1

0

Please add /0 to the end of the URL, like:

var esri = L.esri.featureLayer({
 url: "https://services3.arcgis.com/G1WwgjpwOa4JbyeG/arcgis/rest/services/Datensatz/FeatureServer/0",
 style: function () {
   return { color: "#70ca49", weight: 2 };
 }
}).addTo(map);

Your Answer

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

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