0

I am working with Leaflet 0.7.3 and esri-leaflet beta.6. Using L.esri.Layers.FeatureLayer works fine until I add the fields filter. At that point, the geojson objects draw sporadically (mostly not at all). I might see one or two shapes on the screen.

Example code at http://codepen.io/BBurnworth/pen/fhBrG/

Lines 32-36:

 //The line below works.
 var parcels = new L.esri.Layers.FeatureLayer(url + '24');

 // **The below line works (Checked JSON attributes in firebug) but the parcels flicker and don't display properly**
 // var parcels = new L.esri.Layers.FeatureLayer(url + '24', { fields: "CITY" });

Is this a bug or am I leaving something out? The JSON (in Firebug) reads correctly, with the geometry data coming in. It just doesn't draw correctly.

I would love for someone to point out something simple that I am missing. I would rather fetch just the bare minimum of data and then use the tasks.IdentifyFeatures to get the attribute data when the user wants it.

2

a couple things here...

  1. that constructor option expects an array
  2. at a minimum, you have to include the OBJECTID field in that array in order for everything to work on the clientside as it should.

    { fields: ["OBJECTID", "CITY"] }

we should probably be handling that for people. i'll look into it.

http://codepen.io/anon/pen/pjEtD

  • TY. John, I have another issue relating to the tasks.identifyFeatures not accepting [34.98,-90] but will accept L.latLng(34.98,-90). Should I post here on SE or is there a more appropriate forum? – Barrett Oct 10 '14 at 21:31
  • my pleasure. here is fine, as is the 'esri-leaflet' space in geonet geonet.esri.com/thread/113120 – John Gravois Oct 11 '14 at 6:47
  • 1
    i added a warning for developers when no known ObjectId field can be found which should be included in beta7 github.com/Esri/esri-leaflet/issues/366 – John Gravois Oct 14 '14 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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