Geographic Information Systems Asked by mad_a_i on July 25, 2021
What I have done so far is creating a PostGIS database with the OSM world data which was successful and viewable via QGIS.
I imported the data via osm2pgsql -U USER -W -d gis -H 127.0.0.1 --number-processes 24 -C 2048 osm_world.pbf --hstore
Even after extensive research I could not figure out a way to achieve to get what I said in the title.
Is some postprocessing of the OSM data necessary?
If you want to use only the building in a radius of a point location then the best will be to first filter osm data and then store it in a postgresql database.
To process osm pbf data, there are different tools available.
For your goal, I think the best will be to use osmconvert
. Here is the documentation link. You can not set a point and radius but can get the same either setting a bounding box with -b
argument or a polygon stored in a poly file with -B
argument.
osmconvert.exe germany.pbf --max-objects=1000000000 --hash-memory=1000 --max-refs=4000000 -b=10.5,49,11.5,50 -o=nuernberg.osm -v=2
The line of code based on the example from the documentation and adapted to work with large files in Windows environment(max object
max refs
or hash memory
parameters have to be set).
Then you have to keep only the buildings, you can use osmfilter
and keep every OSM object that have at least a building key. In the documentation there are many options you can use to drop or keep OSM objects.
osmfilter.exe nuernberg.osm --keep="building=" -o=building.osm --verbose
I think your code used before will work and will be processed faster :
osm2pgsql -U USER -W -d gis -H 127.0.0.1 --number-processes 24 -C 2048 building.osm --hstore
Correct answer by Corentin Lemaitre on July 25, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP