Edward Betts
867e77ab7b
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.
28 lines
902 B
Python
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),
|
|
)
|