[OSM-talk] Mysterious PostGIS Problem with Polygons
Jon Burgess
jburgess777 at googlemail.com
Fri Aug 21 18:34:46 BST 2009
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
More information about the talk
mailing list