Re: [gdal-dev] ogr2ogr question

2020-12-21 Thread jratike80
Hi, No, -overwrite does not truncate but it drops the table. However, with the PostgreSQL driver it is also possible to truncate the table by using this documented method https://gdal.org/drivers/vector/pg.html#vector-pg. Check the configuration options "OGR_TRUNCATE: If set to “YES”, the conten

Re: [gdal-dev] ogr2ogr question

2020-12-21 Thread matteo
Hi Even, If you look at the output of ogrinfo PG:. -sql "select " you'll see that the resulting layer is called "sql_statement", so your ogr2ogr invokation will overwrite/create a sql_statement table in your GPKG. You want to add -nln intap to rename this SQL result layer. And -overwrite

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread G Seiffert
Thanks Javier, but as it looks the way I did works great. Got rid of the XY shift as well. Rotation affects the calculations for the origin as well, of course, this is what I needed to correct. In case of 0 vs 90 deg rotation the fix was simple. Will now work on trig formulas that work with any

Re: [gdal-dev] ogr2ogr question

2020-12-21 Thread Even Rouault
Matteo, > I'm really stuck on a ogr2ogr command. > > I've a template.gpkg file with some tables and what I'm trying to do is > to overwrite some of these tables with some already existing views of a > PG database. > > The tables and views have the same structure and geometry, basically I'm > try

[gdal-dev] ogr2ogr question

2020-12-21 Thread matteo
Hi all, I'm really stuck on a ogr2ogr command. I've a template.gpkg file with some tables and what I'm trying to do is to overwrite some of these tables with some already existing views of a PG database. The tables and views have the same structure and geometry, basically I'm trying to crea

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread Javier Jimenez Shaw
I am not sure, but I guess that you have to negate also GT5: y axis is reversed between image coordinates and "geographic" coordinates. .___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... ._ .__ Entre dos pensamientos racionales hay infinitos pensamientos irracionales. On Mon, 21 Dec 2020 at

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread G Seiffert
Thanks Javier. Need to confess: math is not my strong side. I'm more the "trial and error" guy. And - shame on me - Google. Got the rotation AND the scaling correct meanwhile, calculating the params as described here: https://gis.stackexchange.com/questions/69715/rotating-rasters-using-gdal-ge

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread jratike80
Hi, The geotransform parameters are the same than in the ESRI wordfile. I tried once to understand how the parameters behave when the image is rotated and wrote an OpenOffice spreadsheet about that. You can have a try and play with the parameters. I hope I have understood it right. I was not so su

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread Javier Jimenez Shaw
Those transformation parameters can be seen as a 3x3 transformation matrix like this Xg GT1 GT2 GT0 Xp Yg = GT4 GT5 GT3 * Yp 1 0 0 1 1 Where [Xp, Yp] is the coordinate in pixels, and [Xg, Yg] is the "geographic" coordinate (whatever it means ;) the 2x2 top left corner

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread Javier Jimenez Shaw
What I do to compute the (single) GSD (or pixel size) when there is a rotation is this: GSD = sqrt(abs(determinant([2x2 top left corner]))) see that pixel size can be different in X and Y directions. If you know your raster has no such distortion, you can just take the sqrt. abs is important. Usu

Re: [gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread Thomas Knudsen
Perhaps you can find some relevant information on the Wikpedia page describing the ESRI world file format: https://en.wikipedia.org/wiki/World_file - that usually where I go when I need to re-learn the basics of affine transformations /thomas Den man. 21. dec. 2020 kl. 12.34 skrev G Seiffert : >

[gdal-dev] Geotransform for non-North-up images?

2020-12-21 Thread G Seiffert
Hi all from GDLA. Thanks for the opportunity to as a question. It's regarding the Geotransform Tutorial(https://gdal.org/tutorials/geotransforms_tut.html). Tried to get info in the web but since this seems a tricky one, my searches failed. The tutorial only deals with the ideal case of 'Nort