Geospatial Data

Relations

A relation is a collection of points, lines, and other relations that are united into a single object. For example, the relation could be: country, region, region, city, street, etc. Relations have a different administrative level. For example, level 2 corresponds to the country, other levels vary depending on the country. More detailed information about administrative levels in different countries can be found here.

To work with relations there is a command relation. It allows you to search for a relation by name, ID, administrative level and the country. Thus, you can get, for example, all the cities or regions in a certain country, or find a certain city.

The following parameters are used in the command:

Parameter Description
country_name English name of the country where you want to search for a relation. Optional parameter.
admin_level Administrative level. Optional parameter.
name English relation name, eg name of city. Optional parameter.
id Relation ID. If used, system will search by given ID regardless of other parameters sent. Optional parameter.
                # SWITCHING TO THE GEO CONTEXT
- geo:
    provider: osm
    do:
    # Find all regions in Italy
    - relation:
        country_name: Italy
        admin_level: 4
        do:
            
TimeLevelMessage
2018-05-29 11:01:55:891infoScrape is done
2018-05-29 11:01:55:465debugPage content: ...
2018-05-29 11:01:42:570infoRetrieving page (POST/JSON): https://lz4.overpass-api.de/api/interpreter
2018-05-29 11:01:42:562debugCountry name: Italy
2018-05-29 11:01:42:554debugAdmin level: 4
2018-05-29 11:01:42:545debugGetting geo information about relation
2018-05-29 11:01:42:534debugSetting up geo provider: osm
2018-05-29 11:01:42:521infoStarting scrape
2018-05-29 11:01:42:498debugSetting up default proxy
2018-05-29 11:01:42:488debugSetting up surf
                        <html>
<head></head>
<body>
    <body_safe>
        ...
        <elements>
            <id>301482</id>
            <members>
                <ref>137109092</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            ...
            <members>
                <ref>236848961</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <iso3166-2>IT-42</iso3166-2>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <name>Liguria</name>
                <name_ca>Ligúria</name_ca>
                <name_cs>Ligurie</name_cs>
                <name_de>Ligurien</name_de>
                <name_en>Liguria</name_en>
                <name_eo>Ligurio</name_eo>
                <name_fi>Liguria</name_fi>
                <name_fr>Ligurie</name_fr>
                <name_nl>Ligurië</name_nl>
                <name_pl>Liguria</name_pl>
                <name_pt>Ligúria</name_pt>
                <name_ru>Лигурия</name_ru>
                <name_sk>Ligúria</name_sk>
                <name_sl>Ligurija</name_sl>
                <name_sv>Ligurien</name_sv>
                <ref_istat>07</ref_istat>
                <short_name>LIG</short_name>
                <type>boundary</type>
                <wikidata>Q1256</wikidata>
                <wikipedia>it:Liguria</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <elements>
            <id>1405743</id>
            <members>
                <ref>106370194</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            ...
            <members>
                <ref>106369499</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <city_left>Favignana</city_left>
                <name>Marettimo</name>
                <name_ar>مليطمة</name_ar>
                <name_da>Marettimo</name_da>
                <name_el>Μαρέττιμο</name_el>
                <place>island</place>
                <province_left>Trapani</province_left>
                <region_left>Sicilia</region_left>
                <type>boundary</type>
                <wikidata>Q497339</wikidata>
                <wikipedia>it:Isola di Marettimo</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <elements>
            <id>1783980</id>
            <members>
                <ref>67273291</ref>
                <role>admin_centre</role>
                <type>node</type>
            </members>
            ...
            <members>
                <ref>243585592</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <iso3166-2>IT-78</iso3166-2>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <name>Calabria</name>
                <name_ar>كالابريا</name_ar>
                <name_ca>Calàbria</name_ca>
                <name_cs>Kalábrie</name_cs>
                <name_de>Kalabrien</name_de>
                <name_en>Calabria</name_en>
                <name_eo>Kalabrio</name_eo>
                <name_fr>Calabre</name_fr>
                <name_fur>Calabrie</name_fur>
                <name_lt>Kalabrija</name_lt>
                <name_nl>Calabrië</name_nl>
                <name_pl>Kalabria</name_pl>
                <name_pt>Calábria</name_pt>
                <name_ru>Калабрия</name_ru>
                <name_scn>Calabbrî</name_scn>
                <name_sk>Kalábria</name_sk>
                <name_sl>Kalabrija</name_sl>
                <ref_istat>18</ref_istat>
                <short_name>CAL</short_name>
                <type>boundary</type>
                <wikidata>Q1458</wikidata>
                <wikipedia>it:Calabria</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <elements>
            <id>3792877</id>
            <members>
                <ref>362103016</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            ...
            <members>
                <ref>551224923</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <iso3166-2>FR-ARA</iso3166-2>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <name>Auvergne-Rhône-Alpes</name>
                <name_ar>أوفرن-رون ألب</name_ar>
                <name_ca>Alvèrnia-Roine-Alps</name_ca>
                <name_de>Auvergne-Rhone-Alpen</name_de>
                <note>nouvelle région au 1/1/2016</note>
                <ref_insee>84</ref_insee>
                <ref_nuts>FR71</ref_nuts>
                <safe_source>http://www.legifrance.gouv.fr/affichTexte.do?cidTexte=JORFTEXT000030109622</safe_source>
                <start_date>2016-01-01</start_date>
                <type>boundary</type>
                <wikidata>Q18338206</wikidata>
                <wikipedia>fr:Auvergne-Rhône-Alpes</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <elements>
            <id>6921447</id>
            <members>
                <ref>108546409</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <members>
                <ref>108546403</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <city_left>Trapani</city_left>
                <name>Scoglio Palumbo</name>
                <place>islet</place>
                <province_left>Trapani</province_left>
                <region_left>Sicilia</region_left>
                <type>boundary</type>
                <wikidata>Q3952571</wikidata>
                <wikipedia>it:Scoglio Palumbo (Trapani)</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <elements>
            <id>7361997</id>
            <members>
                <ref>10276966</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            ...
            <members>
                <ref>438952407</ref>
                <role>outer</role>
                <type>way</type>
            </members>
            <tags>
                <iso3166-2>IT-88</iso3166-2>
                <admin_level>4</admin_level>
                <boundary>administrative</boundary>
                <name>Sardegna</name>
                <name_ar>سردينيا</name_ar>
                <name_ca>Sardenya</name_ca>
                <name_cs>Sardinie</name_cs>
                <name_de>Sardinien</name_de>
                <name_el>Σαρδηνία</name_el>
                <name_en>Sardinia</name_en>
                <name_eo>Sardio</name_eo>
                <name_es>Cerdeña</name_es>
                <name_eu>Sardinia</name_eu>
                <name_fi>Sardinia</name_fi>
                <name_fr>Sardaigne</name_fr>
                <name_fur>Sardegne</name_fur>
                <name_hsb>Sardinska</name_hsb>
                <name_hu>Szardínia</name_hu>
                <name_it>Sardegna</name_it>
                <name_kn>ಸಾರ್ಡಿನ್ಯ</name_kn>
                <name_ku>Sardînya</name_ku>
                <name_la>Sardinia</name_la>
                <name_nl>Sardinië</name_nl>
                <name_pl>Sardynia</name_pl>
                <name_pt>Sardenha</name_pt>
                <name_ro>Sardinia</name_ro>
                <name_ru>Сардиния</name_ru>
                <name_sc>Sardigna</name_sc>
                <name_scn>Sardigna</name_scn>
                <name_sk>Sardínia</name_sk>
                <name_sl>Sardinija</name_sl>
                <ref_istat>20</ref_istat>
                <short_name>SAR</short_name>
                <type>boundary</type>
                <wikidata>Q1462</wikidata>
                <wikipedia>it:Sardegna</wikipedia>
            </tags>
            <type>relation</type>
        </elements>
        <generator>Overpass API 0.7.55.2 3ab0d275</generator>
        <osm3s>
            <copyright>The data included in this document is from www.openstreetmap.org.
                        The data is made available under ODbL.</copyright>
            <timestamp_areas_base>2018-05-29T14:22:02Z</timestamp_areas_base>
            <timestamp_osm_base>2018-05-29T15:26:02Z</timestamp_osm_base>
        </osm3s>
        <version>0.6</version>
    </body_safe>
</body>
</html>
                    

In the next chapter we will know more about OSM nodes.