Геоданные

Геокодинг

Геокодированием называют процесс преобразования описания местоположения в координаты места на поверхности земли (широта и долгота). Этот процесс весьма востребован, если вам нужно получать координаты места по адресу для дальнейшей агрегации данных по геопризнаку в базе данных.

Для получения координат местности используется команда geocode:

              # ПЕРЕХОДИМ В ГЕО КОНТЕКСТ
- geo:
    provider: osm
    do:
    # Получаем координаты по адресу
    - geocode:
        address: 53 W Jackson Blvd, Chicago, IL 60604, USA
        do:
            
Time Level Message
2018-05-29 23:01:19:468 info Stopped by exit command
2018-05-29 23:01:19:453 debug Page content: ...
2018-05-29 23:01:18:575 info Retrieving page (GET): https://nominatim.openstreetmap.org/search?q=53+W+Jackson+Blvd%2C+Chicago%2C+IL+60604%2C+USA&format=json&polygon=1&addressdetails=1
2018-05-29 23:01:18:566 debug Getting coordinates by address: 53 W Jackson Blvd, Chicago, IL 60604, USA
2018-05-29 23:01:18:547 debug Setting up geo provider: osm
2018-05-29 23:01:18:539 info Starting scrape
2018-05-29 23:01:18:503 debug Setting up default proxy
2018-05-29 23:01:18:485 debug Setting up surf
2018-05-29 23:01:18:455 info Starting digger: 1 [2158]
                      <html>
<head></head>
<body>
    <body_safe>
        <element>
            <address>
                <building>Monadnock Building</building>
                <city>Chicago</city>
                <country>United States of America</country>
                <country_code>us</country_code>
                <county>Cook County</county>
                <house_number>53</house_number>
                <neighbourhood>Loop</neighbourhood>
                <postcode>60604</postcode>
                <road>West Jackson Boulevard</road>
                <state>Illinois</state>
            </address>
            <boundingbox>41.876976</boundingbox>
            <boundingbox>41.8780754</boundingbox>
            <boundingbox>-87.6297057</boundingbox>
            <boundingbox>-87.6294066</boundingbox>
            <class>historic</class>
            <display_name>Monadnock Building, 53, West Jackson Boulevard, Loop, Chicago, Cook County,
              Illinois, 60604, United States of America</display_name>
            <importance>0.71924499588714</importance>
            <lat>41.8775257</lat>
            <licence>Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright</licence>
            <lon>-87.62955615</lon>
            <osm_id>73671128</osm_id>
            <osm_type>way</osm_type>
            <place_id>85949297</place_id>
            <polygonpoints>-87.6297057</polygonpoints>
            <polygonpoints>41.8780724</polygonpoints>
            <polygonpoints>-87.6296748</polygonpoints>
            <polygonpoints>41.876976</polygonpoints>
            <polygonpoints>-87.6294066</polygonpoints>
            <polygonpoints>41.876979</polygonpoints>
            <polygonpoints>-87.6294375</polygonpoints>
            <polygonpoints>41.8780754</polygonpoints>
            <polygonpoints>-87.6297057</polygonpoints>
            <polygonpoints>41.8780724</polygonpoints>
            <type>building</type>
        </element>
        <element>
            <address>
                <bar>Cavanaughs</bar>
                <city>Chicago</city>
                <country>United States of America</country>
                <country_code>us</country_code>
                <county>Cook County</county>
                <house_number>53</house_number>
                <neighbourhood>Loop</neighbourhood>
                <postcode>60604</postcode>
                <road>West Jackson Boulevard</road>
                <state>Illinois</state>
            </address>
            <boundingbox>41.8775765</boundingbox>
            <boundingbox>41.8776765</boundingbox>
            <boundingbox>-87.6297154</boundingbox>
            <boundingbox>-87.6296154</boundingbox>
            <class>amenity</class>
            <display_name>Cavanaughs, 53, West Jackson Boulevard, Loop, Chicago, Cook County,
                Illinois, 60604, United States of America</display_name>
            <icon>https://nominatim.openstreetmap.org/images/mapicons/food_bar.p.20.png</icon>
            <importance>0.63025</importance>
            <lat>41.8776265</lat>
            <licence>Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright</licence>
            <lon>-87.6296654</lon>
            <osm_id>3238872061</osm_id>
            <osm_type>node</osm_type>
            <place_id>45210181</place_id>
            <polygonpoints>-87.6296654</polygonpoints>
            <polygonpoints>41.8776765</polygonpoints>
            <polygonpoints>-87.629630044661</polygonpoints>
            <polygonpoints>41.877661855339</polygonpoints>
            <polygonpoints>-87.6296154</polygonpoints>
            <polygonpoints>41.8776265</polygonpoints>
            <polygonpoints>-87.629630044661</polygonpoints>
            <polygonpoints>41.877591144661</polygonpoints>
            <polygonpoints>-87.6296654</polygonpoints>
            <polygonpoints>41.8775765</polygonpoints>
            <polygonpoints>-87.629700755339</polygonpoints>
            <polygonpoints>41.877591144661</polygonpoints>
            <polygonpoints>-87.6297154</polygonpoints>
            <polygonpoints>41.8776265</polygonpoints>
            <polygonpoints>-87.629700755339</polygonpoints>
            <polygonpoints>41.877661855339</polygonpoints>
            <type>bar</type>
        </element>
        <element>
            <address>
                <address29>Michael J. Petro</address29>
                <city>Chicago</city>
                <country>United States of America</country>
                <country_code>us</country_code>
                <county>Cook County</county>
                <house_number>53</house_number>
                <neighbourhood>Loop</neighbourhood>
                <postcode>60604</postcode>
                <road>West Jackson Boulevard</road>
                <state>Illinois</state>
            </address>
            <boundingbox>41.8774832</boundingbox>
            <boundingbox>41.8775832</boundingbox>
            <boundingbox>-87.6296016</boundingbox>
            <boundingbox>-87.6295016</boundingbox>
            <class>office</class>
            <display_name>Michael J. Petro, 53, West Jackson Boulevard, Loop, Chicago, Cook County,
                Illinois, 60604, United States of America</display_name>
            <importance>0.63025</importance>
            <lat>41.8775332</lat>
            <licence>Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright</licence>
            <lon>-87.6295516</lon>
            <osm_id>4841340094</osm_id>
            <osm_type>node</osm_type>
            <place_id>59402467</place_id>
            <polygonpoints>-87.6295516</polygonpoints>
            <polygonpoints>41.8775832</polygonpoints>
            <polygonpoints>-87.629516244661</polygonpoints>
            <polygonpoints>41.877568555339</polygonpoints>
            <polygonpoints>-87.6295016</polygonpoints>
            <polygonpoints>41.8775332</polygonpoints>
            <polygonpoints>-87.629516244661</polygonpoints>
            <polygonpoints>41.877497844661</polygonpoints>
            <polygonpoints>-87.6295516</polygonpoints>
            <polygonpoints>41.8774832</polygonpoints>
            <polygonpoints>-87.629586955339</polygonpoints>
            <polygonpoints>41.877497844661</polygonpoints>
            <polygonpoints>-87.6296016</polygonpoints>
            <polygonpoints>41.8775332</polygonpoints>
            <polygonpoints>-87.629586955339</polygonpoints>
            <polygonpoints>41.877568555339</polygonpoints>
            <type>lawyer</type>
        </element>
    </body_safe>
</body>
</html>
                      

В следующей главе мы научимся делать обратное геокодирование.