Skip to main content

Python Package for Places Geocoding API service

Project description

Places API Geocoding!

There are a many geocoding APIs out there to choose from. However, Places API tops them all with the most accurate, affordable, and effective solution!

Our package focuses on a pythonic and accessible way to geocode POIs (Places of Interest) in Python.


SUPPORT

We have multiple support channels that you can contact us on:


NOTE

Places is a commercial product created for the purpose of geocoding with simplicity and speed. Authorization API tokens are necessary for using the API endpoints. Registering such API tokens is possible through our website subscription page.

→ Check out our official documentation!


QUICK START

The places module:

The places(token: str) module allows you to register your access tokens into the Places API which provides the base functionality for geocoding, density, convex, and radius calls.

→ Note: The Places API package undergoes constant development so consider that endpoint changes may occur.

To import the Places API package:

from places_geocoding import places_api as pa

TABLE OF CONTENTS

Endpoint Function
load_properties_api load_radius()
convex_search convex()
density_search density()
reverse_geocode reverse()
batch_reverse batch_reverse()
geocode forward()
batch_geocode batch_forward()

API EXAMPLES

To use the Places API for free leave "token" argument blank

Note: Free usage has a rate limit of 2 requests / second

All example code to the Places API package can be found below:

load_radius()
  • coordinate: required, indicates center of search
  • radius: required, indicates radius of search
  • reverse_param: option, (bool indicating the order of the input coordinates)
Example(1)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.load_properties(
    coordinates=[43.0961466, -77.6337776],
    radius=100,
    reverse_param=False
)
convex()
  • coordinate_array: required, edges of polygon
  • reverse_param: optional, (bool indicating the order of the input coordinates)
Example(2)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.convex(
    coordinates=[[43.0961466, -77.6337776],
     [43.1018722, -77.6334654],
     [43.1010339, -77.6342459]],
    reverse_param=False
)
density()

Radius Load Density:

  • unit_input: required, str
    • options: [km, mi, m, ft, yd]
  • unit_output: required, str
    • options: [km, mi, m, ft, yd]
  • coordinates: optional, list
  • reverse_param: optional, (bool indicating the order of the input coordinates)
Example(3)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.density(
    unit_in='ft',
    unit_out='ft',
    coordinates=[43.1010339, -77.6342459],
    radius=100
)

Custom Density:

  • unit_input: required, str
    • options: [km, mi, m, ft, yd]
  • unit_output: required, str
    • options: [km, mi, m, ft, yd]
  • custom_option: optional, str
    • city
    • postcode
    • region/state
  • custom_utility: optional, int/str,
    • custom_utility specifies the input of custom_option
Example(4)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.density(
    unit_in='ft',
    unit_out='ft',
    custom_option='postcode',
    custom_utility=10980
)
reverse()
  • coordinate: required, geographic location of POI
  • radius: optional, radius of error
    • Default error radius is 10 ft
  • reverse_param: optional, (bool indicating the reversal of the input coordinates)
Example(5)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.reverse(
    coordinate=[43.1017283, -77.6338936],
    radius=10, 
    reverse_param=False
)
batch_reverse()
  • coordinates: required, geographic location(s) of POI
  • radius: optional, radius of error
    • Default error radius is 10 ft
  • reverse_param: optional, (bool indicating the reversal of the input coordinate)
Example(6)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.batch_reverse(
    coordinates=[[43.1017283, -77.6338985],
    [43.0936914, -77.6349024],
    [43.0937299, -77.6350315],
    [43.0930091, -77.6354702],
    [43.09245, -77.6353749]],
    radius=10,
    reverse_param=False
)
forward()

Full Address Geocoding

  • full address: optional, user-defined1 address of the POI
  1. Places flex-formatting AI allows for multiple address formats
Example(7)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.forward(
    full_address="94 Crittenden Way, Brighton, NY, 14623",
)

Parsed Address Geocoding

  • street: optional, street on which the POI is located
  • number: optional, number of the POI's street
  • postcode: optional, zip code or microregion of the POI
  • region: optional, state in the USA1 or region internationally
  • city: optional, city where the POI is located
  • unit: optional, unit if the POI is non-singular (ex. apartment)
  1. If the POI is within USA borders, the region must be the state's 2-letter abbreviation
Example (8.1) without unit
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.forward(
    street="Crittenden Way",
    number=94,
    postcode=14623,
    region="NY",
    city="Brighton",
)
Example (8.2) with unit
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.forward(
    street="Crittenden Way",
    number=88,
    postcode=14623,
    region="NY",
    city="Brighton",
    unit='Unit 2'
)
batch_forward()
  • addresses: optional, list of formatted addresses
  • address_file: optional, JSON or XML file of formatted addresses1
  1. Note: Check our documentation for formatting details
Example(9.1) array of addresses
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.batch_forward(addresses=["88 Crittenden Way, Brighton, NY, 14623, Unit 2",
                                     "140 Centre Drive, Brighton, NY, 14623",
                                     "94 Crittenden Way, Brighton, NY, 14623",
                                     "104 Crittenden Way, Brighton, NY, 14623, Unit 6"
                                     ])
Example(9.2) file of addresses
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.batch_forward(address_file=address_file.json)
pg = pa.Places(token)
# pg = pa.Places() for free plan

result = pg.batch_forward(address_file=address_file.xml)

→ Download the XML or JSON file as "address_file" to test the examples


INSTALLATION

Install the Places API on pip:

$ pip install places_geocoding

OR

Install the Places API on conda:

$ conda install -c Martin Mashalov places_geocoding

REQUIREMENTS


BUSINESS CONTACT

Our business email contact is: hello@places.place. Please feel free to reach out regarding any product feedback or support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

places_geocode-0.5.8.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file places_geocode-0.5.8.tar.gz.

File metadata

  • Download URL: places_geocode-0.5.8.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for places_geocode-0.5.8.tar.gz
Algorithm Hash digest
SHA256 acac5fed0f977c844781aaa4f9a8597b519461d3c0f940b559cf6df58c998e5d
MD5 477d5437b75e4dc26ce4667d0ceaa70e
BLAKE2b-256 77fc323f92fed839cc6c0d6eda9e70a2a63fd4a4e8d427cdd7ca3148c6e1c1ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page