algorithmic modeling for Rhino
you could add a simple query to enter an address instead of coordinates.
I used nominatim :
def nominatim(address):
"""
transfrom address in lat long coordinates
"""
url = "http://nominatim.openstreetmap.org/search"
address = address.replace(" ","+")
format="jsonv2"
addressdetails="0"
polygon_="0"
limit="1"
url_totale = url+"?q="+address+"&format="+format+"&addressdetails="+addressdetails+"&polygon_="+polygon_+"&limit="+limit
request = urllib.urlopen(url_totale)
try:
results = json.load(request)
if 0 < len(results):
r = results[0]
return float(r['lat']),float(r['lon'])
else:
print 'HTTP GET Request failed.'
except ValueError, e:
print 'JSON decode failed: '+str(request)
#EXAMPLE
#a = nominatim("133 rue saint antoine Paris")
#print a['display_name']
#print a['lat']
#print a['lon']
Tags:
Hi Guillaume,
Thank you for the suggestion!!
This is indeed a very useful feature, and in the following period, Gismo may have a component which will get the latitude longitude coordinates from the address. In that case, I will definitively quote your name and your project's name as the source for the component!!
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by