tannerjt / AGStoShapefile

Convert ArcGIS Server Dynamic Map Service to GeoJSON and Shapefile
MIT License
213 stars 47 forks source link

TypeError: Cannot read property 'attributes' of undefined #37

Open flibbertigibbet opened 7 years ago

flibbertigibbet commented 7 years ago

Appears to specifically be an issue with esri2geo, but reporting here as unsure of exact cause.

info: all requests settled
info: creating Coastal.Coastline_line json
info: Creating Esri JSON
info: Creating GeoJSON
info:  TypeError: Cannot read property 'attributes' of undefined
    at toGeoJSON (/projects/AGStoShapefile/node_modules/esri2geo/esri2geo.js:18:24)
    at /projects/AGStoShapefile/AGStoSHP.js:140:3
    at _fulfilled (/projects/AGStoShapefile/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/projects/AGStoShapefile/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/projects/AGStoShapefile/node_modules/q/q.js:816:13)
    at /projects/AGStoShapefile/node_modules/q/q.js:624:44
    at runSingle (/projects/AGStoShapefile/node_modules/q/q.js:137:13)
    at flush (/projects/AGStoShapefile/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Was able to finish the job successfully after editing node_modules/esri2geo/esri2geo.js to skip processing in the toGeoJSON loop where the feature from the array was falsy.

services.txt:

https://encdirect.noaa.gov/arcgis/rest/services/encdirect/enc_coastal/MapServer/70|Coastal.Coastline_line
tannerjt commented 7 years ago

Thanks for documenting the error. I'm not sure what exactly is going wrong, but you're right that it's trying to access an attribute on a feature that is either null or undefined. When you look at your final feature count after the change to esri2geo, do you still get the total 31,849?

flibbertigibbet commented 6 years ago

According to ogrinfo, the final feature count came out at 30,439.

flibbertigibbet commented 6 years ago

Managed to get a download with the full feature count using the python tool esridump.