Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Layer can't be added, issue at createNewLayer() with geojson.geometry == null #1060

Closed
ahalota opened this issue Mar 7, 2018 · 3 comments · Fixed by #1079
Closed

Comments

@ahalota
Copy link

ahalota commented Mar 7, 2018

L.esri.featureLayer({url: 'http://services.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer/0'}).addTo(map);

Runs into issues in FeatureLayer.js at line 37:

  createNewLayer: function (geojson) {
    var layer = GeoJSON.geometryToLayer(geojson, this.options);
    layer.defaultOptions = layer.options;
    return layer; },

layer is null, i.e. GeoJSON.geometryToLayer failed.
geojson.geometry shows as null.

@ahalota ahalota changed the title Feature Layer can't be added, issue at createNewLayer() -> geometryToLayer Feature Layer can't be added, issue at createNewLayer() with geojson.geometry == null Mar 7, 2018
@jgravois
Copy link
Contributor

jgravois commented Mar 7, 2018

that specific feature service is a very rare example of one that has stripped itself of a query operation altogether to deny folks the ability to fetch actual JSON features.

i'm not sure if this is a requirement of vendors/providers supplying content to Esri hosted services or a means to restrict server load. either way, we could trap for it in this library.

@ahalota
Copy link
Author

ahalota commented Mar 7, 2018

Ah! A few more tests on my actual dataset show this. I am working with a published services for a raster mosaic gdb, which has layers for imagery, footprint, and boundary.

The boundary layer:
https://maps.nccs.nasa.gov/server/rest/services/gliht/201703_PuertoRico_test/MapServer/16
can be added.

However, the footprint layer has the same error as above:
https://maps.nccs.nasa.gov/server/rest/services/gliht/201703_PuertoRico_test/MapServer/17

Fortunately I needed the boundary layer after all so I'm all set, but something to keep in mind.

@jgravois
Copy link
Contributor

jgravois commented Mar 8, 2018

its deceiving that the footprint layer advertises itself as esriGeometryPolygon because the features don't actually have any geometry

https://maps.nccs.nasa.gov/server/rest/services/gliht/201703_PuertoRico_test/MapServer/17/query?where=1=1&returnGeometry=true&f=json

"features": [
    {
      "attributes": {
        "Name": "20170301_PRday1b-108-70"
      }
    },
    {
      "attributes": {
        "Name": "20170301_PRday1b-122-30"
      }
    },
    {
      "attributes": {
        "Name": "20170301_PRday1b-92-68"
      }
    }

either way, it'd be good for us to trap for edge cases like this within Esri Leaflet instead of forcing developers to hunt down the cause themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants