how to use arcgis-leaflet with meteor js?

1071
3
10-24-2016 07:54 AM
Labels (1)
meriammme
New Contributor

I'm making a simple app to show leaflet map with meteor.But it doesn't work.This is my code : Html:

<div id="viewDiv">    Explore D3 </div> </template>
javascript&colon;
onRendered(){  L = require('esri-leaflet')     var map = L.map('viewDiv').setView([45.528, -122.680], 13);     L.esri.basemapLayer("Gray").addTo(map);      var parks = L.esri.featureLayer({         url: "http://gis.d3smartcity.ae/arcgis/rest/services/Operation_layers/d3_Masterplan/MapServer?f=jsapi",         style: function () {             return { color: "#70ca49", weight: 2 };         }     }).addTo(map);      var popupTemplate = "<h3>{NAME}</h3>{ACRES} Acres<br><small>Property ID: {PROPERTYID}<small>";      parks.bindPopup(function (e) {         return L.Util.template(popupTemplate, e.feature.properties)     }); }
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Dadi,

   One major issue is the url you are using for the featureLayer:

var parks = L.esri.featureLayer({
        url: "http://gis.d3smartcity.ae/arcgis/rest/services/Operation_layers/d3_Masterplan/MapServer?f=jsapi",
        style: function () {
            return { color: "#70ca49", weight: 2 };
        }
    }).addTo(map);‍‍‍‍‍‍

it should be (no ?f=jsapi):

    var parks = L.esri.featureLayer({
        url: "http://gis.d3smartcity.ae/arcgis/rest/services/Operation_layers/d3_Masterplan/MapServer",
        style: function () {
            return { color: "#70ca49", weight: 2 };
        }
    }).addTo(map);
meriammme
New Contributor

thanks, but I still having this type of error :

Ps : I'm using the npm package "esri-leaflet"

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Dadi,

   This is a bit out of my comfort zone, as I don't work with Meteor or NPM leaflet package.

I am going to tag the Leaflet group maybe someone there can help.

https://community.esri.com/groups/esri-leaflet?sr=search&searchId=c21df669-81e0-469d-a237-097962db58...