This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

getting “Unknown projection string error” serving EPSG:4326 tiles with open street maps mapnik renderd

0

The goal:

I am attempting to generate map tiles with EPSG:4326 instead of web mercator by specifying EPSG:4326 in the mapnik style file srs attributes


My current setup:


I am running Ubuntu 14.14 LTS and have followed the switch2osm.org manually-building-a-tile-server-14-04 instructions. Using the default projection, I was able to successfully import data and serve tiles to a client. I am using the stack of osm2pgsql, renderd, mapnik, mod_tile, apache, postgres, and the OSM Bright stylesheet.

To import I used:

osm2pgsql --slim -d gis -C 16000 --number-processes 3 mapdata.osm.pbf

Then to run renderd:

sudo -u mapnik renderd -f -c /usr/local/etc/renderd.conf

At this point, I had everything working to serve up web mercator.


Attempting to serve tiles in EPSG:4326:


First I reimported the data with osm2pgsql using the -l flag:

osm2pgsql  -l --slim -d gis -C 16000 --number-processes 3 mapdata.osm.pbf

I then updated the mapnik stylesheet map and layer srs attributes to match what was defined in http://spatialreference.org/ref/epsg/4326/mapnik/

srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"

When starting renderd I will then receive the error:

"Unknown projection string, using web mercator as never the less.
 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"

I also attempted a few other options:

srs="+init=epsg:4326"

srs="+proj=longlat +datum=WGS84 +no_defs"

After seeing a post recommending to check if proj-epsg package is installed, I was heading down the path that proj was missing on my system (https://github.com/mapnik/mapnik/wiki/InstallationTroubleshooting#proj_init_error)

Per this proj init error guide I reinstalled proj to no effect.

I confirmed I do have it:

~$ proj
Rel. 4.8.0, 6 March 2012
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

I have checked my /usr/share/proj/epsg file and it contains an entry:

# WGS 84
<4326> +proj=longlat +datum=WGS84 +no_defs  <>

The guide shows a different path to /usr/local/share/proj/epsg. On my system it is /usr/share/proj/epsg


Questions:


Do I need to configure mapnik or renderd somehow to be able to use proj?

Is my proj epsg file in an atypical location?

Is there any other information that would be useful?

Also, are there any other methods I could attempt to use to get finer debugging?


Some of the configuration files:


renderd.conf:

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


[mapnik]
plugins_dir=/usr/local/lib/mapnik/input
font_dir=/usr/share/fonts/truetype/ttf-dejavu
font_dir_recurse=1

[default]
URI=/osm_tiles/
TILEDIR=/var/lib/mod_tile
XML=/usr/local/share/maps/style/OSMBright/OSMBright.xml
HOST=localhost
TILESIZE=256

problem snippet EPSG:4326 version of mapnik OSMBright.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=longlat +datum=WGS84 +no_defs" 
font-directory="./fonts" background-color="#c4dff6"
maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">

working snippet web mercator version of mapnik OSMBright.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" 
font-directory="./fonts" background-color="#c4dff6"
maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">

Thanks for any thoughts.

asked 29 Apr '16, 19:49

jsitarski's gravatar image

jsitarski
11112
accept rate: 0%

I am struggling with the same problem, and do not want to use MapProxy. Did you find a solution?

(30 Jun '23, 09:55) Kcok

Source code available on GitHub .