Author |
Message |
23/07/2008 16:53:55
|
fiammosky
Joined: 23/07/2008 16:47:19
Messages: 3
Offline
|
hello, i'm trying to do a java application that gives the coordinates (lat,long) of a specific address.
I managed to get coordinates for a city thanks to the FAQ examples but i can't find help about addresses...
How can you access to address level in the search criteria?
I don't find this step in javadoc help.
Thanks in advance
here's my implementation
(all the system.out are for testing)
Code:
try {
// java.net.UrlEncoder("ö","UTF8");
ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
searchCriteria.setQ(jTextField1.getText());
searchCriteria.setCountryCode("IT");
searchCriteria.setMaxRows(5);
//searchCriteria
ToponymSearchResult searchResult = WebService.search(searchCriteria);
for (int i = 0; i < searchResult.getToponyms().size(); i++) {
System.out.println(searchResult.getToponyms().get(i).getName() + " " + searchResult.getToponyms().get(i).getCountryName()+" Lat:"+searchResult.getToponyms().get(i).getLatitude()+" Long:"+searchResult.getToponyms().get(i).getLongitude());
}
} catch (Exception ex) {
Logger.getLogger(CoordinateUI.class.getName()).log(Level.SEVERE, null, ex);
}
|
|
|
23/07/2008 20:46:43
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
Hi
You have to use the 'findNearesAddress' method on the WebService class:
http://www.geonames.org/source-code/javadoc/org/geonames/WebService.html#findNearestAddress(double,%20double)
Best
Marc
|
|
|
|
24/07/2008 10:33:58
|
fiammosky
Joined: 23/07/2008 16:47:19
Messages: 3
Offline
|
You have to use the 'findNearesAddress' method on the WebService class:
Thank you but that's not what i'm interested in:
i need the opposite, from an address obtain the coordinates;
is it possible?
For example,
given
10201 Pico Boulevard,
Century City, CA
get
N 34° 3' 33'' W 118° 24' 46''
or in the other format
34.059167, -118.412778
|
|
|
25/07/2008 08:04:32
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
I am afraid, GeoNames does not have an address geocoding service.
Marc
|
|
|
|
25/07/2008 10:01:16
|
fiammosky
Joined: 23/07/2008 16:47:19
Messages: 3
Offline
|
marc wrote:
I am afraid, GeoNames does not have an address geocoding service.
Marc
I was suspecting that...
anyway, thanks for the replies
I'll try with geo google
http://geo-google.sourceforge.net/
|
|
|
31/07/2008 14:40:16
|
Phliplip
Joined: 31/07/2008 14:35:29
Messages: 2
Offline
|
You could use Googles Geocoding service.
http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct
|
|
|
|