Re: [OSM-talk] Mysterious PostGIS Problem with Polygons

2009-08-22 Thread John Smith
--- On Sat, 22/8/09, Jon Burgess jburgess...@googlemail.com wrote:

 In part it could be caused by invalid geometries. Postgis
 reports that
 only Polska is actually a valid polygon geometry. Any
 errors could upset
 algorithms like ST_Within().
 
 gis= select name,isvalid(way) from planet_osm_polygon
 where
 boundary='administrative' AND admin_level='2' AND name in
 ('Deutschland','Danmark','Polska','Nederland','Australia','Italia');
 NOTICE:  Hole lies outside shell
     name     | isvalid
 -+-
  Australia   | f

Is Australia listed as false because the polygon used doesn't just cover 
Australia but 4 or so external territories? These are islands in the Pacific 
and Indian Oceans.


  

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


[OSM-talk] Mysterious PostGIS Problem with Polygons

2009-08-21 Thread Peter Körner
 The second should fetch the border of Germany and the first
 one all boundaries in that. At least that's what I want it
 to do :)
 
 I just ran that query on my database and used name='Australia' and it works 
 as you thought it should.

Yes, you're right. It works with
Nederland, Australia, Italia

but not with
Deutschland, Danmark, Polska


SELECT osm_id, admin_level, name
FROM planet_osm_polygon
WHERE ST_Within(way, (
   SELECT way
   FROM planet_osm_polygon
   WHERE boundary='administrative' AND
 name='Polska'
   LIMIT 1
))
AND boundary='administrative'
LIMIT 25


Any Idea Why?

Peter


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


Re: [OSM-talk] Mysterious PostGIS Problem with Polygons

2009-08-21 Thread Jon Burgess
On Fri, 2009-08-21 at 18:51 +0200, Peter Körner wrote:
  The second should fetch the border of Germany and the first
  one all boundaries in that. At least that's what I want it
  to do :)
  
  I just ran that query on my database and used name='Australia' and it works 
  as you thought it should.
 
 Yes, you're right. It works with
 Nederland, Australia, Italia
 
 but not with
 Deutschland, Danmark, Polska
 
 
 SELECT osm_id, admin_level, name
 FROM planet_osm_polygon
 WHERE ST_Within(way, (
SELECT way
FROM planet_osm_polygon
WHERE boundary='administrative' AND
  name='Polska'
LIMIT 1
 ))
 AND boundary='administrative'
 LIMIT 25
 
 
 Any Idea Why?

In part it could be caused by invalid geometries. Postgis reports that
only Polska is actually a valid polygon geometry. Any errors could upset
algorithms like ST_Within().

gis= select name,isvalid(way) from planet_osm_polygon where
boundary='administrative' AND admin_level='2' AND name in
('Deutschland','Danmark','Polska','Nederland','Australia','Italia');
NOTICE:  Holes are nested
NOTICE:  Hole lies outside shell
NOTICE:  Hole lies outside shell
NOTICE:  Hole lies outside shell
NOTICE:  Hole lies outside shell
name | isvalid
-+-
 Nederland   | f
 Polska  | t
 Italia  | f
 Deutschland | f
 Danmark | f
 Australia   | f
(6 rows)


Jon



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