Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast via SQL doesn't change geomtype #618

Open
mdsumner opened this issue Feb 21, 2025 · 0 comments
Open

cast via SQL doesn't change geomtype #618

mdsumner opened this issue Feb 21, 2025 · 0 comments

Comments

@mdsumner
Copy link
Collaborator

I only really post this as something to explore, certainly not a major priority, I'm trying to figure out why the cli commands seemingly get this right but in R we get the original MultiSurface type.

Run this in cli (create 'abc.parquet' in the wd):

system("ogr2ogr abc.parquet WFS:https://services.thelist.tas.gov.au/arcgis/services/Public/OpenDataWFS/MapServer/WFSServer -sql 'SELECT CAST(SHAPE AS GEOMETRY(MULTIPOLYGON)) AS geom, OBJECTID  FROM \"Public_OpenDataWFS:LIST_Authority_Land\" LIMIT 100'")

Here yes we get polygons:

library(gdalraster)
ds <- new(GDALVector, "abc.parquet")
ds$getNextFeature()
#> WKB
#> OGR feature
#> $FID
#> integer64
#> [1] 0
#> 
#> $OBJECTID
#> [1] 1
#> 
#> $geom
#> [1] WKB MULTIPOLYGON: raw 01 06 00 00 ...
ds$close()

but here we get multisurface, and wk can't unpack it (another aspiration for wk eventually).

ds <- new(GDALVector, "WFS:https://services.thelist.tas.gov.au/arcgis/services/Public/OpenDataWFS/MapServer/WFSServer", 
    'SELECT CAST(SHAPE AS GEOMETRY(MULTIPOLYGON)) AS GEOM, OBJECTID  FROM \"Public_OpenDataWFS:LIST_Authority_Land\" LIMIT 100')
ds$getFeatureCount()
#> [1] 100
ds$getGeomType()
#> [1] "MULTIPOLYGON"
ds$getNextFeature()
#> WKB
#> OGR feature
#> $FID
#> integer64
#> [1] 1
#> 
#> $OBJECTID
#> [1] 1
#> 
#> $GEOM
#> [1] WKB MULTISURFACE: raw 01 0c 00 00 ...
ds$close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant