Geocoding is the process of converting addresses actual locations (like “
Cyberjaya Lake Gardens Persiaran Semarak Api, Cyber 4, 63000 Cyberjaya, Selangor, Malaysia”) into geographic coordinates (like
latitude 2.9361259 and
longitude 101.6415532), which you can use to place markers on a map, or position the map.
A powerful geographic information system (GIS), can turn a list of addresses into spatial data for mapping or combining with other data. The ability to geocode in a country/region is dependent upon the road data coverage and the geocoding precision of the geocoding service.
There are several geocoding tools available to get the specific geocode for a particular location. They each have their own strengths and weaknesses, so I thought it would be appropriate to share what I have learned.
Step by step : Run Script using Python
import pandas as pd df = pd.read_csv("parkputrajaya_MY4.csv") import googlemaps gmaps_key = googlemaps.Client(key = "[Your Google Client ID]") df["LAT"] = None df["LON"] = None for i in range(0, len(df),1): geocode_result = gmaps_key.geocode(df.iat[i,1]) try: lat = geocode_result["geometry"]["location"]["lat"] lon = geocode_result["geometry"]["location"]["lng"] df.iat[i, df.columns.get_loc("LAT")] = lat df.iat[i, df.columns.get_loc("LON")] = lon except: lat = None lon = None df.to_csv('parkputrajaya_MY4_geocode.csv')
List of Geocoding Tools
• Geo for Google Docs
Script that geocodes addresses within Google Spreadsheets, using MapQuest or Yahoo geocoding APIs.
Will geocode up to 250 addresses and plot on a Google Map. Once the map has been created scroll down for the link to download as a KML file.
• ArcGIS Online
Geocodes up to 250 addresses.
• GPS Visualizer
• Stata: Geocode command
This utilizes the Google Maps to return latitude and longitude within the statistical package Stata.
Geocoding for a limited number of records.
• Excel Geocoding Tool
• Google Geocoding
Google requires you get an API key from them in order to do geocoding.
• Batch geocoder for journalists
Locations to coordinates at rocket speed