On Sat, Jan 17, 2009 at 2:03 AM, arnie <[email protected]> wrote:
>
> Using a wsgi application and without using javascript is it possible
> to calculate the latitude and longitude of a physical address using
> Google Maps API?
Of course.
> If yes then how?
See my code below.
> I have searched a lot but finds only javascript references.
That's because they're doing it from the browser. You want to do it from
the server.
> My requirement is to fetch Latitude/Longitude values when the physical
> address information is being saved in
> datastore using a wsgi application
I'm doing the exact same thing. Are you stealing my Million Dollar Idea?
:-)
> Any idea?
Here's how I do it:
def genGeocode(self):
key=" Your Google Maps API Key goes here"
url='
http://maps.google.com/maps/geo?q='+self.address+'&output=xml&key='+key
result2 = urlfetch.fetch(url)
dom2 = minidom.parseString(result2.content)
geo_status =int(dom2.getElementsByTagName("code")
[0].childNodes[0].data)
#check to see if google was able to find the coordinates for the
street address
if geo_status == 200:
coord = dom2.getElementsByTagName("coordinates")
[0].childNodes[0].data
split_coord = coord.rsplit(",")
longitude=(split_coord[0])
latitude=(split_coord[1])
self.geoPoint=latitude+""+longitude
self.geoHash = Geohash((latitude, longitude))
return 1
Any suggestion to improve my code are greatly appreciated.
--
Faber Fedor
Cloud Computing New Jersey
http://cloudcomputingnj.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---