GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Geoname Toponym search criteria having fature code RGN and feature class L ??  XML
Forum Index -> Discussion of GeoNames Toponyms
Author Message
Sam



Joined: 05/03/2008 06:58:28
Messages: 28
Offline

I am trying to get all the countries data which have feature code "RGN" and FeatureClass "L".
Is my code is corerct or do i need to add some other filter as well.
When i try to print no of information from every record , it gives feature Class name null and also admin codes as nul values.
As well as it does not give all number of RGN record from allcountris.txt.
Can somebody help me in understanding this java client.
Does this Toponym retrieving data from allcountries.txt or some othe file.

this is the code which i tried to execute

ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
searchCriteria.setFeatureClass(FeatureClass.L);
searchCriteria.setFeatureCode("RGN");
ToponymSearchResult searchResult = WebService.search(searchCriteria);
for (Toponym toponym : searchResult.getToponyms()) {

System.out.println(toponym.getFeatureClassName() + "\t" toponym.getFeatureCode() + "\t" + toponym.getGeonameId()+"\t" + toponym.getName()+"\t" + toponym.getLatitude() + "\t" + toponym.getLongitude()+"\t"+ toponym.getAdminCode1()
}

I am looking for fetching all the regions from allcountries.txt file.
Can somebody please help me.
marc



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

You have to set the style to 'FULL' if you want to access more parameters. The method is accessing the web services and does not stream. If only gets a certain number of rows. You can set the number of rows and you will have to implement paging if you want to access more records.


Marc

[WWW]
Sam



Joined: 05/03/2008 06:58:28
Messages: 28
Offline

thanks marc i used it and it works.

Can you please clarify the second part of answer.
I mean how can i get whole of records out of allcountries.txt using toponyms.is there aby other way than pagination?

with my code i am getting only first 100 records. i want all the records so that i can analyse all region information.
i am just using system.out.pintln for printing all so that i can use that retrived data on console for analysing.
Sam



Joined: 05/03/2008 06:58:28
Messages: 28
Offline

i fund there is one method getTotalResultsCount() in ToponymSearchresult class and it gives the number of records in the search result.

is this the one which will help me in retriveing all the records??

marc



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

If you want to retrieve all the records you will have to download the dump to your computer and work with it locally. The API is accessing the webservice and only returns a finite number of rows per request. (set with maxRows and startRow)


Marc

[WWW]
 
Forum Index -> Discussion of GeoNames Toponyms
Go to:   
Powered by JForum 2.1.5 © JForum Team