I just found that leafletjs and openlayers have two different conventions to convert coordinates from EPSG:4326 (WGS 84) to tile names ({Z}/{X}/{Y}
).
Thus I would like to have more information about the origin and usages of such two standards, and I would also know if there is a generalized way to implement the conversions from any projection (using only proj4 data) to tiles names.
I added the following preliminary snippet to mod_tile, so that it can serve EPSG:4326 (WGS 84) tiles:
} else if (strcmp(srs, "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") == 0) {
syslog(LOG_DEBUG, "Using wgs84 projection settings");
prj = (struct projectionconfig *)malloc(sizeof(struct projectionconfig));
prj->bound_x0 = -180;
prj->bound_x1 = 180;
prj->bound_y0 = -90;
prj->bound_y1 = 90;
prj->aspect_x = 2;
prj->aspect_y = 1;
To display a tiled map I use:
Leafletjs
L.tileLayer('.../base/{z}/{x}/{y}.png');`
Openlayers
('.../base/{z}/{x}/{y}.png').replace('{z}', (tileCoord[0] - 1).toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
The results with the two libraries is exactly the same, if I adapt the zoom level.
EDIT: My target is to provide a generalized patch for mod_tile (and ev. other services), but from the answer below, I think I need to provide extra parameters in a configuration file of mod_tile (e.g. renderd.conf
) to generate the correct tile with the expected name.