Conversation
|
|
||
| geojson_geometry = convert_esri_geometry(esrijson_feature.get('geometry')) | ||
| if geojson_geometry: | ||
| if srid != 'epsg:4326': |
There was a problem hiding this comment.
Hmm, I think it might be out of the scope of this tool to reproject. Usually we ask the server to give us the data back reprojected (with the outSRS parameter). Are you seeing servers that don't do that?
There was a problem hiding this comment.
@iandees Yeah the query API is the only endpoint that allows for ourSRS to be set. I played around with it a ton before I finally settled on having to do this. Not converting results in us outputting invalid GeoJSON per spec.
| import pyproj | ||
|
|
||
| def esri2geojson(esrijson_feature): | ||
| def esri2geojson(esrijson_feature, srid = 'epsg:4326'): |
There was a problem hiding this comment.
Python style is usually no whitespace around ='s for arg defaults.
| def esri2geojson(esrijson_feature, srid = 'epsg:4326'): | |
| def esri2geojson(esrijson_feature, srid='epsg:4326'): |
| for feature in features: | ||
| yield feature | ||
|
|
||
| def _esri2geojson(self, feature): |
There was a problem hiding this comment.
It's weird to have a wrapper function that is named the same as the function it's calling. Would it make sense to call this reproject_and_convert() or something instead?
|
|
||
| def assertEsriJsonBecomesGeoJson(self, esrijson, geojson): | ||
| out_json = esri2geojson(esrijson) | ||
| def assertEsriJsonBecomesGeoJson(self, esrijson, geojson, srid = 'epsg:4326'): |
There was a problem hiding this comment.
| def assertEsriJsonBecomesGeoJson(self, esrijson, geojson, srid = 'epsg:4326'): | |
| def assertEsriJsonBecomesGeoJson(self, esrijson, geojson, srid='epsg:4326'): |
Context
If geometries are desired in the EsriDump API, check for presence of geometry before calling ESRI2Geojson. If no geometry is present, attempt downloading each feature individually
Closes: #72