[OSM-dev] mod_tile in other projections? (2018)

Stadtherr, Eric - US estadtherr at caci.com
Mon Oct 29 13:38:12 UTC 2018


Eduardo/Christoph,

I came across this issue when trying to get the Plate Carrée projection working correctly in mod_tile a couple years ago. To add support for a new projection, you would have to start by adding support for the new projection to get_projection() in src/gen_tile.cpp, which computes the projected x/y bounds based on the very specific proj4 projection string. If the aspect ratio isn't 1:1 like Web Mercator, the boundary computation in tile_translate() in src/mod_tile.cpp also requires attention.

Beyond that, modifying the mapnik.xml should theoretically take care of the rest.

Good luck!

--
Eric Stadtherr
BIT Systems, Inc.


________________________________________
From: Christoph Hormann <osm at imagico.de>
Sent: Friday, October 26, 2018 1:22 PM
To: dev at openstreetmap.org
Subject: Re: [OSM-dev] mod_tile in other projections? (2018)

On Friday 26 October 2018, Eduardo Ramalho wrote:
>
> Now I am trying to only show a country (Portugal)
> with its specific projection EPSG:3763.
>
> I changed the "mapnik.xml" to have my target "srs" and specific
> cartesian bounds, also changed renderd.conf to have aspectx=1 and
> aspecty=2,
> and finally removed all cached tiles.
>
> When I check the request url for /0/0/0.png I get a world view bitmap
> (but very distorced).
> I was expecting to get only the half north of Portugal on zoom level
> 0.

Something like this is to be expected.

Mapnik supports rendering in arbitrary projections but renderd and
mod_tile are likely hardcoded to Mercator and what you probably get is
your local coordinate system but rendered with the mercator bounds -
which of course does not make any sense.

For local coordinate systems there is no natural tile system so what
tile 0/0/0 shows exactly depends on the projection *and* the configured
bounds.  The bounds you define in mapnik are just the limits of the
area mapnik renders.  But mapnik does not know anything about tiling,
this is done by renderd.

The funny thing is that the tile manager could be completely projection
agnostic, it would not even need to know what projection the map is in,
it would just need to know the bounds of tile 0/0/0 in the desired
projection - and divide these bounds as needed to generate the
rendering requests for mapnik.

--
Christoph Hormann
http://www.imagico.de/

_______________________________________________
dev mailing list
dev at openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


More information about the dev mailing list