Author |
Message |
29/01/2007 15:13:37
|
cla
Joined: 29/01/2007 15:09:15
Messages: 9
Offline
|
Hi,
I am in the need of determine the country and as much adminlevels (state/county/district) as possible out of a given latitude/longitude.
I just noticed that http://ws.geonames.org/countrySubdivision?lat=37.98100996893789&lng=-87.50335693359375
gives me the country (US) and the state (Indiana), but not the county (Vanderburgh).
For GB this doesn't seems to work: http://ws.geonames.org/countrySubdivision?lat=52.10650519075632&lng=-0.17578125
returns nothing, while the German data seems to be there:
http://ws.geonames.org/countrySubdivision?lat=48.16608541901253&lng=11.66748046875
This will give me the country and the 'Bundesland'.
But http://ws.geonames.org/postalCodeSearchJSON?postalcode=47714&maxRows=1&country=US&formatted=tr&style=FULL will give me more adminlevels: It returns city, county, state, and country. (But I think they are just generated from a list and not computed by polygon data...)
So my question is: Is there any service out there (on this very useful server or elsewhere) being able to solve this problem?
I searched a long time and found many free shapedata! Are there any tools (or tutorials) how I convert them into something useable for me? (After this is done I will grant them to the public (like this place).)
Any ideas or hints are welcome!
Claus
|
|
|
30/01/2007 18:53:38
|
noiv
Joined: 10/06/2006 16:36:57
Messages: 19
Location: ExploreOurPla.net
Offline
|
Try extendedFindNearby service:
http://ws.geonames.org/extendedFindNearby?lat=52.10650519075632&lng=-0.17578125
|
noiv - ExploreOurPla.net |
|
|
30/01/2007 19:17:50
|
cla
Joined: 29/01/2007 15:09:15
Messages: 9
Offline
|
noiv wrote:
Try extendedFindNearby service:
http://ws.geonames.org/extendedFindNearby?lat=52.10650519075632&lng=-0.17578125
That's not exactly what I was looking for!
It's a 'which places are nearby'-search, which might work most of the time, but not always. The fewer places are nearby a given lat/lng the more unexact the result will be...
|
|
|
30/01/2007 19:43:53
|
noiv
Joined: 10/06/2006 16:36:57
Messages: 19
Location: ExploreOurPla.net
Offline
|
cla wrote:
I am in the need of determine the country and as much adminlevels (state/county/district) as possible out of a given latitude/longitude.
Could you please be more precise then.
|
noiv - ExploreOurPla.net |
|
|
30/01/2007 22:09:29
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
Hi Claus
The countrySubdivision service does not yet include the shape files for the US counties. (The files are here on my pc but not yet integrated)
Did you see the nearest address service?
http://ws.geonames.org/findNearestAddress?lat=37.98100996893789&lng=-87.50335693359375
I am not sure that the shape file will give better results.
The findNearbyPostalCodes service is using zip code area shape files for the US and closests postal codes from lists for other countries.
http://www.geonames.org/export/#findNearbyPostalCodes
Marc
Marc
|
|
|
|
31/01/2007 10:43:57
|
cla
Joined: 29/01/2007 15:09:15
Messages: 9
Offline
|
noiv wrote:
cla wrote:
I am in the need of determine the country and as much adminlevels (state/county/district) as possible out of a given latitude/longitude.
Could you please be more precise then.
Your solution solves the problem 'only' most of the time, but not always. What might happen if I am searching with a lat/lng near the border of an adminlevel when the nearest known place lies in another adminlevel? I think this will happen very often in regions with not that many known places like Africa or Australia....
So the best solution would be a polygon model (or whetever) of adminlevels...
|
|
|
31/01/2007 11:06:29
|
cla
Joined: 29/01/2007 15:09:15
Messages: 9
Offline
|
marc wrote:
Hi Claus
The countrySubdivision service does not yet include the shape files for the US counties. (The files are here on my pc but not yet integrated)
Hi Marc,
this are good news!
Am I allowed to ask how do you change the shape data into something 'usable' for lat/lng? (Just a short hint or tutorial link would be VERY appreciate.)
marc wrote:
Did you see the nearest address service?
http://ws.geonames.org/findNearestAddress?lat=37.98100996893789&lng=-87.50335693359375
I am not sure that the shape file will give better results.
The findNearbyPostalCodes service is using zip code area shape files for the US and closests postal codes from lists for other countries.
http://www.geonames.org/export/#findNearbyPostalCodes
Hm, this is an interesting idea! (I didn't notice that the zip code search is using shape data!) Searching for the nearest known address and then search in the zip code shape area seems to be better than noiv's suggestion. But again I am not really sure what might happen if I am very close to a border... But nevertheless I will use this! (Mostly because there are no better alternatives.)
... at least until you told me how I am able to convert shape data into something 'usable'!
Have fun,
Claus
|
|
|
31/01/2007 17:50:50
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
cla wrote:
Am I allowed to ask how do you change the shape data into something 'usable' for lat/lng? (Just a short hint or tutorial link would be VERY appreciate.)
I don't know what is usable for you. I often use the ogr utilities included in the fwtools kit to convert shape files and load them into a postgres/postgis database.
http://www.gdal.org/ogr/ogrinfo.html
http://fwtools.maptools.org/
Hope this helps
Marc
|
|
|
|
01/02/2007 20:09:19
|
cla
Joined: 29/01/2007 15:09:15
Messages: 9
Offline
|
marc wrote:
Hope this helps
Yes! I just started to convert some data! It works! I am impressed!
Now I have to check if it is that 'exact' as I hoped it would be....
|
|
|
|