gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Problem importing a geotif : not projected #3818

Closed tbrochier closed 1 year ago

tbrochier commented 1 year ago

Describe the bug When trying to import a geotif, the projection information are not imported, thus we cannot know the longitude/latitude at each point of the space.

To Reproduce

Steps to reproduce the behavior: 1 - download this file : https://dropsu.sorbonne-universite.fr/s/mriDsKEaTaeTQfE 2 - import it in Gama

Expected behavior for each cell we should know the lat/lon so that distance can be computed

Screenshots

image

Desktop (please complete the following information):

AlexisDrogoul commented 1 year ago

Looking at the file in QGis, it seems in fact that no projection is associated with it. Maybe adding one in Qgis could help ? I let @ptaillandier handle this !

ElCep commented 1 year ago

It's strange because in QGIS on my side it's in WGS84. Do I need to create a projection file for the geotiffs? I've seen that I can do this in gdal with : gdal_translate -co "TFW=YES" in.tif out.tif see in https://filesender.renater.fr/?s=download&token=26d27d26-f341-41eb-852d-cc91ec8f0a6a

ElCep commented 1 year ago

@ptaillandier it doen't work with my gdal test

ptaillandier commented 1 year ago

Hi all,

The geotif files do have a coordinate system, and it's WGS84. However, one of GAMA's current limitations is that it only works in cartographic coordinate systems (i.e. projected in meters). So, whenever unprojected data are used, GAMA projects them on the fly, either with the reference coordinate system (the one of the shapefile used to define the world's geometry), or by looking for a UTM projection that is right for the area. The problem is that GAMA version 1.9.1 is currently unable to project raster data. So it can't do anything right with your geotiff in WGS84. The only current solution is to project the geotiff in a cartographic coordinate system using QGIS or any other software you like, and this should do the trick (I've tested it on my computer and it seems to work). Note that all these limitations will be removed with GAMA 2.0 (but development has only just begun).

Cheers,

Patrick

Le mer. 31 mai 2023 à 23:54, Etienne DELAY @.***> a écrit :

@ptaillandier https://github.com/ptaillandier it doen't work with my gdal test

— Reply to this email directly, view it on GitHub https://github.com/gama-platform/gama/issues/3818#issuecomment-1570585168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPWHL2NSPHXAFJKJQXJUDXI5ZU5ANCNFSM6AAAAAAYVKFDPY . You are receiving this because you were mentioned.Message ID: @.***>

ElCep commented 1 year ago

Ok ! thank you @ptaillandier ! I'm going to transform all this into UTM zone 28 then! Good luck with version 2! It will be great

ElCep commented 1 year ago

I reprojected the raster files with : gdalwarp inFile.tif outFile.tif -t_srs EPSG:32628 and vectors data with : ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32628 -s_srs EPSG:4326 outFile.shp inFile.shp and it seems to work ! Thanks @ptaillandier and GDAL/OGR tools