Is there a way to get the long/lat coordinates from a Fusion Tables KML export?
This is a post about it, but the process doesn't work anymore:
Is there a way to get the long/lat coordinates from a Fusion Tables KML export?
This is a post about it, but the process doesn't work anymore:
If your data is coded with lat/longs, you'll get lat/longs out in the export (in the form of a <coordinates>
element. If your data is coded by address (as I suspect it is in your case), there's no way to get the coordinates directly in the export. Instead, the KML file will have an <address>
element. It seems that Google does address geocoding on the fly, and isn't willing to share this with you.
Google has a geocoding API you can use to turn your addresses into coordinates under the condition that you'll be displaying the geocoded data on a Google map. Here's a simple example of using the geocoding API in Python:
import urllib2, json
# create a request URI for the Google Geocoding API
service_fmt = "https://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=false"
request_addr = service_fmt.format(urllib2.quote("600 Mountain Ave, New Providence, NJ"))
# make the request and deserialize the JSON response
response_handle = urllib2.urlopen(request_addr)
response = json.loads(response_handle.read())
print(response["results"][0]["geometry"]["location"])
You can open the exported KML in Google Earth, and export it to a new file by "Save Place as…" This will create a KML file with long/lat coordinates. However, at least Google Earth version 7.1.2.2041 creates KML files with both "Point" and "LinearRing" geometries, which for instance QGis has trouble reading.