English translation of the article by Joaquin del Cerro.
Hi, I ‘m here again.
This time to speak about a very quick scripting .
A few days ago Oscar Martinez told me that he had seen a python library to access geocoding services , GeoPy ; but there was the problem that he was unable to use it in gvSIG … as it was designed for a newer python version than the one used in gvSIG.
While we were glancing , we realised that by changing few small things, it could become usable for the python version of gvSIG 2.1.0 .
To use GeoPy you have just to install the library , which can be done by unzipping the “geopy-1.7.1-patched-for-gvSIG-2.1.0.zip” file in the folder:
gvSIG/plugins/org.gvsig.scripting.app.extension/lib/
located in user home. If you have already executed gvSIG, it should be closed and restart .
In Linux you can find this folder in $ HOME , and for Windows in :
C: \ Document and Settings \ my_user
or
C: \ Users \ my_user
Once installed the library GeoPy it can be used quite simply. If you execute the gvSIG scripts “Composer” , and create a new one with the following code , then you can start testing without any problems.
from gvsig import *
from commonsdialog import *
from geopy.geocoders import get_geocoder_for_service
def main(*args):
street = inputbox("Insert street","street")
if street == None:
return
geolocator = get_geocoder_for_service("googlev3")
location = geolocator().geocode(street)
print(location.address)
print((location.latitude, location.longitude))
msgbox("Found:\n"+location.address+"\n"+str((location.latitude, location.longitude)))
You can perform more complex actions such as open a table containing street names and civic addressing, read them and go creating a shapefile with points provided by geolocalisation service, but for the moment you can go on playing with this.
Greetings to all




Pingback: Geocoding in gvSIG 2.1 using scripting and GeoPy | Geo-How-To News
I have downloaded geopy-1.7.1-patched-for-gvSIG-2.1.0.zip form this link and after unzipping I got two folders naming Simplejson, GEoPy which folder I can use to execute the gvSIG scripts “Composer”. please step by step process and how can I test my manual shape file addresses file that I have manually geocoded already.
Hi Syed, We want to post a new post about this next week.
Pingback: Look for your address or location in gvSIG using Scripting! | gvSIG blog