[opengeodb] Liste von Koordinaten von PLZ eine Land/Ort

Mark Johnson mj10777 at googlemail.com
Mit Okt 3 08:52:39 CEST 2007


Unter Verwendung eine Beispiel SQL, habe ich versucht eine Liste alle PLZ
(mit deren Längen-/Breitengrad) eine Ort bzw. Land auszugeben. Die
Postleitzahl kommt raus aber die Koordinaten sind von der Ort/Land.

Beim durchsicht der DB, bin ich sicher das diese Werte pro PLZ vorhanden
sind, aber wie man die ansprechen kann ist mir noch unklar. Vermutlich durch
eine Unterabfrage auf der gefundene PLZ - aber mir ist zur zeit nicht klar
wie.

Sowas wie folgenes dürfte die richtige Richtung sein :

coord.loc_id = geodb_textdata.loc_id = 'WHERE
((geodb_textdata.text_type = 500300000) AND
(geodb_textdata.text_var = code.text_value))'

aber mir ist nicht klar warum (oder wie) man die loc_id der PLZ nicht holen
kann
um es in die 'coord.loc_id = code.loc_id' zu verwenden.

Irgendwas habe ich nicht richtig verstanden.

Hier die Sql die ich ausprobiert habe (1.) für den Land 'Berlin' ; 2.) für
den Stadt 'Berlin')

SELECT coord.loc_id as "id_Coord",
code.text_val as "PLZ",
town.text_val as "Ort",
land.text_val as "Land",
coord.lat as "Latitude",
coord.lon as "Longitude"
FROM geodb_hierarchies hi,
geodb_textdata land,
geodb_textdata town,
geodb_textdata code,
geodb_coordinates coord
WHERE hi.id_lvl3=land.loc_id AND
land.text_val='BE' AND
land.text_type=500100001 /* ISO 3166 */ AND
town.loc_id = hi.loc_id AND
town.text_type = 500100000 /* NAME */ AND
code.loc_id = town.loc_id AND
code.text_type = 500300000 /* AREA CODE */ AND
coord.loc_id = code.loc_id
ORDER BY 2


SELECT coord.loc_id as "id_Coord",
code.text_val as "PLZ",
town.text_val as "Ort",
coord.lat as "Latitude",
coord.lon as "Longitude"
FROM geodb_hierarchies hi,
geodb_textdata town,
geodb_textdata code,
geodb_coordinates coord
WHERE hi.id_lvl6=town.loc_id AND
town.text_val='Berlin' AND
town.text_type = 500100000 /* NAME */ AND
code.loc_id = hi.loc_id AND
code.text_type = 500300000 /* AREA CODE */ AND
coord.loc_id = code.loc_id
ORDER BY 2
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://lists.phpbar.de/pipermail/opengeodb/attachments/20071003/fcb5370c/attachment.html