开发者

Radius Search on OpenGeoDb

开发者 https://www.devze.com 2023-03-22 00:23 出处:网络
I am working to create a database that contains all possible geographical coordinates and postal codes for locations inside Germany. I am making use of the OpenGeoDb project. I have setup the database

I am working to create a database that contains all possible geographical coordinates and postal codes for locations inside Germany. I am making use of the OpenGeoDb project. I have setup the database, and now I am trying to incorporate Radius search in it. The instructions for executing a radius search are available in the (German Language) OpenGeoDb wiki. I am trying to execute the given query but it gives me an error.

First I create a table in which the required data from the database is imported to:

CREATE TABLE `zip_coordinates` (开发者_StackOverflow社区
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
)

Then to import the data to the table zip_coordinate I use the following query:

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 name.loc_id = plz.loc_id
LEFT JOIN geodb_locations gl ON gl.loc_id = plz.loc_id
LEFT JOIN geodb_hierarchies as 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
  AND name.text_type =500100000
  AND tier.id_lvl1 = 104
  AND tier.id_lvl2 = 105 
  AND name.text_locale = "de" 
  AND (
        gl.loc_type =100600000
        OR 
        gl.loc_type =100700000
);

I get an error when I try to execute the above mentioned query that zc_lat can not be NULL. I still haven't figured out a way to get around this problem. Your help or advice would be much appreciated.


Had the same problem yesterday... It worked for me when i removed the conditions wich include "tier" cause this refers to a table wich is empty....

0

精彩评论

暂无评论...
验证码 换一张
取 消