Geospatial Data

Shapes

Sometimes it is necessary to obtain a shape for the boundaries of some OSM relation. For example for a city or a region. To do it, there are two commands available: wkt to get this data in the "WKT (Well-Known-Text)" format or geojson to get the data in GeoJSON format.

In both commands you can use following parameters:

Parameter Description
relation Relation ID.
    # SWITCHING TO THE GEO CONTEXT
- geo:
    provider: osm
    do:
    # Get shape in WKT format for specific OSM relation
    - wkt:
        relation: 62366
        do:
Time Level Message
2018-05-29 22:02:08:751 info Stopped by exit command
2018-05-29 22:02:08:283 debug Page content: ...
2018-05-29 22:02:06:761 info Retrieving page (GET): http://polygons.openstreetmap.fr/get_wkt.py?id=62366&params=0
2018-05-29 22:02:06:752 debug Relation ID: 62366
2018-05-29 22:02:06:744 debug Getting WKT geom for relation
2018-05-29 22:02:06:736 debug Setting up geo provider: osm
2018-05-29 22:02:06:728 info Starting scrape
2018-05-29 22:02:06:704 debug Setting up default proxy
2018-05-29 22:02:06:689 debug Setting up surf
2018-05-29 22:02:06:657 info Starting digger: 1 [2158]
            
<html>
<head></head>
<body>
SRID=4326;MULTIPOLYGON(((9.8810213 50.6734643,9.8815143 50.6732013,9.8819651 50.6730224,9.8822352 50.6727284,9.8822992 50.6725263,9.8814952
50.6723014,9.8814672 50.6720035,9.8814852 50.6716374,9.8819762 50.6712976,9.8820642 50.6710996,9.8816722 50.6708135,9.8811134
50.6706495,9.8802725 50.6703745,9.8797026 50.6705086,9.8790646 50.6704696,9.8788107 50.6703326,9.8787177 50.6701307,9.8788256
...
51.1987095,11.4417495 51.1986705,11.4422248 51.1983985,11.4429123 51.1983543,11.4434331 51.1984848,11.443604 51.1983687,11.4438274
51.1983813,11.4455993 51.1942559,11.4460681 51.1944058,11.4464906 51.1946146,11.4466948 51.1948431,11.4470651 51.1950529,11.4471149
51.1955349,11.447471 51.1959901,11.4478215 51.1962274)))
</body>
</html>
                

in next chapter we will learn how you can do geocoding for some specific place.