[Talk-de] query in postgis osmosis
Frederik Ramm
frederik at remote.org
Di Apr 5 19:13:54 UTC 2016
Hi,
On 04/05/2016 08:22 PM, Tobias wrote:
> für eine andere Bäckerei:
> http://www.openstreetmap.org/way/369696958
> welche Direkt in Landshut liegt bekomme ich mit dem Query:
>
> SELECT DISTINCT area.osm_id, area.name, area.postal_code
> FROM planet_osm_polygon AS area JOIN planet_osm_polygon AS element ON
> ST_CONTAINS(area.way, element.way)
> WHERE element.osm_id = '369696958' AND (area.postal_code is not null OR
> area.boundary = 'administrative')
>
> folgendes Ergebnis:
> -62657;"Landkreis Landshut";""
> -3149176;"";"84030"
> -62484;"Landshut";""
>
> Die Relationen sollen imo ok sein.
Irgendwas ist da doch faul. Die Bäckerei 369696958 liegt in der
kreisfreien Stadt Landshut. Der Landkreis Landshut sollte also *nicht*
in dieser Liste oben stehen!
Die Bäckerei 142034442 aus Deiner anfänglichen Frage hingegen *liegt* im
Landkreis Landshut; dort hätte das -62657 also auftauchen müssen.
Teste mal dies:
osm=# select st_contains(a.way,b.way)
from planet_osm_polygon a, planet_osm_polygon b
where a.osm_id=-62657
and b.osm_id=369696958;
st_contains
-------------
f
(1 row)
osm=# select st_contains(a.way,b.way)
from planet_osm_polygon a, planet_osm_polygon b
where a.osm_id=-62657
and b.osm_id=142034442;
st_contains
-------------
t
(1 row)
So wäre es richtig. Wenn ich auf meiner Datenbank Deine Abfrage für die
369696958 mache, erhalte ich
osm_id | name | ?column?
----------+--------------+----------
-62484 | Landshut |
-2145268 | Bayern |
-17593 | Niederbayern |
-3149176 | | 84030
-51477 | Deutschland |
(5 rows)
und für die 142034442:
osm_id | name | ?column?
----------+--------------------+----------
-1113363 | | 84032
-190875 | Altdorf |
-2145268 | Bayern |
-62657 | Landkreis Landshut |
-17593 | Niederbayern |
-51477 | Deutschland |
(6 rows)
Wenn das bei Dir anders ist, würde ich mir vllt. mal die Polygone mit
QGis anschauen.
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00'09" E008°23'33"
Mehr Informationen über die Mailingliste Talk-de