Resources

Renesas IoT Sandbox Documentation

Geolocation Library

These functions provide access to different options on geolocation using the Google API.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import Geolocation


Functions


Geolocation.get_address_from_geopoint

Usage: Geolocation.get_address_from_geopoint(latitude,longitude, key)

Returns the address associated to the geopoint in parameters

  • Credit cost: 1
  • Parameters:
  • Sample Code:
    import Geolocation
    value = Geolocation.get_address_from_geopoint("YOUR_LATITUDE","YOUR_LONGITUTDE","YOUR_GOOGLE_API_KEY")
  • Returns:
    • list List of dicts of the form:
      [{"geometry":
      {"location_type":"ROOFTOP",
      "viewport":
      {"northeast":{"lat":33.8897619802915,"lng":-118.1983450197085},
      "southwest":{"lat":33.8870640197085,"lng":-118.2010429802915}},
      "location":{"lat":33.888413,"lng":-118.199694}},
      "address_components":[
      {"long_name":"4006","short_name":"4006","types":["street_number"]},
      {"long_name":"East Alondra Boulevard","short_name":"E Alondra Blvd","types":["route"]},
      {"long_name":"Compton","short_name":"Compton","types":["locality","political"]},
      {"long_name":"Los Angeles County","short_name":"Los Angeles County","types":["administrative_area_level_2","political"]},
      {"long_name":"California","short_name":"CA","types":["administrative_area_level_1","political"]},
      {"long_name":"United States","short_name":"US","types":["country","political"]},
      {"long_name":"90221","short_name":"90221","types":["postal_code"]},
      {"long_name":"4669","short_name":"4669","types":["postal_code_suffix"]}],
      "place_id":"ChIJlXGZHKTMwoAR7Tn_xz5MOd8",
      "formatted_address":"4006 East Alondra Boulevard, Compton, CA 90221, USA",
      "types":["street_address"]
      },
      ...
      ]



Geolocation.get_geopoint_from_address

Usage: Geolocation.get_geopoint_from_address(address, key)

Returns the geopoint associated to the address in parameter

  • Credit cost: 1
  • Parameters:
  • Sample Code:
    import Geolocation
    value = Geolocation.get_geopoint_from_address("YOUR_ADDRESS",'YOUR_GOOGLE_API_KEY")
  • Returns:
    • list List of dicts of the form:
      [{"geometry":
      {"location_type":"ROOFTOP",
      "viewport":
      {"northeast":{"lat":33.8897619802915,"lng":-118.1983450197085},
      "southwest":{"lat":33.8870640197085,"lng":-118.2010429802915}},
      "location":{"lat":33.888413,"lng":-118.199694}},
      "address_components":
      [{"long_name":"4006","short_name":"4006","types":["street_number"]},
      {"long_name":"East Alondra Boulevard","short_name":"E Alondra Blvd","types":["route"]},
      {"long_name":"Compton","short_name":"Compton","types":["locality","political"]},
      {"long_name":"Los Angeles County","short_name":"Los Angeles County","types":["administrative_area_level_2","political"]},
      {"long_name":"California","short_name":"CA","types":["administrative_area_level_1","political"]},
      {"long_name":"United States","short_name":"US","types":["country","political"]},
      {"long_name":"90221","short_name":"90221","types":["postal_code"]},
      {"long_name":"4669","short_name":"4669","types":["postal_code_suffix"]}],
      "place_id":"ChIJlXGZHKTMwoAR7Tn_xz5MOd8",
      "formatted_address":"4006 East Alondra Boulevard, Compton, CA 90221, USA",
      "types":["street_address"]
      },
      ...
      ]



Geolocation.get_location_from_ip

Usage: Geolocation.get_location_from_ip(ip, user, key)

Returns the geopoint associated to the address in parameter, provided by MaxMind API.

See http://dev.maxmind.com/geoip/ for more information and to create an account

  • Credit cost: 1
  • Parameters:
    • ip: str
    • user: user MaxMind user id
    • key: str MaxMind API key
  • Sample Code:
    import Geolocation
    value = Geolocation.get_location_from_ip("YOUR_IP")
  • Returns:
    • dict Dict of the form:
      {
      "city":     {
      "names": {}
      },
      "country":   ...,
      "continent": ...,
      ...
      }

Getting Started
User Roles & Permissions
Streams, Tags, & Data Types
Dashboard Widgets
API
Workflow Studio
Workflow Libraries
Metering
Special Characters
Third Party Integration
Mobile
API Explorer

Geolocation Library

These functions provide access to different options on geolocation using the Google API.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import Geolocation


Functions


Geolocation.get_address_from_geopoint

Usage: Geolocation.get_address_from_geopoint(latitude,longitude, key)

Returns the address associated to the geopoint in parameters

  • Credit cost: 1
  • Parameters:
  • Sample Code:
    import Geolocation
    value = Geolocation.get_address_from_geopoint("YOUR_LATITUDE","YOUR_LONGITUTDE","YOUR_GOOGLE_API_KEY")
  • Returns:
    • list List of dicts of the form:
      [{"geometry":
      {"location_type":"ROOFTOP",
      "viewport":
      {"northeast":{"lat":33.8897619802915,"lng":-118.1983450197085},
      "southwest":{"lat":33.8870640197085,"lng":-118.2010429802915}},
      "location":{"lat":33.888413,"lng":-118.199694}},
      "address_components":[
      {"long_name":"4006","short_name":"4006","types":["street_number"]},
      {"long_name":"East Alondra Boulevard","short_name":"E Alondra Blvd","types":["route"]},
      {"long_name":"Compton","short_name":"Compton","types":["locality","political"]},
      {"long_name":"Los Angeles County","short_name":"Los Angeles County","types":["administrative_area_level_2","political"]},
      {"long_name":"California","short_name":"CA","types":["administrative_area_level_1","political"]},
      {"long_name":"United States","short_name":"US","types":["country","political"]},
      {"long_name":"90221","short_name":"90221","types":["postal_code"]},
      {"long_name":"4669","short_name":"4669","types":["postal_code_suffix"]}],
      "place_id":"ChIJlXGZHKTMwoAR7Tn_xz5MOd8",
      "formatted_address":"4006 East Alondra Boulevard, Compton, CA 90221, USA",
      "types":["street_address"]
      },
      ...
      ]



Geolocation.get_geopoint_from_address

Usage: Geolocation.get_geopoint_from_address(address, key)

Returns the geopoint associated to the address in parameter

  • Credit cost: 1
  • Parameters:
  • Sample Code:
    import Geolocation
    value = Geolocation.get_geopoint_from_address("YOUR_ADDRESS",'YOUR_GOOGLE_API_KEY")
  • Returns:
    • list List of dicts of the form:
      [{"geometry":
      {"location_type":"ROOFTOP",
      "viewport":
      {"northeast":{"lat":33.8897619802915,"lng":-118.1983450197085},
      "southwest":{"lat":33.8870640197085,"lng":-118.2010429802915}},
      "location":{"lat":33.888413,"lng":-118.199694}},
      "address_components":
      [{"long_name":"4006","short_name":"4006","types":["street_number"]},
      {"long_name":"East Alondra Boulevard","short_name":"E Alondra Blvd","types":["route"]},
      {"long_name":"Compton","short_name":"Compton","types":["locality","political"]},
      {"long_name":"Los Angeles County","short_name":"Los Angeles County","types":["administrative_area_level_2","political"]},
      {"long_name":"California","short_name":"CA","types":["administrative_area_level_1","political"]},
      {"long_name":"United States","short_name":"US","types":["country","political"]},
      {"long_name":"90221","short_name":"90221","types":["postal_code"]},
      {"long_name":"4669","short_name":"4669","types":["postal_code_suffix"]}],
      "place_id":"ChIJlXGZHKTMwoAR7Tn_xz5MOd8",
      "formatted_address":"4006 East Alondra Boulevard, Compton, CA 90221, USA",
      "types":["street_address"]
      },
      ...
      ]



Geolocation.get_location_from_ip

Usage: Geolocation.get_location_from_ip(ip, user, key)

Returns the geopoint associated to the address in parameter, provided by MaxMind API.

See http://dev.maxmind.com/geoip/ for more information and to create an account

  • Credit cost: 1
  • Parameters:
    • ip: str
    • user: user MaxMind user id
    • key: str MaxMind API key
  • Sample Code:
    import Geolocation
    value = Geolocation.get_location_from_ip("YOUR_IP")
  • Returns:
    • dict Dict of the form:
      {
      "city":     {
      "names": {}
      },
      "country":   ...,
      "continent": ...,
      ...
      }