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