Address to Lat Long Free

Photo by Robert Penaloza on Unsplash

Find lat long coordinates

the Python Geocoder is another open-source library that leverages Python to retrieve lat long coordinates from Google Maps. One of its advantages is that it can be used completely separately from QGIS.

Python Geocoder

Simple and consistent geocoding library written in Python.

It can be very difficult sometimes to parse a particular geocoding provider
since each one of them have their own JSON schema.

Here is a typical example of retrieving a Lat & Lng from Google using Python, things shouldn’t be this hard.

>>> import requests  
>>> url = 'https://maps.googleapis.com/maps/api/geocode/json'
>>> params = {'sensor': 'false', 'address': 'Mountain View, CA'}
>>> r = requests.get(url, params=params)
>>> results = r.json()['results']
>>> location = results[0]['geometry']['location']
>>> location['lat'], location['lng']
(37.3860517, -122.0838511)

Now lets use Geocoder to do the same task

>>> import geocoder  
>>> g = geocoder.google('Mountain View, CA')
>>> g.latlng
(37.3860517, -122.0838511)

ArcGIS

Geocoding

>>> import geocoder
>>> g = geocoder.arcgis('Redlands, CA')
>>> g.json
...

This provider may return multiple results by setting the parameter maxRows to the desired number (1 by default). You can access those results as described in the page ‘Access to geocoder results’.

Command Line Interface

$ geocode 'Redlands, CA' --provider arcgis

Parameters

  • maxRows: (default=1) Max number of results to fetch
  • limit: Deprecated, same as maxRows
  • method: (default=geocode) Use the following:
  • geocode

References

Usage Example

A handy tool to get lat long from address, helps you to convert address to coordinates (latitude longitude) on map, also calculates the gps coordinates.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store