I'm setting up a tile server using the guide provided here.

I have everything set up. proj4 is installed in version 4.8.0. The espg file is existant, I ran an xmllint over my xml style file without errors. mod_tile is also running without problems. I also have a fully populated PostGIS database running. I used osm2pgsql.

The problem is starting renderd. It gives me the following error message:

renderd[25257]: An error occurred while loading the map layer 'default': 
failed to initialize projection with: '+init=epsg:4326'  
encountered during parsing of layer 'necountries' in Layer at 
line 58 of '/src/mapnik-style/osm.xml'

(I inserted line breaks for legibility)

It's the only error message. Everything else works fine.

I checked for the espg file at /usr/local/share/proj/epsg which is present and contains (of course) the WGS84 definition.

I googled around but couldn't find something. There were hints to the proj4 library. But since it's installed in version 4.8.0, i can't see the problem.

Thanks for the help!

  • What if you omit the plus sign and use instead "init=epsg:4326" – nmtoken Apr 2 '14 at 15:14
  • I don't even specify it, all I do in the settings.xml.inc (as part of the provided stylesheet) is the following: <!ENTITY osm2pgsql_projection "&srs4326;">. I think the parser just inserts it. Because at the mentioned line 58 (see above) is no projection specified... – Johnny Cusack Apr 2 '14 at 15:19
  • Do you get any result if you open a terminal window and type proj – nmtoken Apr 2 '14 at 16:11
  • Yes it's showing: Rel. 4.9.0, 27 October 2013 and the command types. As I said it's all set up. There seems to be a problem with the SRS declaration. The original WGS84 one is: +init=epsg:4326. If i change it to the one specified here +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs i get the following error: Unknown projection string, using web mercator as never the less. +proj=longlat +ellps=WGS84 +d... . So there seems to be an problem – Johnny Cusack Apr 2 '14 at 16:21
  • You could also try searching help.openstreetmap.org for renderd-tagged questions: help.openstreetmap.org/search/?q=[renderd] , but I have not found anything related to your problem there. Maybe there is more debugging help hidden in the answers there somewhere. – til_b Jan 12 '16 at 15:05

I fix the same issue on CentOS machine by installing proj-epsg package.

Your issue may have something to do with projection definitions defined in the stylesheet using XML entities.

I stumbled across your question while troubleshooting a cascade of issues encountered in an attempt to upgrade from Mapnik 2.2 to 3.x, as inquired upon here.

Anyway in my quest, I eventually got Apache errors like this:

mapnik failed to initialize projection with: '&google_mercator;'

And in troubleshooting that, I eventually found my way to a. few. different. links. that collectively explain how some versions of Mapnik have different XML handling with respect to "entities".

My understanding is that self-built Mapnik are less likely to support entities, whereas some Mapnik installed from turnkey packages/binaries (?) do support entities, if they have been built with libxml2 support....which is apparently not a reliable functionality. See here for this person's explanation.

In my case, I was able to work around this by changing how my "Map" nodes and their "srs" attributes were established by switching my XML style sheets from nodes like this:

<!DOCTYPE Map [<!ENTITY google_mercator "+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">]>
<Map srs="&google_mercator;">
 ...

..to using nodes like this:

<!DOCTYPE Map>
<Map srs="+init=epsg:3857">
 ...

My guess is there must be a popular "getting started" approach or tutorial out there (maybe the one you linked!) that instructs people toward using a fragile/unpreferred solution for setting projections, which doesn't play well with all installations of Mapnik. I must have encountered it too somewhere along the way.

I'm sure this insight is too late to be of use to you, but hopefully it proves helpful to someone else downstream.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.