[gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Mark Johnson
See MSSQLSpatial - Microsoft SQL Server Spatial Database — GDAL documentation https://gdal.org/drivers/vector/mssqlspatial.html The MS SQL Spatial driver passes SQL statements directly to MS SQL by default, rather than evaluating them internally when using the ExecuteSQL() call on the

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
*Lähettäjä:* Hector muro > *Lähetetty:* keskiviikko 2. joulukuuta 2020 13.46 > *Vastaanottaja:* Rahkonen Jukka (MML) > > *Kopio:* gdal-dev@lists.osgeo.org > *Aihe:* Re: [gdal-dev] ogr2ogr project/transform CRS in the same database > table > > >

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Rahkonen Jukka (MML)
How did you install it? -Jukka Lähettäjä: Hector muro Lähetetty: keskiviikko 2. joulukuuta 2020 13.46 Vastaanottaja: Rahkonen Jukka (MML) Kopio: gdal-dev@lists.osgeo.org Aihe: Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table Hi again, Okey, I think I got it. And you were r

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
e3_prepare_v2(select top(1) from >> underscore_test): >> >> no such function: top >> >> >> >> -Jukka- >> >> >> >> >> >> >> >> *Lähettäjä:* Hector muro >> *Lähetetty:* keskiviikko 2. joulukuuta 2020 13

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
; > > > > > > *Lähettäjä:* Hector muro > *Lähetetty:* keskiviikko 2. joulukuuta 2020 13.02 > *Vastaanottaja:* Rahkonen Jukka (MML) > > *Kopio:* gdal-dev@lists.osgeo.org > *Aihe:* Re: [gdal-dev] ogr2ogr project/transform CRS in the same database > table > > >

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Rahkonen Jukka (MML)
: keskiviikko 2. joulukuuta 2020 13.02 Vastaanottaja: Rahkonen Jukka (MML) Kopio: gdal-dev@lists.osgeo.org Aihe: Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table Hi, Sorry, no, I meant that, using the flag dialect returns an error of "Table not found", but using the

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
does not have those ST_ > functions that you need. > > > > -Jukka- > > > > > > > > > > > > > > *Lähettäjä:* Hector muro > *Lähetetty:* keskiviikko 2. joulukuuta 2020 12.37 > *Vastaanottaja:* Rahkonen Jukka (MML) >

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Rahkonen Jukka (MML)
server but your table name may require quotation marks " " and they require escaping with \ so that they do not close the SQL statement. Try -sql "update \"table_name\" set …. " Simple test to verify if the problem is caused by the unquoted table name is to run ogrinfo wi

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
t; and they require escaping with \ so that they do not > close the SQL statement. Try > > -sql "update \"table_name\" set …. " > > > > Simple test to verify if the problem is caused by the unquoted table name > is to run ogrinfo with > > -sq

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Rahkonen Jukka (MML)
unquoted table name is to run ogrinfo with -sql "select * from table_name limit 1". -Jukka- Lähettäjä: Hector muro Lähetetty: keskiviikko 2. joulukuuta 2020 12.13 Vastaanottaja: Rahkonen Jukka (MML) Kopio: gdal-dev@lists.osgeo.org Aihe: Re: [gdal-dev] ogr2ogr project/transform

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-02 Thread Hector muro
Hi again, I've given your idea a go: ogrinfo -dialect sqlite -sql "update set = ST_AsText(ST_Transform(geometry),4326)" --config MSSQLSPATIAL_USE_GEOMETRY_COLUMNS NO "$connect_string" This connects correctly, as I get this message: INFO: Open of

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-01 Thread Hector muro
Oh that's a great idea. I have to use SQL Server (not by personal choice) and had given it a go with sqlite as dialect, bur was probably too focused on ogr2ogr. I also didn't know about the "indirect_SQLite" dialect. I will give a try at what you suggest. Thanks for the help :) Hector On

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-01 Thread jratike80
I would say that it is best to still use ogrinfo. You did not tell what is your database so I can't tell the exact recipe for you but you will learn it. You need to know that there are different SQL dialects for GDAL: OGR SQL, SQLite, indirect_SQLite, and the native SQL for your database. They

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-01 Thread Hector muro
Oh, I see. That's great. But what if the Database does not have ST_Transform support? Could we still achieve a similar approach by means of ogr2ogr? (I should have mentioned this in my first email). Thanks again! Hector On Tue, 1 Dec 2020 at 20:14, jratike80 wrote: > Hi, > > No,

Re: [gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-01 Thread jratike80
Hi, No, unfortunately it is not possible with one ogr2ogr command. You need two commands and you must use ogrinfo. Here an example about adding another geometry column and populating it with EPSG:3857 version of original EPSG:4326 geometries. ogrinfo PG:"host=localhost port=5432 dbname=test

[gdal-dev] ogr2ogr project/transform CRS in the same database table

2020-12-01 Thread Hector muro
Hi all, I was wondering if someone knew if it's possible to project or transform within the same table in a database, using ogr2ogr. What I mean is, I have a table with fields: id, id2, geom_wkt_27700 and I would like, using a single command to create an extra column "geom_wkt_4326" for