-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow easier modification of the OpenStreetMap-carto style #243
Conversation
…ure update process is setup correctly
This is based on the other PR I have, which improves the updating experience. |
run.sh
Outdated
@@ -75,13 +91,14 @@ if [ "$1" = "import" ]; then | |||
fi | |||
|
|||
# Import data | |||
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf ${OSM2PGSQL_EXTRA_ARGS:-} | |||
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/*.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/*.style /data.osm.pbf ${OSM2PGSQL_EXTRA_ARGS:-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if I have multiple styles/transform scripts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I designed this to assume there's only one style/transform script, or just take the first one.
In hindsight, I will make a variable but give it defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made improvements, now you can specify the style element names as necessary. See the readme
As general question: |
@dbahrdt Yeah, I think all PRs should use squash merges as a general rule. |
@dbahrdt Yea, I always do squash commits to keep main tidy. I expect the dev branches to be polluted with non-useful commits as it's not really helpful or necessary to have useful commits on the dev branches. |
@galewis2 . Ok thanks.
So I have to remove all data and re-run the |
run.sh
Outdated
exit 1 | ||
fi | ||
|
||
set -x | ||
|
||
if [ ! "$(ls -A /home/renderer/src/openstreetmap-carto)" ]; then | ||
|
||
git clone --single-branch --branch v5.3.1 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 /home/renderer/src/openstreetmap-carto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should include a copy of these files instead of downloading them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially as we are cloning this repo both on import
and on run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The lua script transforms the data during import. The indexes/views might be different which could lead to performance problems if the script is not rerun. |
exit 1 | ||
fi | ||
|
||
set -x | ||
|
||
if [ ! "$(ls -A /home/renderer/src/openstreetmap-carto)" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ ! -d /home/renderer/src/openstreetmap-carto ]; then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ ! "$(ls -A /home/renderer/src/openstreetmap-carto)" ]; then | |
if [ ! -d /home/renderer/src/openstreetmap-carto ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted this back as I need to confirm that openstreetmap-carto is empty, not just the directory exists (like you specify a bad path or something)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR!
I haven't setup custom styling myself yet, so my assessments may be off.
I think this could be further improved:
- README: Where can I find other styles? (Just one other example would already be great)
- better support lack of lua script: e.g. https://github.com/cyclosm/cyclosm-cartocss-style doesn't have a lua script and
--tag-transform-script
is optional - Better support for multiple SQL scripts e.g.: https://github.com/OpenRailwayMap/OpenRailwayMap-CartoCSS/blob/master/SETUP.md has three SQL scripts that need to be executed in order
I am a big fan of incremental improvement, so maybe we can mark this as "beta"/experimental or something in the README and include 1-2 styles that are known to work and then merge it?
Co-authored-by: Robin C. Ladiges <Istador@users.noreply.github.com>
I specifically for now targeted this PR to make it easier to modify the existing OpenStreetMap Carto style with small changes, with small in place changes like labelling, colors, etc. I did add a comment in the readme that openstreetmap-carto and styles like that are supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for taking another 3 days for reapproval
Now, the style isn't built into the image, but is now either hosted in a volume/local directory or worse case, fetched at runtime.
It uses a wildcard to find critical style elements (like index.sql, lua file, etc) so there's some uncontrolled flexibility in different file names.Would replace #42 and #97
Still need to add some documentation, but here's the existing work.