Re: [OSM-talk] Finding what country something is in (new website)

2009-08-06 Thread Roland Olbricht
 There is still something wrong here :
 http://dev.openstreetmap.org/~ojw/WhatCountry//?lat=51.894lon=9.1909

Thank you for submitting the bug. Unfortunately, it revealed a larger fault. 
However, I've added a temporary patch such that the area should work in about 
3 hours (22h00 UTC).

Cheers,
Roland

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-05 Thread Matthias Versen
Hi !

There is still something wrong here :
http://dev.openstreetmap.org/~ojw/WhatCountry//?lat=51.894lon=9.1909

It found an area but not the town with this relation:
http://www.openstreetmap.org/browse/relation/142697

The relation itself should be ok and is used for the street-check:
http://osm.gt.owl.de/Strassenliste/Schieder_Schwalenberg/Status.html

All towns in NRW should have a working admin_level?8 relation.

Matthias





___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-01 Thread Roland Olbricht
 There is really something broken, compare :
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282lang=
demode=raw

 and
 http://dev.openstreetmap.org/~ojw/WhatCountry//?lat=51.894lon=9.1909mode=
raw

Both queries are responded from cache, but from different times. While the 
data of the former is from 2009-07-31 15h00 UTC, the latter is from 
2009-08-01 03h00 UTC. In the meantime, somebody has edited holes into the 
border of Nordrhein-Westfalen. Based on the data of 2009-08-01 08h00, there 
are holes at

http://www.openstreetmap.org/?lat=50.9780863lon=5.9195152zoom=16
http://www.openstreetmap.org/?lat=50.9576158lon=6.0061315zoom=16
http://www.openstreetmap.org/?lat=50.9479lon=6.0151zoom=16
and
http://www.openstreetmap.org/?lat=50.9781246lon=5.9194663zoom=16

At least the second one results from a refinement of borders where and old 
piece of border (way 35960115) has not been removed.

Cheers,
Roland

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-01 Thread Jonas Häggqvist
Matthias Versen wrote:
 Jonas Häggqvist wrote:
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=56.0366lon=12.514
 Okay, it no longer breaks - it just doesn't list the point as being in
 Helsingør (rel#184034).

 I fixed a bug in your relation, 2 not connected relation-members with
 http://www.openstreetmap.org/browse/changeset/1999106

 I hope that it will fix the issue.

It did - thanks a lot. Out of curiousity, how did you figure out where the
error was?

-- 
Jonas Häggqvist
rasher(at)rasher(dot)dk

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-01 Thread Roland Olbricht
 Something that would also be very cool would be if the script told you
 all polygons or multipolygons you're in regardless of whether they are
 a relation or normal polygon, and you could filter the result for
 country boundaries or other type of areas.  It could for example tell
 you you're in a building in a school area in a residential area in a
 county in a province in a country on an island.

It's a question of a proper specification. Then you can add the rules by 
yourself. Please have a look at
http://78.46.81.38/#section.rule_example

Currently, the areas are created based on the two rules

osm-script name=Area::Create_from_admin_level
query type=relation
  has-kv k=admin_level/
  has-kv k=name/
/query
foreach into=rel
  union
recurse type=relation-way from=rel/
recurse type=way-node/
  /union
  make-area pivot=rel into=odd/
  detect-odd-nodes into=odd/
  foreach from=odd into=i
unionitem set=i/item set=rel//union
conflictIn item set=rel/, the item set=i/ is contained in an odd 
number of segments./conflict
  /foreach
/foreach
/osm-script

and

osm-script name=Area::Create_from_multipolygon
query type=relation
  has-kv k=type v=multipolygon/
  has-kv k=name/
/query
foreach into=rel
  union
recurse type=relation-way from=rel/
recurse type=way-node/
  /union
  make-area pivot=rel into=odd/
  detect-odd-nodes into=odd/
  foreach from=odd into=i
unionitem set=i/item set=rel//union
conflictIn item set=rel/, the item set=i/ is contained in an odd 
number of segments./conflict
  /foreach
/foreach
/osm-script

These rules translate as follows:

  Consider every relation that has a tag with key admin_level and a tag with
  key name. Create a polygon from all the member ways. If this fails, attach
  a message In relation $Rel, the node $Node is contained in an odd number of
  segments to this relation.

and

  Consider every relation that has a tag with key type value multipolygon
  and a tag with key name. Create a polygon from all the member ways. If
  this fails ...

Thus, if you think of a rule like

  Consider every way that has a tag with key type and value multipolygon
  and a tag with key name. Create a polygon from this way. If this fails ...

this translates to

osm-script name=Area::Create_from_multipolygon
query type=way
  has-kv k=type v=multipolygon/
  has-kv k=name/
/query
foreach into=way
  union
item set=way/
recurse type=way-node from=way/
  /union
  make-area pivot=way into=odd/
  detect-odd-nodes into=odd/
  foreach from=odd into=i
unionitem set=i/item set=way//union
conflictIn item set=rel/, the item set=i/ is contained in an odd 
number of segments./conflict
  /foreach
/foreach
/osm-script

You just can submit the rule (or any other rule) as described on
http://78.46.81.38/#section.rule_example
and some hours later it should be processed. Feel free to ask if you have any 
questions.

Cheers,
Roland

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-01 Thread Matthias Versen
Jonas Häggqvist wrote:

  I fixed a bug in your relation, 2 not connected relation-members with
  http://www.openstreetmap.org/browse/changeset/1999106

  I hope that it will fix the issue.

 It did - thanks a lot. Out of curiousity, how did you figure out where the
 error was?

I opened http://www.openstreetmap.org/browse/relation/184034 , saved the 
xml into a relation.osm file and opened the file with JOSM.
With that way I only have the relation in JOSM and nothing else.

I opened the relation Editor and clicked on every part of the relation 
and watched the part in the editing area but it looked ok.
After that I did the same but tried to move the connecting node of each 
part and found the not connected node.
I had luck and selected the not connected node at the first try :-)

Matthias




___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-08-01 Thread Matthias Versen
Roland Olbricht wrote:

 Both queries are responded from cache, but from different times. While the
 data of the former is from 2009-07-31 15h00 UTC, the latter is from
 2009-08-01 03h00 UTC. In the meantime, somebody has edited holes into the
 border of Nordrhein-Westfalen. Based on the data of 2009-08-01 08h00, there
 are holes at

Thanks, for partially fixing the issue.
He also added outer parts to a boundary (not multipolygon!) relation.
I removed the outer and marked the parts at the Belgium borders as 
exclave. ( http://en.wikipedia.org/wiki/Vennbahn )

Matthias




___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread OJ W
add a mode tag to see what the [[OSM Server Side Script]] is returning
for each one:

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-33.87lon=151.21mode=raw

in this case, the only state information seems to be in the Is_In
tag on the city boundary



On Fri, Jul 31, 2009 at 2:23 AM, John Smithdelta_foxt...@yahoo.com wrote:



 --- On Thu, 30/7/09, OJ W ojwli...@googlemail.com wrote:

 I put a wrapper around the rather
 excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script
 which can
 tell you which town/county/state/country something is in:

 I haven't looked at the script but it doesn't cope well with US locations at 
 all...

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=40.75lon=-74

 And it didn't like Australian state borders. I'm not sure if the script needs 
 an update or the way the borders were tagged.

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-33.87lon=151.21





___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread John Smith



--- On Fri, 31/7/09, OJ W ojwli...@googlemail.com wrote:

 add a mode tag to see what the [[OSM
 Server Side Script]] is returning
 for each one:
 
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-33.87lon=151.21mode=raw
 
 in this case, the only state information seems to be in the
 Is_In
 tag on the city boundary

Where was that derived from?

I also checked the Australian state borders and they are marked as 
admin_level=4;10 which may interfere with things if the script was only looking 
for a single number, however the boundary is used for local and state.


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread OJ W
On Fri, Jul 31, 2009 at 8:16 AM, John Smithdelta_foxt...@yahoo.com wrote:
 I also checked the Australian state borders and they are marked as 
 admin_level=4;10 which may interfere with things if the script was only 
 looking for a single number, however the boundary is used for local and state.


the 4;10 number sounds like a good place to start investigating - is
that why they're not showing-up on the map of australia?

http://www.openstreetmap.org/?lat=-24.1lon=139.5zoom=4layers=B000FTF

there area some debug tools available on the website I'm getting data from:

http://78.46.81.38/#section.debug_area

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Maarten Deen
OJ W wrote:
 On Fri, Jul 31, 2009 at 8:16 AM, John Smithdelta_foxt...@yahoo.com wrote:
 I also checked the Australian state borders and they are marked as
 admin_level=4;10 which may interfere with things if the script was only
 looking for a single number, however the boundary is used for local and
 state.

 the 4;10 number sounds like a good place to start investigating - is
 that why they're not showing-up on the map of australia?

Does the script also take boundaries in relations into account? I'm a little
puzzled by
http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=42.8145lon=20.365 which
is inside Kosovo with two relations as border,
#1057;#1088;#1073;#1080;#1112;#1072;, admin_level 2, which is seen and
Kosovo, admin_level 3, which is not seen.

Two boundary relations is also the way to map the Australian example.

Regards,
Maarten



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread John Smith



--- On Fri, 31/7/09, Maarten Deen md...@xs4all.nl wrote:

 Two boundary relations is also the way to map the
 Australian example.

I actually merged boundaries because there was 2 slightly wrong ones and I made 
one correct one from them both.

Using a relation for the state boundary information seems like a better idea 
then splitting both into 2 different but identically placed boundaries.


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Matthias Versen
John Smith wrote:

 I also checked the Australian state borders and they are marked as 
 admin_level=4;10 which may interfere with things if the script was only 
 looking for a single number, however the boundary is used for local and state.

We usually Tag only the highest (1=highest) admin_level on a border in 
Germany because an admin_level=2 (country) border is always the same 
border for the lower admin_levels.
The different admin_levels have of course always their own relation.

Matthias



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Roland Olbricht
 Does the script also take boundaries in relations into account? I'm a
 little puzzled by
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=42.8145lon=20.365
 which is inside Kosovo with two relations as border,
 #1057;#1088;#1073;#1080;#1112;#1072;, admin_level 2, which is seen
 and Kosovo, admin_level 3, which is not seen.

 Two boundary relations is also the way to map the Australian example.

Basicallly, the OSM3S takes into account any relation that has a tag with key 
admin_level (no matter what value) and name (no matter what value). Then 
it tries to make one or several polygons from the way members of the relation. 
If the way members constitute proper polygons, an area is made from these. The 
tagging of the ways doesn't matter. If not, you can spot the problems by a 
query like

id-query type=relation ref=53295/
report/

Just send this by a post request like
wget -O - --post-data=id-query type=\relation\ ref=\53295\/report/ 
http://78.46.81.38/api/interpreter

or just paste the query in an arbitrary form on
http://78.46.81.38/

Concerning the Kosovo example, there is something odd at
http://www.openstreetmap.org/?lat=42.8362124lon=20.3513993zoom=16
and
http://www.openstreetmap.org/?lat=42.8362313lon=20.351468zoom=16

Concerning Australia, a query like

coord-query lat=-34.7758269 lon=149.6918631/
print mode=body/

does find relation 80500 which represents Australia. So please specify where 
in Australia the script fails. Then I'll try to fix it as fast as possible.

Cheers,
Roland


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Jonas Häggqvist
OJ W wrote:
 I put a wrapper around the rather excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
 tell you which town/county/state/country something is in:
 
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05
 
  - which replies that the specified numbers are in Tower Hamlets and
 London and the UK

Something's not quite right here in Denmark. There should be a
admin_level=7 boundary in Helsingør:
http://www.openstreetmap.org/browse/relation/184034

However, it seems not to work as expected - in fact it breaks the service
quite horrifically:

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=56.0366lon=12.514

What's going wrong here?

-- 
Jonas Häggqvist
rasher(at)rasher(dot)dk

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Roland Olbricht
Dear OJ,

 I put a wrapper around the rather excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
 tell you which town/county/state/country something is in:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05

  - which replies that the specified numbers are in Tower Hamlets and
 London and the UK


 It does mean you can get all the admin levels for a place using just
 one line of PHP:

 $MyArray = explode(\n,
 file_get_contents(sprintf(http://dev.openstreetmap.org/~ojw/WhatCountry/?l
at=%flon=%f, 51.51, -0.05)));

 (so $MyArray[1] would then contain the country name. Apparently this
 is ISO 3166-1)

first of all, thank you for concise way of getting country information.

After some playing around, I get some error messages with
http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-34.7758269lon=149.6918631
(should be somewhere in Australia)

---8---

br /
bWarning/b:  Invalid argument supplied for foreach() in 
b/home/ojw/public_html/WhatCountry/index.php/b on line b45/bbr /










---8---

If the problem is on the OSM3S side, I'll try to fix things as fast as 
possible.

Cheers,
Roland

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread andrzej zaborowski
2009/7/30 OJ W ojwli...@googlemail.com:
 I put a wrapper around the rather excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
 tell you which town/county/state/country something is in:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05

  - which replies that the specified numbers are in Tower Hamlets and
 London and the UK


 It does mean you can get all the admin levels for a place using just
 one line of PHP:

Something that would also be very cool would be if the script told you
all polygons or multipolygons you're in regardless of whether they are
a relation or normal polygon, and you could filter the result for
country boundaries or other type of areas.  It could for example tell
you you're in a building in a school area in a residential area in a
county in a province in a country on an island.

The complexity of the check should be the same, just way more input
data to consider.

Cheers

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread OJ W
that would be a lack of disk space on dev's /home - I'll see if it's
anything of mine that I can delete

On Fri, Jul 31, 2009 at 6:26 PM, Roland Olbrichtroland.olbri...@gmx.de wrote:
 After some playing around, I get some error messages with
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-34.7758269lon=149.6918631
 (should be somewhere in Australia)

 ---8---

 br /
 bWarning/b:  Invalid argument supplied for foreach() in
 b/home/ojw/public_html/WhatCountry/index.php/b on line b45/bbr /

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread OJ W
should be working again now?

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website) - localised

2009-07-31 Thread OJ W
http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282lang=es

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282lang=de

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282lang=nl

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Jonas Häggqvist
Jonas Häggqvist wrote:
 However, it seems not to work as expected - in fact it breaks the service
 quite horrifically:
 
 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=56.0366lon=12.514

Okay, it no longer breaks - it just doesn't list the point as being in
Helsingør (rel#184034).

-- 
Jonas Häggqvist
rasher(at)rasher(dot)dk

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread OJ W
for some reason my javascript isn't working so well - anyone want to
try and make this more reliable?

http://dev.openstreetmap.org/~ojw/PlaceBrowser/?lat=51.51lon=-0.12zoom=14

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Yann Coupin
Works great for me, what would you like to enhance/correct ?

Le 31 juil. 09 à 23:12, OJ W a écrit :

 for some reason my javascript isn't working so well - anyone want to
 try and make this more reliable?

 http://dev.openstreetmap.org/~ojw/PlaceBrowser/?lat=51.51lon=-0.12zoom=14


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Matthias Versen
Jonas Häggqvist wrote:

 However, it seems not to work as expected - in fact it breaks the service
 quite horrifically:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=56.0366lon=12.514

 Okay, it no longer breaks - it just doesn't list the point as being in
 Helsingør (rel#184034).

I fixed a bug in your relation, 2 not connected relation-members with 
http://www.openstreetmap.org/browse/changeset/1999106

I hope that it will fix the issue.

Matthias


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread John Smith



--- On Fri, 31/7/09, Matthias Versen s...@mversen.de wrote:

 We usually Tag only the highest (1=highest) admin_level
 on a border in 
 Germany because an admin_level=2 (country) border is always
 the same 
 border for the lower admin_levels.
 The different admin_levels have of course always their own
 relation.

That sounds saner than splitting the boundaries into 2 separate ways.


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread John Smith



--- On Fri, 31/7/09, Matthias Versen s...@mversen.de wrote:

  I also checked the Australian state borders and they
 are marked as admin_level=4;10 which may interfere with
 things if the script was only looking for a single number,
 however the boundary is used for local and state.
 
 We usually Tag only the highest (1=highest) admin_level
 on a border in 
 Germany because an admin_level=2 (country) border is always
 the same 
 border for the lower admin_levels.
 The different admin_levels have of course always their own
 relation.

I've redone all the admin_levels=4 like you suggested, however I'm not sure if 
the NSW/ACT state borders are correct and would like a second opinion or third 
on this.

This is the relation for the NSW state border.

http://www.openstreetmap.org/browse/relation/80372

Contained within this border is the ACT.

http://www.openstreetmap.org/browse/relation/80411

I've labeled the respective relations outer and inner on relation 80372 but 
JOSM shows 2 unjoined sections, while that seems to be a JOSM bug I want to 
make sure that I've done the correct thing.


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Matthias Versen
OJ W wrote:
 I put a wrapper around the rather excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
 tell you which town/county/state/country something is in:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05

There is really something broken, compare :
http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282lang=demode=raw

and
http://dev.openstreetmap.org/~ojw/WhatCountry//?lat=51.894lon=9.1909mode=raw

both are only a few kilometers apart and the admin_level 2,4 and 8 are 
missing.

Matthias



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-31 Thread Matthias Versen
John Smith wrote:

 I've redone all the admin_levels=4 like you suggested, however I'm not sure 
 if the NSW/ACT state borders are correct and would like a second opinion or 
 third on this.

 This is the relation for the NSW state border.

 http://www.openstreetmap.org/browse/relation/80372

 Contained within this border is the ACT.

 http://www.openstreetmap.org/browse/relation/80411

 I've labeled the respective relations outer and inner on relation 80372 but 
 JOSM shows 2 unjoined sections, while that seems to be a JOSM bug I want to 
 make sure that I've done the correct thing.

The relation looks ok according to 
http://betaplace.emaitie.de/webapps.relation-analyzer/index.jsp

I will take a closer look if I'm at home and after sleeping (currently 
at work in a nightshift).

Matthias




___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


[OSM-talk] Finding what country something is in (new website)

2009-07-30 Thread OJ W
I put a wrapper around the rather excellent
http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
tell you which town/county/state/country something is in:

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05

 - which replies that the specified numbers are in Tower Hamlets and
London and the UK


It does mean you can get all the admin levels for a place using just
one line of PHP:

$MyArray = explode(\n,
file_get_contents(sprintf(http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=%flon=%f;,
51.51, -0.05)));

(so $MyArray[1] would then contain the country name. Apparently this
is ISO 3166-1)


Results are cached, so hopefully it doesn't hit 78.46.81.38 again if
you download the same place many times.  I assume most people will be
using this to lookup OSM place nodes, so it might manage to cache a
few results if everyone is asking what country London is in...


Tagging-wise, we seem to be missing a few minor places, like the United States:

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=29.4lon=-98.5

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-30 Thread Claudius
Am 30.07.2009 20:59, OJ W:
 I put a wrapper around the rather excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script which can
 tell you which town/county/state/country something is in:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.51lon=-0.05

   - which replies that the specified numbers are in Tower Hamlets and
 London and the UK


 It does mean you can get all the admin levels for a place using just
 one line of PHP:

 $MyArray = explode(\n,
 file_get_contents(sprintf(http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=%flon=%f;,
 51.51, -0.05)));

 (so $MyArray[1] would then contain the country name. Apparently this
 is ISO 3166-1)


 Results are cached, so hopefully it doesn't hit 78.46.81.38 again if
 you download the same place many times.  I assume most people will be
 using this to lookup OSM place nodes, so it might manage to cache a
 few results if everyone is asking what country London is in...


 Tagging-wise, we seem to be missing a few minor places, like the United 
 States:

 http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=29.4lon=-98.5

Cool. Any idea why it's failing for cities in Iran [1]? Missing country 
polygon?

Claudius

[1] http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=36.303lon=59.606


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-30 Thread Matthias Versen
Hello !

 Cool. Any idea why it's failing for cities in Iran [1]? Missing country
 polygon?

 Claudius

 [1] http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=36.303lon=59.606

This excellent tool seems to use the admin-boundary relations.

The output for my example ( 
http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=51.8478lon=9.0282 ) is

===
National border (admin_level=2)

State (admin_level=4)
State-district border (admin_level=5)
County (admin_level=6)

Town (admin_level=8)
===

There are empty lines from admin_levels that aren't used in my case like 
admin_level=7.

See also http://wiki.openstreetmap.org/wiki/Key:boundary

Matthias





___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Finding what country something is in (new website)

2009-07-30 Thread John Smith



--- On Thu, 30/7/09, OJ W ojwli...@googlemail.com wrote:

 I put a wrapper around the rather
 excellent
 http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script
 which can
 tell you which town/county/state/country something is in:

I haven't looked at the script but it doesn't cope well with US locations at 
all...

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=40.75lon=-74

And it didn't like Australian state borders. I'm not sure if the script needs 
an update or the way the borders were tagged.

http://dev.openstreetmap.org/~ojw/WhatCountry/?lat=-33.87lon=151.21


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk