| Author |
Message |
|
|
See also :
http://forum.geonames.org/gforum/posts/list/1791.page#7521
|
 |
|
|
Have a look here :
http://www.geonames.org/export/web-services.html#postalCodeLookupJSON
There is a demo link :
http://www.geonames.org/export/ajax-postalcode-autocomplete.html
|
 |
|
|
There is one file per country
and a file allCountries containing ... all countries
|
 |
|
|
HowTo for Sweden :
1/ download SE.zip from :
http://download.geonames.org/export/dump/
2/ according to :
http://download.geonames.org/export/dump/readme.txt
select all records with "feature code" = ADM1
One of them is :
http://www.geonames.org/2721357/blekinge-laen.html
with "admin1 code" = 02
3/ select records with "feature code" = ADM2 and "admin1 code" = 02
Now you have all children of Blekinge.
etc
|
 |
|
|
The good question is : what do you want to do with GeoNames data ?
If you need only US data, just download US file.
http://download.geonames.org/export/dump/
|
 |
|
|
Just have a look to download page :
http://www.geonames.org/export/
There is a link to Postal Codes download :
http://download.geonames.org/export/zip
|
 |
|
|
richardbarran wrote:
I guess that the inclusion of CEDEX codes is a bug?
It is not a bug.
CEDEX codes (and some other special codes such as ARMEES for military places) are valid postal codes according to LaPoste database.
Now if you want to get only "ordinary" postal codes you can use this rule :
when there is more than one code for a single city, keep only codes ending with '00' (Ex: NANTES = 44100 44000 44300 44200).
If result is empty, keep codes ending by '0' (Ex: GENNEVILLIERS = 92230).
In GeoNames, we are planning to add the word "CEDEX" to those special codes (Ex: GENNEVILLIERS "92230", "92626 CEDEX", etc).
|
 |
|
|
I don't know any existing PHP search class for geoNames dump.
Feel free to create one and share your work
|
 |
|
|
More information here :
http://geonames.wordpress.com/2010/03/16/ddos-part-ii/
|
 |
|
|
We have no time to update documentation for each webservice.
Would you like to help ?
|
 |
|
|
Webservices are usually called via "ajax" to dynamically populate HTML elements (select, ul, etc) without reloading the full page.
Very easy to implement using a javascript library such as jQuery :
http://jquery.com
Search for jQuery on this forum :
http://forum.geonames.org/gforum/jforum.page?module=search&action=search&clean=1&search_keywords=jQuery&search_terms=all&search_forum=&sort_by=time&sort_dir=DESC&search_cat=
Or have a look here :
http://forum.geonames.org/gforum/posts/list/1875.page
|
 |
|
|
There is no way to get "MN or WI" in a single query.
You may perform a full US query then filter the results to keep only MN and WI :
http://ws.geonames.org/searchJSON?country=US&q=Rice&fcode=PPL
or perform 2 queries then merge results :
http://ws.geonames.org/searchJSON?country=US&q=Rice&fcode=PPL&adminCode1=WI
http://ws.geonames.org/searchJSON?country=US&q=Rice&fcode=PPL&adminCode1=MN
|
 |
|
|
US.zip is 52M
http://download.geonames.org/export/dump/US.zip
extracted US.txt is 250M
A such big file is truncated when you try to open it in a basic editor (notepad, openoffice scalc, etc)
You have to import the file in a local sql database
or create a program to extract only colorado records.
See readme.txt for file structure.
|
 |
|
|
@Marc: would it be possible to keep on the download server the 7 latest Modifications/Deletes files ? These are very small files.
alternateNamesDeletes-2010-07-22.txt 23-Jul-2010 01:15 0
alternateNamesModifications-2010-07-22.txt 23-Jul-2010 01:15 235
deletes-2010-07-22.txt 23-Jul-2010 01:15 215
modifications-2010-07-22.txt 23-Jul-2010 01:14 7.3K
|
 |
|
|
@Marc : there is something strange in hierarchy ws.
Hierarchy of Brescia (PPL) returns :
AREA > CONT > PCLI > ADM1 > ADM2 > ADM3 > PPL
http://ws.geonames.org/hierarchyJSON?formatted=true&geonameId=3181554
while hierarchy of its child Villaggio Ferrari (PPLX) returns :
AREA > CONT > PCLI > ADM1 > PPL > PPLX
ADM2 and ADM3 are missing
http://ws.geonames.org/hierarchyJSON?formatted=true&geonameId=3164234
Another strange thing : Earth is an AREA with countryName = Austria ??!
|
 |
|
|
mattis wrote:
Do you know any way that I could filter out only the "real" cities/towns out of the database?
You may have a look to the dump directory :
http://download.geonames.org/export/dump/
especially those files :
- cities1000.zip : all cities with a population > 1000 (ca 80.000)
- cities5000.zip : all cities with a population > 5000 (ca 40.000)
- cities15000.zip : all cities with a population > 15000 (ca 20.000)
You may also use search webservice, then filter result to keep only places with population > n
|
 |
|
|
Hirayama wrote:
And when I try to correct this error... I got: "error while saving: The record you want to edit is locked for updates for userlevel1"
Thanks for helping in fixing errors.
To move places, you have to create an account, then ask Marc to increase your userlevel.
|
 |
|
|
Complaining here is not the best way to get help...
What are those 3-4 countries with wrong data you are talking about ?
|
 |
|
|
What about a RegExp syntax using "|" ?
http://ws.geonames.org/searchJSON?featureCode=PCLS|PCLI
|
 |
|
|
I do agree with Marc. There is no added-value to store in the database many variants upper/lowercase, with/without dashes, accentuation, etc...
This is already perfectly handled by search-engine and webservices :
view-source:http://ws.geonames.org/searchJSON?formatted=true&q=st%20etienne
returns : Saint-Étienne
etc...
I have started to delete those added for french places.
|
 |
|
|