Newer
Older
osmCoverage / src / t_BUSSTOP.sql
---<< postgis: postgres >>---
db_driver=org.postgresql.Driver
db_url=jdbc:postgresql://surveyor.mydns.jp:5432/gisdb
db_user=gisuser
db_passwd=gisuser
-------------------------
CREATE TABLE t_busstop (
        gid SERIAL PRIMARY KEY,
        gmlid text,
        name text,
        fixed integer,
        area integer,
        geom GEOMETRY(POINT, 4612)
);
CREATE INDEX ix_busstop_geom ON t_busstop USING GiST (geom);

insert into t_busstop(osm_id,name,geom) select osm_id, st_transform(way,4612) FROM planet_osm_point WHERE (highway='bus_stop');
insert into t_busstop(osm_id,name,geom) VALUES(884, 'なまえ', ST_GeomFromText('POINT(139.4110836 35.4341053)', 4612));

----
CREATE TABLE t_test (
	gid SERIAL PRIMARY KEY,
	osm_id bigint,
	name text,
	geom GEOMETRY(POINT, 4612)
);

CREATE INDEX ix_test_geom ON t_test USING GiST (geom);

insert into t_test(osm_id,name,geom) VALUES(884, 'なまえ', ST_GeomFromText('POINT(139.4110836 35.4341053)', 4612));

----
GRANT SELECT ON t_BUSSTOP TO gisuser;

---<< database: hsqldb >>---
CREATE TABLE bus_stop (
    gmlid VARCHAR(12) NOT NULL, 
    name VARCHAR(128), 
    lat DOUBLE, 
    lon DOUBLE, 
    fixed INT, 
    fixed1 INT,
    area INT, 
    ifile VARCHAR(128), 
    up INT, 
    CONSTRAINT bus_stop_pk PRIMARY KEY(gmlid,area));
CREATE INDEX bus_stop_index ON bus_stop(lat,lon);
SELECT gmlid,name,lat,lon,fixed1,area FROM bus_stop;

CREATE TABLE OSM_EXIST (
    osmid VARCHAR(12) NOT NULL, 
    name VARCHAR(128), 
    lat DOUBLE, 
    lon DOUBLE, 
    score INT, 
    CONSTRAINT existing_pk PRIMARY KEY(osmid, lat, lon));

CREATE TABLE coverage (
    area INT, 
    name VARCHAR(128), 
    denominator BIGINT, 
    lv1 BIGINT, 
    lv2 BIGINT, 
    lv3 BIGINT);

-------------------------