Comments (3)
RFC 7946 does state WGS 84 should be used and removes the CRS member of the 2008 standard, but it does include the caveat
However, where all involved parties have a prior arrangement, alternative coordinate reference systems can be used without risk of data being misinterpreted.
so a GeoJSON file using a non-WGS84 CRS isn't strictly invalid. Refs
So this behaviour is intentional: We convert the file using the input CRS and emit a warning if its not 4326. It is out of scope for a simple format conversion tool to attempt to transpose between co-ordinate reference systems.
If you're looking for a way to emit ArcGIS JSON which isn't stored natively using WGS 84, your ArcGIS server can probably do it for you. If you're outputting from ArcGIS REST server, have a look at the outSR
param. For example if I request:
this outputs ArcGIS JSON using the server's default srid 27700, but if I append &outSR=4326
it will convert it to 4326 🎉
from arcgis2geojson.
Ah. Didn't see that exemption in the spec. Guess that's why ESRI's FeatureSet.to_GeoJSON preserves WKID 102100 and doesn't convert to WGS 84/4326. All I have access to is "item = gis.content.get(id)" (which returns "OperationalLayers"). I think a layer needs to be "published" for GeoJSON, etc. export options to appear. I didn't seem to see a way to do a REST query using an item id along with outSR.
I finally got a working Python script that converts the data to valid GeoJSON, also using json, pyproj, shapely, etc. libraries. Basically:
# EPSG:3857
# WGS 84 / Pseudo-Mercator -- Spherical Mercator, Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI
# Alternatives codes : 900913 3587 54004 41001 102113 102100 3785
esriwgs = pyproj.CRS('EPSG:3857')
wgs84 = pyproj.CRS('EPSG:4326')
project = pyproj.Transformer.from_crs(esriwgs, wgs84, always_xy=True).transform
gis = GIS()
item = gis.content.get(id)
wm = WebMap(item)
for layer in wm.layers:
fc = FeatureCollection(layer.featureCollection)
fs = fc.query() # Only way to get a functional FeatureSet? This query apparently accepts no options.
# print "type": "FeatureCollection", "features": [", etc.
for feature in fs:
# print "type": "Feature"...
print('"properties": ' + json.dumps(feature.attributes))
geom = arcgis.geometry.Geometry(feature.geometry)
newgeom = transform(project, geom.as_shapely)
print(', "geometry": ', geojson.dumps(newgeom))
I tried ArcGIS's "fc.query(out_sr=4326)" and "geom.project_as('EPSG:4326')" variations, but didn't seem to work. Anyway, I couldn't find any existing script or program out there that does this. Maybe I or somebody else could release one. :)
from arcgis2geojson.
Glad you managed to find a solution 👍
from arcgis2geojson.
Related Issues (11)
- match behaviour of upstream repo for invalid input geometry
- [doc] RFC 7946 GeoJSON HOT 6
- Performance: Very large arcgis ring geometry (complex, many points) HOT 6
- ArcGIS Pro JSON to GeoJSON HOT 3
- link to this project from Esri/arcgis-to-geojson-utils README? HOT 2
- CLI tool HOT 1
- CLI fails to convert this file - is that expected behaviour? HOT 4
- Dependabot can't resolve your Python dependency files
- Missing support for curveRings HOT 3
- Convert projected coordinates to lat/lng HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arcgis2geojson.