Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Rendering tiles with English labels when they are available #18

Closed
EricG-Personal opened this issue Sep 4, 2019 · 11 comments
Closed

Rendering tiles with English labels when they are available #18

EricG-Personal opened this issue Sep 4, 2019 · 11 comments

Comments

@EricG-Personal
Copy link

This is related to gravitystorm/openstreetmap-carto#3870 and someone in that issue pointed me here.

I setup my own mapping tile server according to the instructions found at https://switch2osm.org/manually-buildin … 18-04-lts/ (amazing job for whoever wrote them) and am using the planet data (https://planet.openstreetmap.org). However, when I render a tile in, for example, China (http://localhost/hot/7/106/53.png / https://a.tile.openstreetmap.org/7/106/53.png)), the labels are in Chinese characters.

As I understand it, this project can assist me in getting english only labels, but I am not exactly sure how it fits in with the rest of the system.

Is it intended to be a drop-in replacement for apt install mapnik-utils python-mapnik ?

What changes would need to be made to the instructions for setting up a tile server to integrate this project and specify English only labels?

Or, have I misunderstood something?

@giggls
Copy link
Owner

giggls commented Sep 4, 2019

Well, this issue is at least twofold:

  1. Yes, you can use the code from this repository to get latin names instead of generic multi language name tags.
    See the slides and videos of my talks in the Wiki of this repository for details.
  2. You need a slightly patched version of carto style:
    https://github.com/giggls/openstreetmap-carto-de/tree/upstream+l10n
  3. Finally make sure, that your database has all needed additional name tags. The most easy was to do this is by using hstore-only.style from German style for osm2pgsql.

Basically the difference between the German style master branch and the upstream+l10n branch is that the former also includes style changes (road-colors, icons, etc.) common in Germany and the latter is about name tags only.

As a live example for such a setup see the tileserver at Fraunhofer IOSB which has both:
German Style (with english labels) and l10n-only.

@giggls
Copy link
Owner

giggls commented Sep 4, 2019

https://github.com/giggls/openstreetmap-carto-de/blob/master/INSTALL-de.md is likely what you are looking for :)

@EricG-Personal
Copy link
Author

https://github.com/giggls/openstreetmap-carto-de/blob/master/INSTALL-de.md is likely what you are looking for :)

Unfortunately, it is difficult for me to figure out how to apply those instructions in the context of the default instructions for setting up a tile server. I am looking at the slides and video mention on the wiki to try to better understand the context.

@EricG-Personal
Copy link
Author

https://github.com/giggls/openstreetmap-carto-de/blob/master/INSTALL-de.md is likely what you are looking for :)

If I am understanding the system correctly, the basic idea is that I follow the default instructions for setting up a tile server, using osm2pgsql to import the pbf data into a postgres db. Once the db has been created, your project is designed to modify the database and provide a translation layer through the use of db views which have names that mapnik and renderd expect.

Is this correct?

@giggls
Copy link
Owner

giggls commented Sep 4, 2019

You can either use the osm2pgsql style from German style ore the one from upstream carto.
German osm2pgsql style is compatible to upstream using views instead of tables thus I would recommend using this one. If you are using upstream schema you need to use the views provided in contrib directory.

@EricG-Personal
Copy link
Author

I am still trying to get your project integrated with the standard tile server.

$ git clone https://github.com/giggls/openstreetmap-carto-de.git

  $ git checkout upstream+l10n

  Branch 'upstream+l10n' set up to track remote branch 'upstream+l10n' from 'origin'.
  Switched to a new branch 'upstream+l10n'

  $ carto project.mml > mapnik.xml

I do get a lot of warnings here...not sure if they are relevant

Warning: landcover.mss:596:4 line-offset is unstable. It may change in the future.
 ...
 ...
 ...
 Warning: landcover.mss:513:29 Styles do not match layer selector #landcover-low-zoom.
 Warning: landcover.mss:512:29 Styles do not match layer selector #landcover-low-zoom.
 Warning: landcover.mss:512:29 Styles do not match layer selector #landcover.
 ...
 ...
 ...
 Warning: landcover.mss:556:27 Styles do not match layer selector #landcover-low-zoom.
 Warning: landcover.mss:511:8 Styles do not match layer selector #landcover-low-zoom.
 Warning: landcover.mss:511:8 Styles do not match layer selector #landcover.
 ...
 ...
 ...
 Warning: amenity-points.mss:1800:4 Styles do not match layer selector .text-low-zoom.
 Warning: amenity-points.mss:1773:4 Styles do not match layer selector .text-low-zoom.
 Warning: admin.mss:115:6 Styles do not match layer selector #admin-low-zoom.

 $ scripts/get-shapefiles.py

everything worked without any errors or warnings reported.

Needed to get the hstore-only.style from the master branch


    $ git checkout master
    $ cp hstore-only.style ~/Desktop/hstore-only.style
    $ git checkout upstream+l10n

I changed renderd.conf to:


    $ cat /usr/local/etc/renderd.conf

    [renderd]
    num_threads=4
    tile_dir=/var/lib/mod_tile
    stats_file=/var/run/renderd/renderd.stats

    [mapnik]
    plugins_dir=/usr/lib/mapnik/3.0/input
    font_dir=/usr/share/fonts/truetype
    font_dir_recurse=1

    [ajt]
    URI=/hot/
    TILEDIR=/var/lib/mod_tile
    XML=/home/renderaccount/src/openstreetmap-carto-de/mapnik.xml
    HOST=localhost
    TILESIZE=256
    MAXZOOM=20
    CORS=*


    $ sudo service renderd restart

I made sure to clear the Google Chrome cache and remove all cached images from /var/lib/mod_tile.

I then visited:

http://localhost/hot/8/159/104.png

But, it will not render.

I have tried:


    $ osm2pgsql -d gis --create --slim --drop --flat-nodes /home/renderaccount/Desktop/nodes.cache -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -S ~/src/openstreetmap-carto/openstreetmap-carto.style ~/Desktop/iraq-latest.osm.pbf

and

    $ osm2pgsql -d gis --create --slim --drop --flat-nodes /home/renderaccount/Desktop/nodes.cache -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -S ~/Desktop/hstore-only.style  ~/Desktop/iraq-latest.osm.pbf

after grabbing hstore-only.style from the master branch of openstreetmap-carto-de

The checks for mapnik-german-l10n all pass:


    $ sudo -u postgres -i
    [sudo] password for renderaccount:
    postgres@ubuntu:~$ psql
    psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
    Type "help" for help.

    postgres=# \c gis
    You are now connected to database "gis" as user "postgres".
    gis=# select osml10n_translit('北京');
     osml10n_translit
    ------------------
     běi jīng
    (1 row)

    gis=# select osml10n_kanji_transcript('漢字');
     osml10n_kanji_transcript
    --------------------------
     kanji
    (1 row)

    gis=# select osml10n_thai_transcript('ถนนข้าวสาร');
     osml10n_thai_transcript
    -------------------------
     thnn khaotan
    (1 row)

    $ ./tests/runtests_in_virtualenv.sh

    ...
    ...
    ...
    32 tests passed 0 tests failed.
    Dropping cluster 10/regress ...

Any idea what I might be missing?

@giggls
Copy link
Owner

giggls commented Sep 6, 2019

This is definitely off-topic here!

If you think you have an issue with https://github.com/giggls/openstreetmap-carto-de open an issue there. Please read https://github.com/giggls/openstreetmap-carto-de/blob/master/INSTALL-de.md before opening issues. You may also try using render_single_tile.py and make to see if this works before trying to use this in a full blown rendering stack. Carto warnings are harmless.

This is not a support forum but an issue tracker. Up till now I have seen zero issues in my code just questions which answers are already documented.

@giggls giggls closed this as completed Sep 6, 2019
@EricG-Personal
Copy link
Author

understood. When I figure out how to make use of your project to render English labels, I can let you know if you like and you could provide it to others so they can use it for the same purpose.

Thank you for your assistance.

@giggls
Copy link
Owner

giggls commented Sep 6, 2019

It is documented how to do this and it works fine not just for me but for a couple of people.
If there really is documentation missing please send a pull request! For me it looks like you did not apply the views to your database and this is way beyond being an issue but something documented in https://github.com/giggls/openstreetmap-carto-de/blob/master/INSTALL-de.md

@giggls
Copy link
Owner

giggls commented Sep 6, 2019

BTW you may also have a look at this issue:
giggls/openstreetmap-carto-de#35

I really do not like it very much to explain the same stuff over and over again.

@EricG-Personal
Copy link
Author

EricG-Personal commented Sep 6, 2019

Again, I do not wish to bother you further as you made it clear this is not a support forum.

Thank you for your assistance. When I come up with a clear set of instructions for how to integrate this work with setting up the default tile server I will certainly share them with you.

It does seem as if various bits and pieces are spread around and I will see what I can do to pull them together so no one has to again explain things over and over which I know can be very annoying.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants