Re: [OSM-dev] mod_tile in other projections? (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 Sent: Friday, October 26, 2018 1:22 PM To: dev@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@openstreetmap.org https://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org https://lists.openstreetmap.org/listinfo/dev
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@openstreetmap.org https://lists.openstreetmap.org/listinfo/dev
[OSM-dev] mod_tile in other projections? (2018)
Hi! Does mod_tile/renderd/mapnik support generating tiles for other projections ? I successful built a local OSM tile server, from web instructions (based on mapnik+renderd+mod_tile). I can see the result on a browser with leaflet. 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. I found an old post (2013) on this subject "mod_tile in other projections". I interpreted that it was possible to have tiles on different projections, but we had to edit source code. Does anyone knows if is still the case ? Does mod_tile/renderd/mapnik support generating tiles for other projections ? Regards, Eduardo ___ dev mailing list dev@openstreetmap.org https://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
Hi Kai, Thanks very much for those fixes. The tiles seem to look good. I had to cloak the tile calls behind a TMS protocol and specify the resolutions per zoom level in OpenLayers + make up for the top-left (OSM tiles) vs bottom-left (TMS tiles) tile naming scheme. The only issue I see now is the requirement to have certain map scales for certain zoom levels. I guess Mod_tile simply halves it on each successive zoom level (standard for OSM/Goolge tiles) which it works out from the projection config settings but in my case, I'd like to have some zoom levels which are not exactly half (maybe provided in an array?). Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
Hi, There were a couple of issues with the projection code in mod_tile and renderd which I have now hopefully fixed. Renderd was calculating the projected coordinates wrongly for the Y axis. This wasn't noticeable for the standard projection, as its bounds are symmetric around zero. This bug is now fixed. In Mod_tile you couldn't configure the aspect ratio of the tile layer, and so the aspect ratio of 2x1 was considered out of bounds and returned 404 without getting the requests to renderd. In renderd.conf you can now specify ASPECTX and ASPECTY which mod_tile will read to configure that correct bounds checks. Finally you need prj-bound_y1 = 140. The ratio of projected x coodinates to projected y coordinates need to be integer, as otherwise the projected coordiates that mod_tile / renderd assume and what mapnik actually renders are different and you get projection missmatches at the metatile boundaries. I have now checked in the changes and the parameters for the BNG projection. I think everything is working, but I couldn't get OpenLayers to do the expected thing in the BNG projection and the tile numbers it requests don't quite match up. So I couldn't verify that things do work. So please let me know if anything else is broken, Kai On 08/15/2013 05:23 AM, Jason Lee wrote: Hi, I downloaded the latest mod_tile source code with the projections support and manually added a BNG projection config in gen_tile.cpp as follows:- == else if (strcmp(srs, +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=40 +y_0=-10 +ellps=airy +datum=OSGB36 +units=m +no_defs) == 0) { syslog(LOG_DEBUG, Using bng projection settings); prj = (struct projectionconfig *)malloc(sizeof(struct projectionconfig)); prj-bound_x0 = 0.0; prj-bound_y0 = 0.0; prj-bound_x1 = 70.0; prj-bound_y1 = 130.0; prj-aspect_x = 1; prj-aspect_y = 2; } == This doesn't give me the expected map when I view the top tile 0/0/0.png it just shows the bottom southwest tip of GB. I am trying to replicate the same top map tiles as OSM-GB project's given here:- http://lgosmgb2.nottingham.ac.uk:8080/geoserver/gwc/service/tms/1.0.0/OSM-GB:__all__@EPSG:27700@png/0/0/0.png http://lgosmgb2.nottingham.ac.uk:8080/geoserver/gwc/service/tms/1.0.0/OSM-GB:__all__@EPSG:27700@png/0/0/1.png ..but my mod_tile returns a 404 for tile 0/0/1.png - is it because it always expects 1 top tile at zoom 0? On 2 April 2013 12:36, Jason Lee jaslee...@gmail.com mailto:jaslee...@gmail.com wrote: Kai and all other respondents, This is great response to my query and I will definitely continue to look into using the latest mod_tile/renderd code to work - in my specific case - with British National Grid projection, 27700. Jason On 26 March 2013 04:44, Kai Krueger kakrue...@gmail.com mailto:kakrue...@gmail.com wrote: On 03/07/2013 08:36 AM, Jason Lee wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? In case you are still interested, I have now refactored the code a bit to make it easier to support different projections. Supporting new projections now should be as simple as adding 6 numbers, (the boundaries in projected coordinates and the map aspect ratio). For the moment you still need to recompile renderd after changing / adding those numbers, but in the future that might change. At the moment it supports spherical mercator and plate carree out of the box and they can be mixed in the same rendering server. You configure those by changing the srs of the mapnik style sheet to the appropriate values. Also it is now possible to configure the size of the tiles in renderd.conf and it is no longer hard coded to be 256 px. (You still need to change the mapnik stylesheet for the appropriate PPI though). Kai The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
Hi, I downloaded the latest mod_tile source code with the projections support and manually added a BNG projection config in gen_tile.cpp as follows:- == else if (strcmp(srs, +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=40 +y_0=-10 +ellps=airy +datum=OSGB36 +units=m +no_defs) == 0) { syslog(LOG_DEBUG, Using bng projection settings); prj = (struct projectionconfig *)malloc(sizeof(struct projectionconfig)); prj-bound_x0 = 0.0; prj-bound_y0 = 0.0; prj-bound_x1 = 70.0; prj-bound_y1 = 130.0; prj-aspect_x = 1; prj-aspect_y = 2; } == This doesn't give me the expected map when I view the top tile 0/0/0.png it just shows the bottom southwest tip of GB. I am trying to replicate the same top map tiles as OSM-GB project's given here:- http://lgosmgb2.nottingham.ac.uk:8080/geoserver/gwc/service/tms/1.0.0/OSM-GB:__all__@EPSG:27700@png/0/0/0.png http://lgosmgb2.nottingham.ac.uk:8080/geoserver/gwc/service/tms/1.0.0/OSM-GB:__all__@EPSG:27700@png/0/0/1.png ..but my mod_tile returns a 404 for tile 0/0/1.png - is it because it always expects 1 top tile at zoom 0? On 2 April 2013 12:36, Jason Lee jaslee...@gmail.com wrote: Kai and all other respondents, This is great response to my query and I will definitely continue to look into using the latest mod_tile/renderd code to work - in my specific case - with British National Grid projection, 27700. Jason On 26 March 2013 04:44, Kai Krueger kakrue...@gmail.com wrote: On 03/07/2013 08:36 AM, Jason Lee wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? In case you are still interested, I have now refactored the code a bit to make it easier to support different projections. Supporting new projections now should be as simple as adding 6 numbers, (the boundaries in projected coordinates and the map aspect ratio). For the moment you still need to recompile renderd after changing / adding those numbers, but in the future that might change. At the moment it supports spherical mercator and plate carree out of the box and they can be mixed in the same rendering server. You configure those by changing the srs of the mapnik style sheet to the appropriate values. Also it is now possible to configure the size of the tiles in renderd.conf and it is no longer hard coded to be 256 px. (You still need to change the mapnik stylesheet for the appropriate PPI though). Kai The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
Kai and all other respondents, This is great response to my query and I will definitely continue to look into using the latest mod_tile/renderd code to work - in my specific case - with British National Grid projection, 27700. Jason On 26 March 2013 04:44, Kai Krueger kakrue...@gmail.com wrote: On 03/07/2013 08:36 AM, Jason Lee wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? In case you are still interested, I have now refactored the code a bit to make it easier to support different projections. Supporting new projections now should be as simple as adding 6 numbers, (the boundaries in projected coordinates and the map aspect ratio). For the moment you still need to recompile renderd after changing / adding those numbers, but in the future that might change. At the moment it supports spherical mercator and plate carree out of the box and they can be mixed in the same rendering server. You configure those by changing the srs of the mapnik style sheet to the appropriate values. Also it is now possible to configure the size of the tiles in renderd.conf and it is no longer hard coded to be 256 px. (You still need to change the mapnik stylesheet for the appropriate PPI though). Kai The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
On 03/07/2013 08:36 AM, Jason Lee wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? In case you are still interested, I have now refactored the code a bit to make it easier to support different projections. Supporting new projections now should be as simple as adding 6 numbers, (the boundaries in projected coordinates and the map aspect ratio). For the moment you still need to recompile renderd after changing / adding those numbers, but in the future that might change. At the moment it supports spherical mercator and plate carree out of the box and they can be mixed in the same rendering server. You configure those by changing the srs of the mapnik style sheet to the appropriate values. Also it is now possible to configure the size of the tiles in renderd.conf and it is no longer hard coded to be 256 px. (You still need to change the mapnik stylesheet for the appropriate PPI though). Kai The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
From: Jason Lee [mailto:jaslee...@gmail.com] Sent: Thursday, March 07, 2013 7:36 AM To: dev@openstreetmap.org Subject: [OSM-dev] mod_tile in other projections? The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. I imagine in terms of tiles/second they'd similar. Both use mapnik as a backend, both use meta-tiles. Where you're likely to run into problems is tile expiry. The traditional mod_tile/renderd/osm2pgsql setup copes well with OSM data which is constantly changing. mapproxy's cache system doesn't have a way to handle data that is outdated except by deleting it. That being said, I'm not sure if the normal setup handles tile expiry correctly in other projections. ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
On 03/07/2013 08:36 AM, Jason Lee wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? If by dynamic you mean you want to be able to select a different projection on every request, then that is currently not possible. However I am working on making mod_tile more configurable / paramerizable which can possibly be used for different projections per request as well. It is initially intended to make seting up rendering of multi-lingual maps like [1] easier, but it is basically just an extension to be able to pass in an arbitrary string parameter to renderd that can then parameterize the mapnik map object in various ways. With this you could have URLs like http://yourtileserver.org/tiles/srs 27700/0/0/0.png using mod_tile and renderd. If you mean dynamic generation of tiles that are always in the same projection albeit a different one than web mercator, then that should probably be doable with little modifications. The main issue I see with that is the tile numbering schema. I presume not all projections have the same numbering schema of (z^2) x (z^2) tiles per zoom level. At the moment there are a number of sanity checks in mod_tile and renderd that filter out requests that don't adhere to this restriction. However, it should be fairly trivial to modify those checks to reference the appropriate checks for the projection you wish. There are a few other minor modifications you would likely need in renderd, but from a quick glance over the code, they should be rather easily doable. Kai The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason [1] http://mlm.jochentopf.com/ ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
Mod_tile does have projection baked-in: https://github.com/openstreetmap/mod_tile/blob/master/renderd.py#L163 You may find it necessary to play with the scale of your projection so that the units of spherical mercator (equatorial meters) approximately match yours. For example, an Albers projection with a standard parallel in the continental United States would be scaled up a bit to get the numbers to match. -mike. On Mar 18, 2013, at 8:18 PM, Raffaello Bertini wrote: you can change the mapnik configuration file for the projection. mod_tile haven't nothing with projection or ogc protocol. mapproxy is better if you need WMS WMTS TMS protocol to distribuite your tiled map in more projection. On Thu, Mar 7, 2013 at 4:36 PM, Jason Lee jaslee...@gmail.com wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] mod_tile in other projections?
you can change the mapnik configuration file for the projection. mod_tile haven't nothing with projection or ogc protocol. mapproxy is better if you need WMS WMTS TMS protocol to distribuite your tiled map in more projection. On Thu, Mar 7, 2013 at 4:36 PM, Jason Lee jaslee...@gmail.com wrote: Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] mod_tile in other projections?
Hi all, It might seem an odd question but I'll give it a shot - would mod_tile/renderd support the dynamic generation of map tiles in a map projection other than web mercator? If not, then would it be possible/how difficult would it be to modify the code to support it? The only other thing I can think of is using MapProxy with Mapnik backend but I'm not sure the scalabilty/performance compared to mod_tile. Thanks and regards, Jason ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev