GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Addresses in webservice Java  XML
Forum Index -> Discussion of GeoNames Toponyms
Author Message
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);
         }
 
[WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
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

[WWW]
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‎
[WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

I am afraid, GeoNames does not have an address geocoding service.


Marc

[WWW]
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/
[WWW]
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
 
Forum Index -> Discussion of GeoNames Toponyms
Go to:   
Powered by JForum 2.1.5 © JForum Team