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.
This commit is contained in:
parent
8b7ab45c73
commit
867e77ab7b
3 changed files with 292 additions and 135 deletions
27
matcher/planet.py
Normal file
27
matcher/planet.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue