Created
August 15, 2013 13:02
-
-
Save planetexpress69/6240651 to your computer and use it in GitHub Desktop.
Get all seamarks of Rostock from Open Sea Map (OSM) using the Overpass-API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL: http://overpass-api.de/query_form.html | |
Query: (node(54.085, 11.867, 54.2503, 12.320);<;);out; | |
This returns a file roughly 45 MB in size. | |
Extract the seamarks stuff by using PHP: | |
<?php | |
echo '<?xml version="1.0" encoding="UTF-8"?> | |
<osm version="0.6" generator="Overpass API"> | |
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note> | |
<meta osm_base="2013-08-15T07:48:02Z"/> | |
'; | |
preg_match_all ('#\s+<node[^<]+/>|\s+<node.+?</node>#si', file_get_contents ('full.xml'), $aHits); | |
foreach ($aHits[0] as $sHit) if (preg_match ('#seamark#si', $sHit, $aHit)) echo $sHit; | |
echo '</osm>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment