[gdal-dev] org2org

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Wed Nov 9 05:53:20 PST 2022


Hi,

You are selecting data from table grids.grid_1_25grad. I suppose that table contains grid polygons. By your image you seem to want some buffered geometry. Spend some time for thinking about what data do you want and where to get it. You can test your queries with for example pgAdmin that can preview the geometries. Or use OpenJUMP that is an excellent tool for visualizing PostGIS query results.

-Jukka Rahkonen-

Lähettäjä: Leber, Thorsten <Thorsten.Leber at hensoldt.net>
Lähetetty: keskiviikko 9. marraskuuta 2022 15.46
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
Aihe: AW: org2org

Hi Jukka,

with geometry al 5 files are created

ogr2ogr -f "ESRI Shapefile" C:\RenderTest\raster_clipper_and.shp PG:"host=10.49.20.42 port=5432 user=tilemill password=test dbname=nextgen" -sql "SELECT \""name\"", \""left\"", top, \""right\"", bottom, geom FROM grids.grid_1_25grad WHERE ST_Intersects(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and'))) AND NOT ST_Touches(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and')))" -s_srs "EPSG:4326" -t_srs "EPSG:4326" -overwrite -lco ENCODING=utf8

but it looks strange

[cid:image001.png at 01D8F453.5C84F570]

I would expect this

[cid:image002.png at 01D8F453.5C84F570]

Thorsten

Von: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Gesendet: Mittwoch, 9. November 2022 13:10
An: Leber, Thorsten <Thorsten.Leber at hensoldt.net<mailto:Thorsten.Leber at hensoldt.net>>
Betreff: Re: org2org


This message was sent from outside of HENSOLDT. Please do not click on links or open attachments unless you validate the source of this email and know the content is safe.

Hi,

Try to add a geometry into the selection -sql "SELECT \""name\"", \""left\"", top, \""right\"", bottom FROM..

-Jukka-


Lähettäjä: Leber, Thorsten <Thorsten.Leber at hensoldt.net<mailto:Thorsten.Leber at hensoldt.net>>
Lähetetty: keskiviikko 9. marraskuuta 2022 13.53
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Aihe: AW: org2org

ogr2ogr -f "ESRI Shapefile" C:\RenderTest\raster_clipper_and.shp PG:"host=10.49.20.42 port=5432 user=tilemill password=test dbname=nextgen" -sql "SELECT \""name\"", \""left\"", top, \""right\"", bottom FROM grids.grid_1_25grad WHERE ST_Intersects(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and'))) AND NOT ST_Touches(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and')))" -s_srs EPSG:4326 -t_srs EPSG:4326 -overwrite -lco ENCODING=utf8

this works now without any warning but still only 3 files in output folder

Von: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Gesendet: Mittwoch, 9. November 2022 12:21
An: Leber, Thorsten <Thorsten.Leber at hensoldt.net<mailto:Thorsten.Leber at hensoldt.net>>; gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Betreff: Re: org2org


This message was sent from outside of HENSOLDT. Please do not click on links or open attachments unless you validate the source of this email and know the content is safe.

Hi,

Does the SQL part work with a tool like pgAdmin? Notice that the inner double quotes must be escaped as \" in the ogr2ogr command or otherwise they will truncate the -sql parameter. And it seems that you did not select the geometry field. Generally I would suggest to start with a simple SQL and add complexity once you have gotten a good result. Suggestion includes testing with easy table names first before forwarding to names like countries.geometries_boundary_buffer_10km('and').

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> Puolesta Leber, Thorsten
Lähetetty: keskiviikko 9. marraskuuta 2022 13.02
Vastaanottaja: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] org2org

Hi All,
I am trying to use org2org with the following command:

ogr2ogr -f "ESRI Shapefile" C:\RenderTest\raster_clipper_and.shp PG:"host=10.49.20.42 port=5432 user=tilemill password=test dbname=nextgen" -sql "SELECT "name", "left", top, "right", bottom FROM grids.grid_1_25grad WHERE ST_Intersects(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and'))) AND NOT ST_Touches(geom, (SELECT geom FROM countries.geometries_boundary_buffer_10km('and')))" -s_srs EPSG:4326 -t_srs EPSG:4326 -overwrite -lco ENCODING=utf8

I expect in the output folder 5 files

[cid:image003.png at 01D8F453.5C84F570]

But I receive a warning:

Warning 1: layer names ignored in combination with -sql.

And get only 3 files

[cid:image004.png at 01D8F453.5C84F570]

I am missing the .shp and the .shx file. Is there something wrong in my command?

KR

Thorsten


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221109/93783724/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1618 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221109/93783724/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 12636 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221109/93783724/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 3261 bytes
Desc: image003.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221109/93783724/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 2071 bytes
Desc: image004.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221109/93783724/attachment-0007.png>


More information about the gdal-dev mailing list