|
Getting OSM Data
When you want to get the most recent OpenStreetMap data, the easiest way is to download an extract from a website. There are various web services that provide data extracts for an area of your choosing. Downloading Data ExtractsGeoFabrikGeoFabrik is a company which specializes in working with OpenStreetMap. They provide a variety of free extracts in shapefile and raw OSM format on their download website. The advantage of downloading GeoFabrik data is that it is updated every day, and it’s easy and reliable. One disadvantage is that the data is extracted by country, and not all countries are available. BBBikeBBBike provides shapefiles and raw OSM format for cities around the world, extracted weekly. This is useful if you are looking for data extracts for a single city.
Customized ExtractsHOT ExportsThe Humanitarian OpenStreetMap Team has created a service that allows users to select the area that they want to extract, and also use JOSM Presets to select custom tags to be included in the extract. The service is available to all countries where HOT works, at export.hotosm.org. BBBikeYou can select your own area from any part of the world using the service at http://extract.bbbike.org/. Disadvantages are that you aren’t able to select customizable tags and that the amount of data which you can download is limited. OverpassOverpass is an API (Application Programming Interface) for extracting data from a read-only copy of the main OpenStreetMap database which can deliver an almost arbitrary amount of data. Using a query language you can customize which subset of the data you obtain. You can either use the API directly by generating a http-request or through the overpass turbo interface. Overpass TurboOverpass Turbo is an interactive query generator where you should first zoom to the appropriate region on the map. Enter your query in the left field of the page and trigger any actions using the buttons at the top of the interface. If you are new to the query language then using the wizard should get you started. The OSM wiki contains a full description of the syntax of the query language as well as a collection of examples. The map will highlight all data selected by your query which you can then modify. Press “Run” to refresh the result display. Once you are satisfied with what you see then “Export” offers a number of choices, among them raw OSM data. If the amount of data is limited you may as well access them directly after switching between map view and data view using the rightmost buttons at the top. The export option Query -> compact OverpassQL generates a hyperlink to be used for the Overpass API. If you want to engineer a fancy query in order to obtain a subset of the data from a large area then it is a good idea to test and improve this query in Overpass Turbo on a small area. You can then zoom out to your complete region of interest and use the resulting query url directly for the API. The next section explains how you can do this. Overpass APIOverpass API is a dedicated service optimized for querying but not writing OpenStreetMap data. Due to this optimization it operates very fast compared to the main database api and has virtually no limits on the amount of data transferred. Several instances of this service are available on the net, the one used in the following example also provides some information on its homepage If you have a working query-URL for submitting an http-request to the Overpass API then a tool such as wget - available for different operating systems, see here - allows you to download the raw OSM data directly from the server and store them locally. The following snippet is a script for the bash shell common on Unix systems which obtains all data within a specified bounding box:
SummaryThe services mentioned in this chapter are all that the average user needs to get the OSM data they want and be able to work with it in GIS software. However, you may want to learn more powerful ways of working with the data yourself. The remaining chapters in this section are quite technical, but show more advanced methods of manipulating and accessing OSM data.
這個章節有用嗎?
讓我們了解以便我們改進這個指南!
|