[postgis-users] ST_AsMVTGeom and "Operation on mixed SRID geometries"

Jonas Enlund jonas.enlund at gmail.com
Mon Oct 9 11:30:04 PDT 2017


Hi,

I'm trying the use the new ST_AsMVT and ST_AsMVTGeom and I'm seeing an
error that I can't figure out:

  SELECT ST_AsMVTGeom(ST_Transform(geom, 3857),
                      TileBBox(4, 9, 4), 4096, 256, TRUE)
    FROM fin_adm4 WHERE name_3='Vaasa';

  -- ERROR:  Operation on mixed SRID geometries

The TileBBox function is from [1] and uses SRID 3857 as default. The
geom is Finland admin boundaries level 4 downloaded from www.gadm.org
and imported using shp2psql. It is imported in SRID 4326 but I'm
applying the ST_Transform function to reproject into 3857 in my queries.

The only time I see this error when I set clip_geom to true. But I
don't consitently see the error even then. For example, here are a
few similar queries without generating the error:

  -- A different city
  SELECT ST_AsMVTGeom(ST_Transform(geom, 3857),
                      TileBBox(4, 9, 4), 4096, 256, TRUE)
    FROM fin_adm4 WHERE name_3='Turku';

  -- Set clip_geom=false
  SELECT ST_AsMVTGeom(ST_Transform(geom, 3857),
                      TileBBox(4, 9, 4), 4096, 256, FALSE)
    FROM fin_adm4 WHERE name_3='Vaasa';

  -- Try the tile to the left instead (4, 8, 4)
  SELECT ST_AsMVTGeom(ST_Transform(geom, 3857),
                      TileBBox(4, 8, 4), 4096, 256, TRUE)
    FROM fin_adm4 WHERE name_3='Vaasa';

Here's a little info on the versions I'm currently running

  SELECT postgis_full_version();

  POSTGIS="2.4.0 r15853"
  PGSQL="96"
  GEOS="3.4.2-CAPI-1.8.2 r3921"
  PROJ="Rel. 4.8.0, 6 March 2012"
  GDAL="GDAL 1.10.1, released 2013/08/26"
  LIBXML="2.9.1"
  LIBJSON="0.11.99"
  LIBPROTOBUF="1.2.1"
  RASTER

  SELECT version();

  PostgreSQL 9.6.5 on x86_64-pc-linux-gnu, compiled by gcc (Debian
  4.9.2-10) 4.9.2, 64-bit

[1]  https://github.com/mapbox/postgis-vt-util/blob/master/src/TileBBox.sql
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20171009/7b9f7c04/attachment.html>


More information about the postgis-users mailing list