Timeline for Ogr2ogr: how to add values to a database column
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 20, 2020 at 19:31 | comment | added | Eze |
@geozelot I have changed my command line but I still get no such table: 1597889056 , with ogrinfo -al -so 1597889056.kml return Layer name: LOBR640610MZSNTB09 Geometry:Unknown (any) Feature Count: 1 , is there a way to get layer_name from ogr2ogr or change the value ?
|
|
Aug 20, 2020 at 19:17 | comment | added | geozelot |
<layer_name> is refering to the input file! Try with the name of the KML file you import from, i.e. ... FROM "1597889056"; .
|
|
Aug 20, 2020 at 15:50 | history | edited | Eze | CC BY-SA 4.0 |
added 505 characters in body
|
Aug 20, 2020 at 15:45 | comment | added | Eze |
Exact, the string I generate from php @geozelot update my question with the string I generate with your answer. output; ogr2ogr -f PostgreSQL PG:"host=127.0.0.1 dbname=postgis_24_sample port=5432 user=postgres password=123456" C:\xampp\htdocs\siap-padron\public\uploads/2044492/polygon/1597861175.kml -nln ppb_curp -dialect sqlite -sql "SELECT ogc_fid, 'My kml file ' as name FROM 'ppb_curp'" 2>&1 , but how do I get the value of layer_name ?
|
|
Aug 20, 2020 at 8:50 | comment | added | geozelot |
So you execute ogr2ogr from within PHP, meaning that you prepare the shell script as string? If so, you could use sth. like ogr2ogr <other_options> -dialect sqlite -sql 'SELECT ogc_fid, <name> AS name, <desc> AS description, <curp> AS curp, <zip> AS zip_code, GEOMETRY AS wkb_geometry FROM <layer_name>;' where you pass in string literals from your vars.
|
|
Aug 19, 2020 at 19:37 | history | asked | Eze | CC BY-SA 4.0 |