{"id":444,"date":"2015-11-03T13:45:53","date_gmt":"2015-11-03T19:45:53","guid":{"rendered":"http:\/\/thenoyes.com\/littlenoise\/?p=444"},"modified":"2023-06-13T13:46:33","modified_gmt":"2023-06-13T18:46:33","slug":"im-really-quite-good-with-maps","status":"publish","type":"post","link":"https:\/\/thenoyes.com\/littlenoise\/?p=444","title":{"rendered":"I&#8217;m really quite good with maps"},"content":{"rendered":"<p>Workbench <a href=\"http:\/\/mysqlworkbench.org\/2014\/09\/mysql-workbench-6-2-spatial-data\/\">announced support<\/a> for a spatial view in 6.2, but examples are somewhat lacking. Just how do you get a SHP into MySQL?<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-445\" src=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap.png?resize=300%2C239&#038;ssl=1\" alt=\"worldmap\" width=\"300\" height=\"239\" srcset=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap.png?resize=300%2C239&amp;ssl=1 300w, https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap.png?w=919&amp;ssl=1 919w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Download and unpack a SHP file such as these <a href=\"https:\/\/hub.arcgis.com\/datasets\/esri::world-countries-generalized\">country boundaries<\/a>.<\/p>\n<p>In the Workbench installation directory, you&#8217;ll find a program &#8220;ogr2ogr&#8221; that can convert .shp or GeoJSON and load it straight into MySQL.<\/p>\n<p>&#8220;C:\\Program Files\\MySQL\\MySQL Workbench 8.0\\ogr2ogr.exe&#8221; <span id=\"form1:panelPage1\">-f MySQL MySQL:databaseNameHere,user=userNameHere,password=passwordHere World_Countries_Generalized.shp -nln worldmap -lco GEOMETRY_NAME=p<\/p>\n<p>(It might give the error <em>ERROR 1: PROJ: proj_identify: Cannot find proj.db<\/em> which it seems can be ignored.)<br \/>\n<\/span><\/p>\n<p>Now just select rows of interest in Workbench, click the Spatial View format button, and there&#8217;s your world map.<\/p>\n<p>You can run multiple selects (such as the citylot data from yesterday&#8217;s post) to overlay on top of the world map.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap_overlay.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-449\" src=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap_overlay.png?resize=300%2C185&#038;ssl=1\" alt=\"worldmap_overlay\" width=\"300\" height=\"185\" srcset=\"https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap_overlay.png?resize=300%2C185&amp;ssl=1 300w, https:\/\/i0.wp.com\/thenoyes.com\/littlenoise\/wp-content\/uploads\/2015\/11\/worldmap_overlay.png?w=915&amp;ssl=1 915w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Workbench announced support for a spatial view in 6.2, but examples are somewhat lacking. Just how do you get a SHP into MySQL? Download and unpack a SHP file such as these country boundaries. In the Workbench installation directory, you&#8217;ll find a program &#8220;ogr2ogr&#8221; that can convert .shp or GeoJSON and load it straight into [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[4],"tags":[],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2IBF1-7a","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=444"}],"version-history":[{"count":7,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/444\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}