2

Learning Leaflet. Had success with point data. Now want to create polygons.

The process starts with an Access record with a Parcel Identification Number. Using ArcMap desktop, the records are joined to a parcel shape file for the county.

What the best approach to get to Leaflet polygons from here? Like with point data, do I need to add fields to contain the lat/lon data?

I don't need a lot of detail; just a pointer in the right direction. I don't mind doing homework.

TomC
  • 33
  • 7
  • you might convert the shapefile to geojson and load it that way... – sfletche Jun 13 '15 at 04:39
  • Learned that ArcMap Desktop has a tool to convert features to JSON. I'm getting an error that the tool can't convert polygons with true curves. The shapes are parcels and I'm assuming that at least one includes true curves. ESRI apparently has a work around that's focused on ESRI Online. Need to figure out how to use it for work not including Online. – TomC Jun 14 '15 at 16:11

1 Answers1

0

My approach would be to convert the shapefile to geojson and then load the geojson into your Leaflet map.

I'm aware of some ArcGIS plugins to export geojson, but an alternative approach is to use the command line tool GDAL (ogr2ogr).

See the links on this answer for more details, but the command will end up being something like the following...

ogr2ogr -f GeoJSON -t_srs "EPSG:4326" [name][.geojson|.json] [name].shp

From there you can preview the results in geojson.io or github before creating your Leaflet map.

sfletche
  • 47,248
  • 30
  • 103
  • 119
  • Thanks. Have been studying GeoJSON layouts. The problem I ran into using ArcMap Desktop tool Feature-to-JSON is that it won't process "true curves". These are lines with only 2 points describing a curve vs. lots of little straight line points. – TomC Jun 16 '15 at 14:41
  • In reading about GeoJSON, I don't see how it would support a true curve shape either (i.e. it expects straight lines between vertices). Is that right? If so, the resolution is to somehow convert the true curves to lots of points. – TomC Jun 16 '15 at 14:43
  • @TomC - My bad...I was assuming you were starting with a shapefile...(my understanding is that shapefiles do not support 'true curves' either)...I think the first step would be to convert your Access records to shapefile features, and then convert your shapefile to geojson. – sfletche Jun 16 '15 at 16:12
  • Thanks. Not to worry; I was the one that used the term "shape file" in my original post. Your response might explain the method shown on the ESRI site for resolving the problem for ESRI Online published services (it can't deal with true curves either). Their method was to convert the service to a shapefile and install it again. I'll try the approach you suggested. – TomC Jun 17 '15 at 23:53
  • You were right. Converting a GDB feature that contains true curves to a shape file seems to eliminate any true curves, and thus the problem with converting it to a GeoJSON file. I have to give some thought to why ESRI would head this way, and when the true curves are created. I think the original digitizing did not use true curve so maybe ESRI is creating them when they are added to a GDB. Regardless, thank you very much. – TomC Jun 18 '15 at 14:48
  • May have to go back to your original post (use GDAL). It turns out ESRI feature to JSON tool does not output valid GeoJSON. – TomC Jun 19 '15 at 15:55
  • I forgot about that. Yeah, ESRI uses their own (non-compliant) spec for GeoJSON. There are [strategies](http://gis.stackexchange.com/questions/13029/how-to-convert-arcgis-server-json-to-geojson) for converting from ESRI JSON to GeoJSON. (Or you can just use the GDAL command line tool in the first place...) – sfletche Jun 19 '15 at 18:11