owl-map/matcher/planet.py
Edward Betts 867e77ab7b Switch to SQLAlchemy Core for OSM objects
osm2pgsql creates tables without primary keys. Some OSM objects are
split into multiple table rows to help with PostGIS index performance.

Adjust the code to be aware of this.

Also add name matching for streets.
2021-07-22 14:47:38 +02:00

28 lines
902 B
Python

from sqlalchemy import Table, Column, Integer, String, Float, MetaData
from sqlalchemy.dialects import postgresql
from geoalchemy2 import Geometry
metadata = MetaData()
point = Table("planet_osm_point", metadata,
Column("osm_id", Integer),
Column("name", String),
Column("tags", postgresql.HSTORE),
Column("way", Geometry("GEOMETRY", srid=4326, spatial_index=True), nullable=False),
)
line = Table("planet_osm_line", metadata,
Column("osm_id", Integer),
Column("name", String),
Column("tags", postgresql.HSTORE),
Column("way", Geometry("GEOMETRY", srid=4326, spatial_index=True), nullable=False),
)
polygon = Table("planet_osm_polygon", metadata,
Column("osm_id", Integer),
Column("name", String),
Column("tags", postgresql.HSTORE),
Column("way", Geometry("GEOMETRY", srid=4326, spatial_index=True), nullable=False),
Column("way_area", Float),
)