Revision 902
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/scripts/examples/geopy/geopy_01.inf | ||
---|---|---|
1 | 1 |
[Unit] |
2 | 2 |
type = Script |
3 | 3 |
name = geopy_01 |
4 |
description = |
|
5 |
createdBy = |
|
6 |
version = |
|
4 |
description =
|
|
5 |
createdBy =
|
|
6 |
version =
|
|
7 | 7 |
|
8 | 8 |
[Script] |
9 | 9 |
main = main |
10 | 10 |
Lang = python |
11 | 11 |
|
12 |
[script] |
|
13 |
enable = true |
|
14 |
|
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/scripts/examples/geopy/geopy_01.py | ||
---|---|---|
7 | 7 |
#http://geopy.readthedocs.org/en/latest/#module-geopy.geocoders |
8 | 8 |
|
9 | 9 |
print "\n\n Test 01: Geocode" |
10 |
from geopy.geocoders import Nominatim
|
|
11 |
geolocator = Nominatim()
|
|
10 |
from geopy.geocoders import GoogleV3
|
|
11 |
geolocator = GoogleV3()
|
|
12 | 12 |
location = geolocator.geocode("175 5th Avenue NYC") |
13 | 13 |
print(location.address) |
14 | 14 |
print((location.latitude, location.longitude)) |
15 | 15 |
print(location.raw) |
16 | 16 |
|
17 | 17 |
print "\n\n Test 02: Reverse geocode" |
18 |
from geopy.geocoders import Nominatim
|
|
19 |
geolocator = Nominatim()
|
|
18 |
from geopy.geocoders import GoogleV3
|
|
19 |
geolocator = GoogleV3()
|
|
20 | 20 |
location = geolocator.reverse("52.509669, 13.376294") |
21 |
print(location.address) |
|
22 |
print((location.latitude, location.longitude)) |
|
23 |
print(location.raw) |
|
21 |
print location |
|
22 |
print(location[0].address) |
|
23 |
print((location[0].latitude, location[0].longitude)) |
|
24 |
print(location[0].raw) |
|
24 | 25 |
|
25 | 26 |
print "\n\n Test 03: Mesouring distance" |
26 | 27 |
from geopy.distance import vincenty |
Also available in: Unified diff