Tag Archives: OpenStreetMap

Use Overpass API to get OSM data

Overpass API

Have you ever needed very specific data from openstreetmap and don’t want to download the whole state or country? The solution is Overpass API.

The Overpass API (formerly known as OSM Server Side Scripting, or OSM3S) is a read-only API that serves up custom selected parts of the OSM map data. It acts as a database over the web: the client sends a query to the API and gets back the data set that corresponds to the query.

http://wiki.openstreetmap.org/wiki/Overpass_API

We are going to try the Overpass QL as query language. The whole query source code is divided in statements. We set the type of element that we want: node, way, relation or area. and then filter by tag. Like this

node[name="Foo"];
way[name="Foo"];
rel[name="Foo"];
area[name="Foo"];

Continue reading

Getting vector data from OpenStreetMap

Let’s say that we need the Barcelona’s subway lines in geojson for our project, and we decided to use OpenStreetMap data. There is plenty of ways for getting OSM data, the most common is using their API, or the  geofabrik download page,  but this time we gonna use metro-extracts from mapzen.

We look for Barcelona. There is a lot of file formats there:

metro-extracts-barcelona

metro-extracts-barcelona

Continue reading

Visualizar edificios 3D con OSM Buildings

OSM Buildings en una pequeña librería de Javascript que permite extruir las geometrías 2D de OpenStreetMap en 3D y visualizarlas en mapas interactivos. OSM Buildings no genera un verdadero mapa en 3D como sería el caso de Three.js, lo que hace es generar una perspectiva 3D en un mapa 2D.

http://osmbuildings.org/

OSMbuildings funciona tanto para OpenLayers como para Leaflet.js. En este ejemplo usaremos la librería de Leaflet para crear un mapa al que añadiremos los edificios en 3D como capa extra.

Continue reading