[Taginfo-dev] Getting matching maps on Taginfo gb

Shaun McDonald shaun at shaunmcdonald.me.uk
Sat Apr 20 09:19:37 UTC 2019


Hi,


I’m trying to get the background map to match the Taginfo generated map for the GB Taginfo. I seem to be missing something from the instructions on the OSM wiki, as the background maps. With an earlier version I was getting too much included vertically.

https://wiki.openstreetmap.org/wiki/Taginfo/Installation#Adapting_the_map_view

My working is in https://docs.google.com/spreadsheets/d/1rnO5jqZAirsFankimavetobulNE2f5MJi4Z0PA8h0Dc/edit?usp=sharing

I’ve followed https://switch2osm.org/manually-building-a-tile-server-18-04-lts/ to produce a map DB.

Map image script:
cat create_taginfo_map.py
import mapnik

m=mapnik.Map(330,345)
mapnik.load_map(m, 'openstreetmap-carto/taginfo_outline.xml')

bbox = mapnik.Box2d(-9,49.8,2.5,60.8)
m.zoom_to_box(bbox)

im = mapnik.Image(330,345)
mapnik.render(m,im)
im.save('gb_map.png', 'png256’)

The highway map is a good example showing the issue:
https://taginfo.openstreetmap.org.uk/keys/highway#map 

head openstreetmap-carto/taginfo_outline.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map background-color="#f2efe9" buffer-size="0" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
 <Parameters>
   <Parameter name="scale">1</Parameter>
   <Parameter name="metatile">2</Parameter>
   <Parameter name="name"><![CDATA[OpenStreetMap Carto]]></Parameter>
   <Parameter name="description"><![CDATA[A general-purpose OpenStreetMap mapnik style, in CartoCSS]]></Parameter>
   <Parameter name="bounds">-180,-85.05112877980659,180,85.05112877980659</Parameter>
   <Parameter name="center">0,0,4</Parameter>


Taginfo config segment:
   // For the geodistribution map. See the wiki documentation about these settings.
   "geodistribution": {
       "left": -9,
       "bottom": 49.8,
       "right": 2.5,
       "top": 60.8,
       "width": 345,
       "height": 330,
       "scale_image": 1,
       "scale_compare_image" : 1,
       //"background_image": "/img/mapbg/world.png",
       "background_image": "/img/mapbg/gb_map.png",
       // optional attribution for base image, will show up below all maps
       "image_attribution": ""
   },

I can’t quite figure out what I’m doing wrong to get the maps to line up correctly while following the instructions on the wiki. I’m so close now. Would anyone be able to provide some pointers on how to fix?

Shaun




More information about the Taginfo-dev mailing list