0

I own a project created with TileMill in SRS 900913. The data source is a Postgis database with the same SRS.

When I'm loading the file generated with TileMill (mbtiles) in QGIS and I'm putting under an orthophoto with the same SRS, or the original Postgis layer, the mapping displayed is moved approximately 2.5 meters moves in the Y axis relative to the PostGIS layer.

However if I'm loading QGIS directly from a PostGIS data source, works like a charm (think). Is like TileMill is displacing it because, as I said, loading the postgis layer directly from the database is working fine. In this image, you could see the Y offset between postgis (marked in blue), and mbtiles raster (marked in black)

postgis layer and mbtiles layer

Anyone know what could be happening?

2
  • 2.5 metres displacement at what latitude?
    – BradHards
    Commented Jan 27, 2015 at 8:56
  • Postgis layer (the correct layer) has this coordinates: -659215.06,5397190.63, and the mbtiles layer, for the same element has -659214.77,5397188.39
    – Avantgeo
    Commented Jan 27, 2015 at 9:16

2 Answers 2

1

Solved. It is a QGIS bug with mbtiles format. I have QGIS 2.6.1-Brighton. It shifted the mbtiles 3m south. If I load the mbtiles file in my leaflet project, it fits perfectly.

1
  • Confirmed here with own mbtiles, even with datasources in WGS84. It is not a QGIS bug; if I use GDAL to transform to geotiff, it is shifted too.
    – AndreJ
    Commented Jan 27, 2015 at 20:12
0

SRS 900913 is not supported by QGIS anymore. It has been officially replaced by EPSG:3857, but the mapnik people still stick to their 900913. The projection has some pitfalls which are only solved if QGIS recognizes it correctly. If you load data from a OSM postgis database, a custom CRS will be created for it.

You don't write how you add the tilemill tiles. If you set the layer CRS to EPSG:3857, it should come out fine.

4
  • Actually the SRS layer in Tilemill is 900913, the Postgis source is EPSG:3857 (created with ogr2ogr from DGN source). But if in SRS field (Tilemill) I select Custom "+init=EPSG:3857" or the QGIS definition for EPSG:3857 - WGS84 / Pseudo 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" the result layer has the same problem. I'm confusing about that. The final result will be showed in a Leaflet map with EPSG:3857 projection.
    – Avantgeo
    Commented Jan 27, 2015 at 7:49
  • I read this in a blog: "Also, projection code 900913 must be defined as the spatial reference when you are using files that you originally projected into EPSG:3857 using OGR. The two projections are equivalent, but if you leave TileMill to autodetect the spatial reference, you will see an offset from Google's tiles due to the way the projection parameters are interpreted." It seems that I'm configuring the layer in the right way, but it's failing.
    – Avantgeo
    Commented Jan 27, 2015 at 8:58
  • Can you link to that blogpost in your question? Maybe you should set your postgis database to 900913 as well.
    – AndreJ
    Commented Jan 27, 2015 at 9:14
  • [link]e-education.psu.edu/geog585/node/711. The issue is that the final project must be in EPSG:3857
    – Avantgeo
    Commented Jan 27, 2015 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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