{"id":344,"date":"2018-08-30T15:47:30","date_gmt":"2018-08-30T20:47:30","guid":{"rendered":"https:\/\/cdrhdev.unl.edu\/log\/?p=344"},"modified":"2018-08-30T15:47:30","modified_gmt":"2018-08-30T20:47:30","slug":"exporting-vector-data-from-arcmap-to-geojson","status":"publish","type":"post","link":"https:\/\/cdrhdev.unl.edu\/log\/2018\/exporting-vector-data-from-arcmap-to-geojson\/","title":{"rendered":"Exporting Vector Data from ArcMap to GeoJSON"},"content":{"rendered":"<h2>The Quest to Remake Maps<\/h2>\n<p>We have had a looming problem on our hands for a while at the center:\u00a0 what we should do about our aging map projects living on a dying server.\u00a0 We have many projects that rely heavily on maps, from <a href=\"http:\/\/cubanbattlefields.unl.edu\">Cuban Battlefields<\/a>\u00a0to <a href=\"http:\/\/civilwardc.org\">Civil War Washington<\/a>, all previously living their lives on an 8 year old server whose ESRI license ($$$) is set to expire at the end of the summer.\u00a0 Furthermore, many of the maps were only viewable in Flash, <a href=\"https:\/\/theblog.adobe.com\/adobe-flash-update\/\">a technology whose days are numbered<\/a>.\u00a0 With this in mind, it was time to recreate maps with a new technology.<\/p>\n<p>So okay, no big deal, right?\u00a0 Just take the old map files and put them in some new technology?\u00a0 The problem was, we no longer have a GIS specialist in the CDRH.\u00a0 The next problem was that most of the files can&#8217;t be picked up straight out of the ESRI server and put into something else.\u00a0 What were we to do?<\/p>\n<p>Thanks to excellent notes left by Rob Shepard and Nicholas Gliserman, our previous CDRH GIS experts, I had a pretty good starting foundation for the next steps.\u00a0 Despite my trepidation, after only a few hours I was happily exporting all sorts of data from existing projects to use in open source alternatives to ESRI.<\/p>\n<p>Specifically, for this demo, I walk through how to take vector data from a geodatabase (.gdb) file and turn it into GeoJSON.\u00a0 I used <a href=\"https:\/\/desktop.arcgis.com\/en\/arcmap\/\">ArcMap<\/a>, one of the tools in ESRI ArcGIS Desktop.\u00a0 Unfortunately, ArcMap is not open source, but you should be able to apply the below concepts to opensource software like <a href=\"https:\/\/www.qgis.org\/en\/site\/\">QGIS<\/a> or <a href=\"https:\/\/grass.osgeo.org\/\">GRASS<\/a> instead.\u00a0 I know that I&#8217;ll be looking into that in the near future, so keep your eye out for an updated demo in the next year, assuming I&#8217;m successful!<\/p>\n<h2>Viewing the Files in ArcMap<\/h2>\n<p>When you open ArcMap, select the new map default recommendation from the prompt, then right click on Layers and &#8220;Add Data&#8221;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-345 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data.png\" alt=\"add data dialogue selected\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/1_add_data-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>You may need to add a data source (directory) so that you can find the gdb in question, but once you&#8217;ve navigated to the directory with your gdb or other map related files, ArcMap should be able to pick apart the components.\u00a0 That is to say, if a gdb contains many layers, you will be able to import them into your map one at a time or in bulk.\u00a0 Below, we are adding only one layer:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-346 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files.png\" alt=\"add data custerfive.shp shapefile selected\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/2_find_files-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>Once you have added the layer, it should show up in the window on the right of ArcMap.\u00a0 You can right click on the layer to see all the layer-specific options and information.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-347 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do.png\" alt=\"arcmap right click layer options\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/3_things_to_do-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>It&#8217;s easy enough to import a bunch of layers at once, as well.\u00a0 You can also turn off and on multiple layers at once when they&#8217;ve been imported.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-348 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add.png\" alt=\"arcmap add data bulk select\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/4_bulk_add-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-349 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off.png\" alt=\"arcmap &quot;turn all layers off&quot;\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/5_all_layers_off-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>You can inspect layers to see what kind of attributes they have been assigned.\u00a0 For example, a polygon might carry metadata with a county name, country location, and more.\u00a0 Right click the layer then &#8220;Open Attribute Table.&#8221;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-350 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes.png\" alt=\"arcmap attributes of layer like state, county, name, etc\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/06\/6_attributes-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<h2>Exporting GeoJSON<\/h2>\n<p>Okay, great, you&#8217;ve got some files loaded up and showing in a map!\u00a0 Now let&#8217;s focus on how to export the vector layers.\u00a0 Vector layers are things like points, lines, polygons&#8230;basically anything that&#8217;s not a large image \/ historic map \/ tiff.\u00a0 Those types of images are raster layers.<\/p>\n<p>But let&#8217;s say you&#8217;ve got some data on county land sales from 1870 to 1880.\u00a0 That&#8217;s gonna be a vector layer so export it in JSON.\u00a0 Assuming that your layer is already loaded up, let&#8217;s look at the properties.\u00a0 Right click the layer and select &#8220;Properties&#8230;&#8221;<\/p>\n<p>On the &#8220;Source&#8221; tab of the properties, you can see the boundaries that the layer fits into as well as the coordinate system and angular units.\u00a0 Ideally, your layer will look something like the below:\u00a0 recognizable latitude \/ longitude, WGS_1984, and degrees for the angular units.\u00a0 If that&#8217;s the case, skip a few steps ahead to exporting the GeoJSON.\u00a0 But if your extent is made of huge numbers, the angular units are &#8220;meters&#8221; and your coordinate system doesn&#8217;t match this, then it&#8217;s time to put the layer into a new projection!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-358 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection.png\" alt=\"arcmap view of layer properties source tab\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/1_check_projection-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>Let&#8217;s go ahead and assume that you need to change the projection to something exportable into GeoJSON.\u00a0 Fish around in the menu bar until you find the Arc Toolbox (showing on the left of the image below).\u00a0 Under Projections and Transformations, click Project.\u00a0 Select your layer, select an output dataset (it probably doesn&#8217;t matter if you&#8217;re never using this layer again), then search for an Output Coordinate System.\u00a0 I added WGS_1984 to my favorites in order to find it quickly, but otherwise if you type in &#8220;4235&#8221; into the search, you should find it among the results.\u00a0 GCS_WGS_1984 and degrees is what you&#8217;re looking for.\u00a0 Note:\u00a0 you can also set up a batch projection if you have a lot of layers you need to convert all at once.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-359 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection.png\" alt=\"arcmap selecting coordinate system WGS 1984\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/2_change_projection-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>Hit okay and ArcMap will add your projected layer into the viewer.\u00a0 Notice below that now I have the original dawesfive and the new dawesfive_Project.\u00a0 In the ArcToolbox, hit Conversion Tools &gt; JSON &gt; Features to JSON.\u00a0 Select your newly projected layer, choose an output location you&#8217;ll remember, and check the &#8220;GeoJSON&#8221; box.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-360 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson.png\" alt=\"arcmap selecting geoJSON checkbox on Feature to JSON conversion tool\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/3_export_geojson-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>Now you will have a GeoJSON (.json) file at the location you selected.\u00a0 If you open it in a text editor, you will find a somewhat human readable file with all the information about the attributes as well as geographic instructions for drawing points, lines, and polygons.\u00a0 There are several websites that allow you to test GeoJSON, but I like to use <a href=\"http:\/\/geojson.io\">geojson.io<\/a> from <a href=\"https:\/\/github.com\/mapbox\/geojson.io\">Mapbox<\/a>.\u00a0 If you open your GeoJSON file, you should see a version of your layer displayed and you can inspect the attributes, like below.\u00a0 Congratulations, you&#8217;ve successfully gotten GeoJSON out of a gdb file!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-361 size-full\" src=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson.png\" alt=\"viewing exported geojson in geojson.io website\" width=\"1600\" height=\"900\" srcset=\"https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson.png 1600w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson-300x169.png 300w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson-768x432.png 768w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson-1024x576.png 1024w, https:\/\/cdrhdev.unl.edu\/log\/wp-content\/uploads\/2018\/07\/4_check_geojson-1280x720.png 1280w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>So what&#8217;s next?\u00a0 Well, in our case, CDRH developers <a href=\"https:\/\/leafletjs.com\/examples\/geojson\/\">import it into Leaflet.js<\/a>.\u00a0 However, it&#8217;s also nice just to keep the GeoJSON files in the same place as the original shapefiles, etc, for archival purposes.\u00a0 Having a version of the data that a text editor can open is very valuable for a place like ours where we don&#8217;t always have a GIS expert on hand to work with files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Quest to Remake Maps We have had a looming problem on our hands for a while at the center:\u00a0 what we should do about our aging map projects living on a dying server.\u00a0 We have many projects that rely heavily on maps, from Cuban Battlefields\u00a0to Civil War Washington, all previously living their lives on&hellip;<\/p>\n <a href=\"https:\/\/cdrhdev.unl.edu\/log\/2018\/exporting-vector-data-from-arcmap-to-geojson\/\" title=\"Exporting Vector Data from ArcMap to GeoJSON\" class=\"entry-more-link\"><span>Read More<\/span> <span class=\"screen-reader-text\">Exporting Vector Data from ArcMap to GeoJSON<\/span><\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[10,46],"tags":[47,48,49,50],"class_list":["entry","author-jdussault","post-344","post","type-post","status-publish","format-standard","category-introduction","category-mapping","tag-arcmap","tag-geojson","tag-geoserver","tag-leaflet"],"_links":{"self":[{"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":16,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":379,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/posts\/344\/revisions\/379"}],"wp:attachment":[{"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cdrhdev.unl.edu\/log\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}