TransWikia.com

ST_AsPNG query has wrong position on Mapbox

Geographic Information Systems Asked by Kawada on September 29, 2021

I am trying to import GeoTIFF files into a PostgreSQL database using raster2pgsql.

I use the following query to import the data into my database:

raster2pgsql -s 4326 -c -P -I -C -t 256x256 *.tif public.my_raster_table > out.sql

The import seems ok. Then, to work with Mapbox with a z/x/y format, I build a request.

For example, for 18/133274/88180 (Lille, France) I create the following request

SELECT ST_AsPNG(ST_Union(rast)) As new_rast FROM my_raster_table WHERE ST_Intersects(rast, ST_Transform(ST_Segmentize(ST_MakeEnvelope( 336628.6725679152, 6556921.160358975, 336781.5466244854, 6557074.034415545, 3857), 38.21851414255798), 4326))

The data is retreived, but my raster file has a wrong position, and it is repeated multiple times (I try to replace a road).

I know my ST_Intersects is right as it works well for vector tiles.

Where did I go wrong ?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP