└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # overpass-turbo-turorial 2 | 3 | OpenStreetMap has a ton of data...on some things. It's a good place to get "base map" data like roads, rivers or other features. Addresses, businesses and other amenties may not be complete. But you can improve the data to make them complete! 4 | 5 | First, let's take a look at the interface. 6 | 7 | Buttons: 8 | - **Run** fires off the code in the window. Result appears on the map to the right. 9 | - **Share** gives you a link of the current query to..umm...share 10 | - **Export** makes a sandwich. No! It allows you to download the result in GeoJSON, GPX, KML or XML. 11 | - **Wizard** helps your construct queries 12 | - **Save** keeps your query for the future 13 | - **Load** brings up any saved queries 14 | - **Settings** pick a new background, language and spin cycle 15 | - **Help** not as effective as 911 16 | 17 | You can write a query to get anything in OpenStreetMap. The only real limit seems to be size and your ImAgInAtIoN. So, trying to download the nation's freeway system may not be possible. But you could for Los Angeles County. 18 | 19 | A good start is defining what you want in terms of OSM's tags. 20 | 21 | ## Get all drinking fountains in Griffith Park 22 | 23 | For instance, to download all the water fountains in Griffith Park you'll need to use OSM's tag [amenity=drinking_watter](http://wiki.openstreetmap.org/wiki/Tag:amenity%3Ddrinking_water). A quick Google search of search of the OSM Wiki will help you. 24 | 25 | The easiest thing to do is to drop `amenity=drinking_watter` into Overpass turbo's "Wizard" if the map is showing Griffith Park. 26 | 27 | ![drinkingwater](https://cloud.githubusercontent.com/assets/695934/17908091/d1466a30-6933-11e6-995f-db7df8a73eb6.gif) 28 | 29 | [Overpass turbo](http://overpass-turbo.eu/s/hZu) 30 | 31 | ``` 32 | /* 33 | This has been generated by the overpass-turbo wizard. 34 | The original search was: 35 | “amenity=drinking_water” 36 | */ 37 | [out:json][timeout:25]; 38 | // gather results 39 | ( 40 | // query part for: “amenity=drinking_water” 41 | node["amenity"="drinking_water"]({{bbox}}); 42 | way["amenity"="drinking_water"]({{bbox}}); 43 | relation["amenity"="drinking_water"]({{bbox}}); 44 | ); 45 | // print results 46 | out body; 47 | >; 48 | out skel qt; 49 | ``` 50 | ## Get all the freeways 51 | 52 | ![River homeless map](http://latimes-graphics-media.s3.amazonaws.com/assets/img/la-me-g-river-dwellers-04242016.png) 53 | 54 | One common problem is to create a line map of just the freeways for reference (and nothing else). The Census provides a file for primary roads, but it excludes highways like the 101. 55 | 56 | ![screen shot 2016-08-23 at 1 39 55 pm](https://cloud.githubusercontent.com/assets/695934/17908895/1b52e47a-6937-11e6-9457-48e5fdcfc089.png) 57 | Census primary roads 58 | 59 | It takes a combination of secondary and primary roads to get all the "freeways" like the 101 and the 134. 60 | 61 | ![screen shot 2016-08-23 at 1 41 05 pm](https://cloud.githubusercontent.com/assets/695934/17908936/42edfbc8-6937-11e6-8672-c5daf4f646c7.png) 62 | 63 | But the census file also includes roads like Santa Monica Boulevard which we wouldn't want to include. 64 | 65 | The OSM tagging for freeways (and any roads or paths) is to use [highway=](http://wiki.openstreetmap.org/wiki/Key:highway) 66 | 67 | Freeways fit into highway=motorway 68 | 69 | ![screen shot 2016-08-23 at 1 58 47 pm](https://cloud.githubusercontent.com/assets/695934/17909542/bda23fd0-6939-11e6-8b6a-87e446a3baaa.png) 70 | 71 | [Overpass turbo](http://overpass-turbo.eu/s/hZx) 72 | ``` 73 | /* 74 | This has been generated by the overpass-turbo wizard. 75 | The original search was: 76 | “highway=motorway” 77 | */ 78 | [out:json][timeout:25]; 79 | // gather results 80 | ( 81 | // query part for: “highway=motorway” 82 | node["highway"="motorway"]({{bbox}}); 83 | way["highway"="motorway"]({{bbox}}); 84 | relation["highway"="motorway"]({{bbox}}); 85 | ); 86 | // print results 87 | out body; 88 | >; 89 | out skel qt; 90 | ``` 91 | 92 | ## Download everything! 93 | 94 | You can leave the attributes out and just get anything that's a node, way or relation. 95 | 96 | [Overpass turbo](http://overpass-turbo.eu/s/hZy) 97 | 98 | ![screen shot 2016-08-23 at 2 16 58 pm](https://cloud.githubusercontent.com/assets/695934/17910096/4e30dc1c-693c-11e6-8c64-3eea45a45ec3.png) 99 | 100 | ## Define your own bounds 101 | By default the bounding box defaults to the boundaries of the map. {{box}} 102 | 103 | But you can specify your own boundaries using this order 104 | `(lat_min, lon_min, lat_max, lon_max)` 105 | 106 | [Overpass turbo](http://overpass-turbo.eu/s/hZz) 107 | 108 | ``` 109 | /* 110 | This has been generated by the overpass-turbo wizard. 111 | The original search was: 112 | “"Drinking Water"” 113 | */ 114 | [out:json][timeout:25]; 115 | // gather results 116 | ( 117 | // query part for: “"Drinking Water"” 118 | node(35.4808,-118.4676,35.6666,-118.2051); 119 | way(35.4808,-118.4676,35.6666,-118.2051); 120 | relation(35.4808,-118.4676,35.6666,-118.2051); 121 | ); 122 | // print results 123 | out body; 124 | >; 125 | out skel qt; 126 | ``` 127 | 128 | 129 | ## Drinking fountains of yore in Griffith Park (before Anthony added some more) 130 | 131 | ![screen_shot_2016-08-23_at_1_23_35_pm](https://cloud.githubusercontent.com/assets/695934/17908353/fad4b7ca-6934-11e6-8367-17519ac2bc48.png) 132 | 133 | 134 | You can search for data in the past by adding a date next to the timeout. You'll also need to change `out body;` to `out meta;` 135 | 136 | [Overpass turbo](http://overpass-turbo.eu/s/hZt) 137 | 138 | ``` 139 | /* 140 | This has been generated by the overpass-turbo wizard. 141 | The original search was: 142 | “amenity=drinking_water” 143 | */ 144 | [out:json][timeout:25][date:"2016-08-21T00:00:00Z"]; 145 | // gather results 146 | ( 147 | // query part for: “amenity=drinking_water” 148 | node["amenity"="drinking_water"]({{bbox}}); 149 | way["amenity"="drinking_water"]({{bbox}}); 150 | relation["amenity"="drinking_water"]({{bbox}}); 151 | ); 152 | // print results 153 | out meta; 154 | >; 155 | out skel qt; 156 | ``` 157 | 158 | ## Request too big? 159 | You can download straight out of Overpass turbo if you're request is too big. 160 | 161 | ## More examples 162 | http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example 163 | --------------------------------------------------------------------------------