nextgis / qgis_qtiles

QGIS plugin to generate multi-level tilesets from a project.
GNU General Public License v2.0
109 stars 50 forks source link

EPSG3857 layers have unexpected extents #75

Open kjkrum opened 7 years ago

kjkrum commented 7 years ago

When making tiles from an EPSG3857 layer, QTiles renders a tiny area around 0° 0°. It's as if QGIS is reporting the layer extents in degrees instead of meters, and then QTiles is scaling them by the number of meters in 1°. This may be a bug in QGIS, but it seems like it would be acceptable for QTiles to treat any extents that could be degrees as degrees. I doubt very many users are rendering features within 180 meters of the coordinate origin in the middle of the ocean.

simgislab commented 7 years ago

version of QGIS version of QTiles may be a data sample?

kjkrum commented 7 years ago

QGIS 2.18.2, QTiles 1.5.2. I experimented on a new project and found different failure modes depending on the layer and project CRS.

Layer CRS set to EPSG 4326, no project CRS: Everything works fine.

Layer CRS set to EPSG 4326, project CRS set from layer: Everything works fine.

Layer CRS set to EPSG 3857, no project CRS: Extents in metadata.json are correct, but all tiles are blank.

Layer CRS set to EPSG 3857, project CRS set from layer: Extents in metadata.json are wrong by a factor of approximately 111,320, which is the number of EPSG 3857 pseudo-meters in 1°. No tiles are created. (Previously, a single blank tile was created for each zoom level. I could not reproduce this in a new project.)

{
   "maxZoom":15,
   "minZoom":11,
   "bounds":"-0.000997541174691,0.000288363206654,-0.000995126527844,0.000290135777677",
   "name":"parks",
   "format":"png"
}
kjkrum commented 7 years ago

I forgot to mention that I updated the layer extents each time I changed the CRS. Also, in every case, the overview image appeared correct.

Here's my layer data. park_rec_ADMIN_TUCSON.shp.zip

kjkrum commented 7 years ago

Does QTiles always produce tiles with the correct projection for web maps like Google Maps or Leaflet, regardless of the layer CRS? If so, I can just convert everything to EPSG 4326.