Contents

Address to Lat Long Free

https://miro.medium.com/max/1400/0*YG5OpbKwiMgpdDag

Photo by Robert Penaloza on Unsplash

Find lat long coordinates

QGIS Geocoding Plugins (Free)

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.

Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each other.

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.

1
2
3
4
5
6
7
8
>>> 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

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

ArcGIS

The World Geocoding Service finds addresses and places in all supported countries from a single endpoint. The service can find point locations of addresses, business names, and so on. The output points can be visualized on a map, inserted as stops for a route, or loaded as input for a spatial analysis. an address, retrieving imagery metadata, or creating a route.

Geocoding

1
2
3
4
>>> **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

1
$ geocode 'Redlands, CA' --provider arcgis

Parameters

  • location: Your search location you want geocoded.
  • 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.

Contact me: Hung, Chien-Hsiang (chienhsiang-hung.github.io)