Convert ESRI to GeoJSON
so you have some data in SDE
and want to use it on the internet
_let's just use ArcGIS online..._
said nobody
you want to use it in
_TileMill_
or
leaflet
And you like having fieldnames longer then 8 charicters
I'll just convert to geojson, it's similar right?
_no_
ESRI has 4 geometry types
point
multipoint
polyline
polygon
GeoJSON has those
but calls them Point, MultiPoint, LineString, and Polygon
GeoJSON also has
MultiLineString, MultiPolygon, and GeometryCollection
ESRI a geometry type for the feature class and all features to have that or null
GeoJSON requires it to be anything except null
So I wrote an arcpy script to automate the export
and then got distracted after finishing 95%
But then
Michael Byrnes started his
Now I MUST finish mine
and/or merge our efforts
anywho back to the point
that 5% I had left to solve
_inner rings_
GeoJSON has an array with the first feature being the outer and the rest being the inner rings
ESRI has a bunch of points, some of them are null
you have to check the existence of eveyr point

ESRI requires first and last point of a polygon to be the same
i.e. repeat point
_SO DOES GEOJSON FTW!!!1_
ESRI allows polygones with a total of less then 4 points
NO SANE FRAMEWORK DOES THIS!
it also allows lines with only one point
which means you have polygons that could be lines or points
and lines that could be points
and while were at it, ESRI allows multi points with only one point
and makes no distinction between multi and regular for line and poly
but some parts of a single multipoly could be a line
and some a point
and some a poly
_solution_
waterfall model
parsePolygone either returns geo or calls parseLinestring
etc with line->point
fallback to next type
and if a multi and mixed
_GeometryCollection FTW_
of course going backwards
_Have Fun_
_fin_
[github.com/calvinmetcalf/esri2open](https://github.com/calvinmetcalf/esri2open)
[github.com/feomike/esri2open](https://github.com/feomike/esri2open)
[calvinmetcalf.github.io/esri2open](http://calvinmetcalf.github.io/esri2open)
[@cwmma](https://twitter.com/CWMma)