aresta / OSM_Extract

Extract OSM features in a configurable way to files to be used in other projects
GNU General Public License v3.0
4 stars 2 forks source link

How can i get the maps data? #2

Closed zhjygit closed 2 months ago

zhjygit commented 6 months ago

I have compiled the esp32_gps project on my esp32s3-lcd 4.3 device. But i don't know how to use the osm_extract code to get the files. Can you give some details to get the files,and then save them to SD card. Thanks a lot.

aresta commented 6 months ago

Hello, I have to document it better, it's still work in progress. It's a manual process for the moment. To generate the map files first you have to download the openstreetmap PBF file of your country or area, for example from here: https://download.geofabrik.de/ put the PBF file in the /pbf folder.

Then you have to clip the PBF file into a PBF of a smaller area, for performance as the initial PBF is very big: First define your smaller area here: /conf/clip_area.geojson You can adjust it manually, it's just a rectangle with lat/lon coordinates. Or you can use this web tool to generate the rectangle over the map: http://geojson.io/ Then: /maps/osmium extract --strategy=smart -p ../conf/clip_area.geojson /pbf/big-file.osm.pbf -o /pbf/clipped.pbf To do this you need osmium. Or better if you have docker just launch the docker container, it has all the tools and libraries needed.

Then you should have the smaller area PBF file: /pbf/clipped.pbf Next step is to extract the lines and polygons from the PBF file, with the script: /scripts/pbf_to_geojson.sh It will generate 2 files: /maps/polygons.geojson and /maps/lines.geojson

And the last step is to execute: /scripts/extract_features.py to generate all the map files, you have to copy them to the SD card.

This is a work in progress but with some adjustments and testing should work in your system. I'm now also moving to ESP32-S3, I'll update the code, it should be just change the GPIO pin numbers and maybe adjust some library settings. I hope it helps. Let me know if you have problems or find errors.

zhjygit commented 6 months ago

Ok, thanks sir, I will try and feedback my practice on the esp32s3 board.

aresta commented 6 months ago

Make sure that the file: clip_area.geojson has the correct format, like the example one in the /conf folder.

secret-agent313 commented 5 months ago

Hello,Where do I enter this? /maps/osmium extract --strategy=smart -p ../conf/clip_area.geojson /pbf/big-file.osm.pbf -o /pbf/clipped.pbf

zhjygit commented 5 months ago

you have to prepare for the environment for osm_extract. via docker according to the dockfile; or you can prepare the environment in ubuntu 18.04 by yourself according to the command in the dockfile. if you finished the environment, then, all of the command or python scripts in this project can be executed, such as "osmium extract --strategy=smart -p ../conf/clip_area.geojson /pbf/big-file.osm.pbf -o /pbf/clipped.pbf" after "cd to maps/" Maybe there are some errors in the python scripts, you can correct via the errors promption.

secret-agent313 commented 4 months ago

Do you have a tutorial video? After using the scripts/pbf_to_geojson.sh file, a message appears in cmd, but nothing is generated This part is executed: if [ $# -eq 0 ]; then echo " No arguments provided." echo " Usage:" echo " $0 " echo "" exit 1

aresta commented 2 months ago

Hi, I have added a brief explanation and example in the README. It is still a manual and not very convenient system, still work in progress. Try and ask here if you have questions or problems.