Geospatial Data

Geocoding

Geocoding refers to the process of converting a description of a location into position coordinates on the surface of the earth (latitude and longitude). This process is very in demand if you need to get the coordinates of the location to use it later for further aggregation by geo-referenced data in the database. Or if you simply need to show place on the map.

To get coordinates for specific place you can use the geocode command:

    # SWITCHING TO THE GEO CONTEXT
- geo:
    provider: osm
    do:
    # Get coordinates of place defined by specific address
    - 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>
            

In our final chapter about geospatial data we will study process of reverse geocoding.