{"id":6758,"date":"2023-12-22T14:58:26","date_gmt":"2023-12-22T14:58:26","guid":{"rendered":"https:\/\/www.garysieling.com\/blog\/?p=6758"},"modified":"2023-12-22T15:06:36","modified_gmt":"2023-12-22T15:06:36","slug":"importing-shapefiles-geojson-etc-to-google-maps","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/importing-shapefiles-geojson-etc-to-google-maps\/","title":{"rendered":"Importing Shapefiles (geojson etc) to Google Maps"},"content":{"rendered":"\n<p>If you want to import a shapefile to Google maps, the file format options are somewhat limited &#8211; you need to use Google&#8217;s KML format (i.e. what Google Earth uses). A lot of public datasets are available as geojson, which is a friendlier format to work with.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1002\" height=\"628\" src=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-5.png\" alt=\"\" class=\"wp-image-6759\" srcset=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-5.png 1002w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-5-300x188.png 300w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-5-768x481.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>In addition, Google Maps has a maximum of 5MB, which is a pretty tight restriction. There are a bunch of websites that claim to convert geojson to KML, but do a generally poor job and blow up the file sizes.<\/p>\n\n\n\n<p>The best option is <a href=\"http:\/\/mapshaper.org\" title=\"\">mapshaper.org<\/a>, which uses an R program behind the scenes. It can simultaneously convert and dramatically reduces the file size, by simplifying some of the lines. What I do with this is to zoom in on an area I care about, and then simplify until I start seeing impactful changes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1303\" height=\"326\" src=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-6-1303x326.png\" alt=\"\" class=\"wp-image-6760\" srcset=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-6-1303x326.png 1303w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-6-300x75.png 300w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-6-768x192.png 768w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-6.png 1417w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Once you do that, export to KML:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"331\" src=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-7.png\" alt=\"\" class=\"wp-image-6761\" srcset=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-7.png 298w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2023\/12\/image-7-270x300.png 270w\" sizes=\"(max-width: 298px) 100vw, 298px\" \/><\/figure>\n\n\n\n<p>If the file is under 5mb, it will work in Google maps. Google maps looks for a tile attribute named &#8220;name&#8221; in it&#8217;s UI (<a href=\"https:\/\/developers.google.com\/maps\/documentation\/android-sdk\/utility\/kml\" title=\"\">potentially useful documentation here<\/a>). If everything comes through untitled, you can add this to the starting file, and it will render in a more useful way. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to import a shapefile to Google maps, the file format options are somewhat limited &#8211; you need to use Google&#8217;s KML format (i.e. what Google Earth uses). A lot of public datasets are available as geojson, which is a friendlier format to work with. In addition, Google Maps has a maximum of &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/importing-shapefiles-geojson-etc-to-google-maps\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Importing Shapefiles (geojson etc) to Google Maps&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[152,638,357],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6758"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=6758"}],"version-history":[{"count":2,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6758\/revisions"}],"predecessor-version":[{"id":6764,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6758\/revisions\/6764"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=6758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=6758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=6758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}