Hallo,
Ich habe die Datenbank mit Hilfe der Anleitungen auf der Webseite http://opengeodb.giswiki.org/wiki/Datenbank_erstellen gegebenen Menge. Derzeit arbeite ich an den Radius Suchfunktion an die Arbeit gehen, wie auf der Webseite . Ich habe den Tisch zip_coordinates erstellt. Aber ich bekomme eine Fehlermeldung, wenn ich versuche, die Daten zu importieren
zu dieser Tabelle, dass zc_lat und zc_lon sollen nicht NULL sein. Die Daten werden nicht korrekt importiert. Ich versuche, die folgende Abfrage ausführen:
INSERT INTO zip_coordinates (zc_loc_id, zc_zip, zc_location_name, zc_lat, zc_lon)
SELECT gl.loc_id, plz.text_val, name.text_val, coord.lat, coord.lon
VON geodb_textdata plz
LEFT JOIN geodb_textdata Namen ON name.loc_id = plz.loc_id
LEFT JOIN geodb_locations gl ON gl.loc_id = plz.loc_id
LEFT JOIN geodb_hierarchies als Tier-ON plz.loc_id = tier.loc_id / * localisierung * /
LEFT JOIN geodb_coordinates ON plz.loc_id = coord.loc_id coord
WHERE plz.text_type = 500300000 / * ID für Postleitzahl * /
UND name.text_type = 500100000 / * ID für Namen * /
UND tier.id_lvl1 = 104
UND tier.id_lvl2 = 105 / * Bundesrepublik Deutschland * /
UND name.text_locale = "de" / * deutschsprachige Version * /
AND (
gl.loc_type = 100600000 / * ID für pol. Gliederung * /
OR
gl.loc_type = 100700000 / * ID für Ortschaft * /
)
Kann jemand mir bitte helfen dieses Problem zu lösen? Ich für mein schlechtes Deutsch zu entschuldigen. Thousand Danke.
Grüße
Mustafa
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2013-01-30
Hi Mustafa,
I had the same error. If you inspect the result from running the SELECT statement alone, some rows contain zc_lat or zc_lon with NULL values.
A workaround was to eliminate these rows
INSERT INTO zip_coordinates (zc_loc_id, zc_zip, zc_location_name, zc_lat, zc_lon)
SELECT gl.loc_id, plz.text_val, name.text_val, coord.lat, coord.lon
FROM geodb_textdata plz
LEFT JOIN geodb_textdata name ON plz.loc_id = name.loc_id
LEFT JOIN geodb_locations gl ON plz.loc_id = gl.loc_id
LEFT JOIN geodb_hierarchies tier ON plz.loc_id = tier.loc_id
LEFT JOIN geodb_coordinates coord ON plz.loc_id = coord.loc_id
WHERE plz.text_type = 500300000 /* Postleitzahl */
AND name.text_type = 500100000 /* Name */
AND tier.id_lvl1 = 104
AND tier.id_lvl2 = 105 /* Bundesrepublik Deutschland */
AND name.text_locale = "de" /* deutschsprachige Version */
AND gl.loc_type IN ( 100600000 /* pol. Gliederung */, 100700000 /* Ortschaft */ )
AND (coord.lat IS NOT NULL || coord.lon IS NOT NULL);
btw:
Afterwards I ran into UTF-8 problems with the table zip_coordinates. So I dropped the table and re-created it using InnoDB and utf-8.
Error Message: Incorrect string value: '\xC2\x9Flar' for column 'zc_location_name' at row 1
Solution:
CREATE TABLE `zip_coordinates` (
zc_id INT NOT NULL auto_increment PRIMARY KEY,
zc_loc_id INT NOT NULL ,
zc_zip VARCHAR( 10 ) NOT NULL ,
zc_location_name VARCHAR( 255 ) NOT NULL ,
zc_lat DOUBLE NOT NULL ,
zc_lon DOUBLE NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8;
Cheers
jk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hallo,
Ich habe die Datenbank mit Hilfe der Anleitungen auf der Webseite http://opengeodb.giswiki.org/wiki/Datenbank_erstellen gegebenen Menge. Derzeit arbeite ich an den Radius Suchfunktion an die Arbeit gehen, wie auf der Webseite . Ich habe den Tisch zip_coordinates erstellt. Aber ich bekomme eine Fehlermeldung, wenn ich versuche, die Daten zu importieren
zu dieser Tabelle, dass zc_lat und zc_lon sollen nicht NULL sein. Die Daten werden nicht korrekt importiert. Ich versuche, die folgende Abfrage ausführen:
INSERT INTO zip_coordinates (zc_loc_id, zc_zip, zc_location_name, zc_lat, zc_lon)
SELECT gl.loc_id, plz.text_val, name.text_val, coord.lat, coord.lon
VON geodb_textdata plz
LEFT JOIN geodb_textdata Namen ON name.loc_id = plz.loc_id
LEFT JOIN geodb_locations gl ON gl.loc_id = plz.loc_id
LEFT JOIN geodb_hierarchies als Tier-ON plz.loc_id = tier.loc_id / * localisierung * /
LEFT JOIN geodb_coordinates ON plz.loc_id = coord.loc_id coord
WHERE plz.text_type = 500300000 / * ID für Postleitzahl * /
UND name.text_type = 500100000 / * ID für Namen * /
UND tier.id_lvl1 = 104
UND tier.id_lvl2 = 105 / * Bundesrepublik Deutschland * /
UND name.text_locale = "de" / * deutschsprachige Version * /
AND (
gl.loc_type = 100600000 / * ID für pol. Gliederung * /
OR
gl.loc_type = 100700000 / * ID für Ortschaft * /
)
Kann jemand mir bitte helfen dieses Problem zu lösen? Ich für mein schlechtes Deutsch zu entschuldigen. Thousand Danke.
Grüße
Mustafa
Hi Mustafa,
I had the same error. If you inspect the result from running the SELECT statement alone, some rows contain zc_lat or zc_lon with NULL values.
A workaround was to eliminate these rows
btw:
Afterwards I ran into UTF-8 problems with the table zip_coordinates. So I dropped the table and re-created it using InnoDB and utf-8.
Error Message: Incorrect string value: '\xC2\x9Flar' for column 'zc_location_name' at row 1
Solution:
Cheers
jk