shurshur / pgaddr Goto Github PK
View Code? Open in Web Editor NEWSimple PostGIS address extration tool
Simple PostGIS address extration tool
Чего то не работает программка, не подскажите в чем может быть дело?
File "pgaddr.py", line 35
"""
^
SyntaxError: invalid syntax
Python 3.2.5
Hi, I populate database with next command:
osm2pgsql -c -s -S ./default.style --prefix=osm BY.osm.pbf
BY.osm.pbf
downloaded from gis-lab dump: http://gis-lab.info/projects/osm_dump/.
and then trying get addresses with your script where 59195 is Minsk city relation id:
./pgaddr.py -59195 > minsk.csv
but have next error:
Traceback (most recent call last):
File "./pgaddr.py", line 59, in <module>
cc.execute(q)
psycopg2.ProgrammingError: column a.tags does not exist
LINE 1: ..._Centroid(a.way)),ST_X(ST_Centroid(a.way)),a.name,a.tags->'a...
postgres log:
ERROR: column a.tags does not exist at character 99
STATEMENT: SELECT 'way',a.osm_id,ST_Y(ST_Centroid(MIN(a.way))),ST_X(ST_Centroid(MIN(a.way))),MIN(a.name),MIN(a.tags->'addr:postcode'),MIN(a.tags->'addr:region'),MIN(a.tags->'addr:district'),MIN(a.tags->'addr:city'),MIN(a.tags->'addr:street'),MIN(a."addr:housenumber"),ARRAY_AGG(c.admin_level || ':' || c.name) FROM osm_polygon a LEFT JOIN osm_polygon b ON ST_Within(a.way,b.way) LEFT JOIN osm_polygon c ON ST_Intersects(a.way,c.way) WHERE a."addr:housenumber" IS NOT NULL AND b.osm_id='-59195' AND c.admin_level IN ('2','4','5','6','7','8','9','10') GROUP BY a.osm_id UNION SELECT 'node',a.osm_id,ST_Y(MIN(a.way)),ST_X(MIN(a.way)),MIN(a.name),MIN(a.tags->'addr:postcode'),MIN(a.tags->'addr:region'),MIN(a.tags->'addr:district'),MIN(a.tags->'addr:city'),MIN(a.tags->'addr:street'),MIN(a."addr:housenumber"),ARRAY_AGG(c.admin_level || ':' || c.name) FROM osm_point a LEFT JOIN osm_polygon b ON ST_Within(a.way,b.way) LEFT JOIN osm_polygon c ON ST_Intersects(a.way,c.way) WHERE a."addr:housenumber" IS NOT NULL AND b.osm_id='-59195' AND c.admin_level IN ('2','4','5','6','7','8','9','10') GROUP BY a.osm_id
For osm_polygon
I have next scheme:
Table "public.osm_polygon"
Column | Type | Modifiers | Storage | Stats target | Description
--------------------+---------------------------+-----------+----------+--------------+-------------
osm_id | bigint | | plain | |
access | text | | extended | |
addr:housename | text | | extended | |
addr:housenumber | text | | extended | |
addr:interpolation | text | | extended | |
admin_level | text | | extended | |
aerialway | text | | extended | |
aeroway | text | | extended | |
amenity | text | | extended | |
area | text | | extended | |
barrier | text | | extended | |
bicycle | text | | extended | |
brand | text | | extended | |
bridge | text | | extended | |
boundary | text | | extended | |
building | text | | extended | |
construction | text | | extended | |
covered | text | | extended | |
culvert | text | | extended | |
cutting | text | | extended | |
denomination | text | | extended | |
disused | text | | extended | |
embankment | text | | extended | |
foot | text | | extended | |
generator:source | text | | extended | |
harbour | text | | extended | |
highway | text | | extended | |
historic | text | | extended | |
horse | text | | extended | |
intermittent | text | | extended | |
junction | text | | extended | |
landuse | text | | extended | |
layer | text | | extended | |
leisure | text | | extended | |
lock | text | | extended | |
man_made | text | | extended | |
military | text | | extended | |
motorcar | text | | extended | |
name | text | | extended | |
natural | text | | extended | |
office | text | | extended | |
oneway | text | | extended | |
operator | text | | extended | |
place | text | | extended | |
population | text | | extended | |
power | text | | extended | |
power_source | text | | extended | |
public_transport | text | | extended | |
railway | text | | extended | |
ref | text | | extended | |
religion | text | | extended | |
route | text | | extended | |
service | text | | extended | |
shop | text | | extended | |
sport | text | | extended | |
surface | text | | extended | |
toll | text | | extended | |
tourism | text | | extended | |
tower:type | text | | extended | |
tracktype | text | | extended | |
tunnel | text | | extended | |
water | text | | extended | |
waterway | text | | extended | |
wetland | text | | extended | |
width | text | | extended | |
wood | text | | extended | |
z_order | integer | | plain | |
way_area | real | | plain | |
way | geometry(Geometry,900913) | | main | |
Indexes:
"osm_polygon_index" gist (way)
"osm_polygon_pkey" btree (osm_id)
Has OIDs: no
So look like I have wrong scheme. But how I can populate database with your (GIS-LAB
) scheme? Or probably do I have this error because Belarus administrative levels a little different with Russian?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.