Comments (12)
My bad! Similar use case in #7294 I guess ;)
from gdal.
Would you mind attaching the gml as GML file that can be studied with ogrinfo and ogr2ogr?
I wonder if it is too much to trust that things like <gml:Arc interpolation="circularArc3Points" numArc="1">
convert nicely into WKT.
from gdal.
Sure: test1.zip
I'm aware that Arcs won't be converted 1:1, but the resulting geometry should imho be valid nevertheless.
from gdal.
GDAL seems to find the following WKT. PostGIS says that the geometry is valid and it looks the same in QGIS as the source GML.
![image](https://private-user-images.githubusercontent.com/1751612/305440753-8b8f574e-e3e3-44ec-8719-f024c38fb6df.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTAyODU1MzIsIm5iZiI6MTcxMDI4NTIzMiwicGF0aCI6Ii8xNzUxNjEyLzMwNTQ0MDc1My04YjhmNTc0ZS1lM2UzLTQ0ZWMtODcxOS1mMDI0YzM4ZmI2ZGYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTJUMjMxMzUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjA5MmJkN2M4MjE2MGRlNDQ4MGFkMDEwOTg2NWRhMzUzZTIxZjQ0N2MxZTFiZmQ5YTFkNTA5ZmJhMTVmNzQzYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.SmywjuATtQKG46IL9w064N0u6ifXLG409jl1VidNw8I)
CURVEPOLYGON ((567462.07 5937698.959,567446.882 5937692.583,567390.995 5937669.124,567386.293 5937667.145,567389.479 5937654.684,567404.151 5937595.479,567474.996 5937628.152,567465.27 5937684.42,567462.07 5937698.959),COMPOUNDCURVE (CIRCULARSTRING (567410.377 5937607.7,567407.834857796 5937607.72206805,567406.223 5937609.688),(567406.223 5937609.688,567403.316 5937621.126),(567403.316 5937621.126,567394.606 5937655.401),(567394.606 5937655.401,567393.37 5937660.265),(567393.37 5937660.265,567395.687 5937664.07),(567395.687 5937664.07,567403.0 5937667.139),(567403.0 5937667.139,567415.353 5937672.325),(567415.353 5937672.325,567433.538 5937679.955),(567433.538 5937679.955,567432.779 5937681.762),(567432.779 5937681.762,567443.507 5937686.264),(567443.507 5937686.264,567445.762 5937685.099),(567445.762 5937685.099,567448.434 5937683.72),(567448.434 5937683.72,567451.021 5937668.836),(567451.021 5937668.836,567450.952 5937668.824),(567450.952 5937668.824,567452.176 5937661.63),(567452.176 5937661.63,567453.455 5937654.108),(567453.455 5937654.108,567442.758 5937634.17),(567442.758 5937634.17,567434.477 5937618.73),(567434.477 5937618.73,567428.223 5937615.867),(567428.223 5937615.867,567410.377 5937607.7)))
Now I wonder how I could convert the WKT into GML3 with the GDAL command line tools because I have only those in my toolbox.
So I made PostGIS to read the WKT
ogr2ogr -f GML gdalgml32.gml PG:"host=localhost port=5432 dbname=db user=user password=pw" -sql "select st_geomfromtext('CURVEPOLYGON...
The resulting gml can be opened with QGIS and the geometry looks the same than before. I had to delete the .gfs file first but maybe it remained from some earlier experiment.
I do not know how valid my tests are and what they prove, if anything.
from gdal.
gdalgml32.zip has the gml:Ring
element as well as the gml:id
attribute on sub-geometries and seems to be valid:
<gml:interior>
<gml:Ring>
<gml:curveMember>
<gml:Curve gml:id="gmltest.geom.0.interior.0.0">
The WKT string seems to be the same in both cases (geom.ExportToWkt()
and st_geomfromtext('CURVEPOLYGON...
), the resulting GML geometry, however, differs with geom.ExportToGML()
.
On a side note, I get an error when using ST_AsGML inside the DB on the geometry: I just realized that the default GML version for this function is 2. So ST_AsGML(3, geom) results in an apparently valid GML geometry withSQL Error [XX000]: FEHLER: lwgeom_to_gml2: 'CompoundCurve' geometry type not supported
<gml:interior>
<gml:Ring>
albeit no gml:id
, but these aren't mandatory for GML 3.2.2.
from gdal.
@pathmapper maybe have a look
from gdal.
Please notice that in my test the curvepolygon WKT was first turned into a PostGIS geometry by the PostGIS database with -sql "select st_geomfromtext('CURVEPOLYGON...
while in the original case GDAL did the conversion into GDAL geometry with geom = ogr.CreateGeometryFromWkt(geom)
.
So the next step might be to test if GDAL could have some bug in CreateGeometryFromWkt
by checking the content of geom
and is it somehow different than the one that comes through PostGIS. I paste the geometry from the PostGIS ST_GeomFromText if it happens to help someone.
010A000000020000000102000000090000003D0AD7234C512141894160BD88A65641068195C32D5121413BDF4F2587A65641D7A370FDBD502141B29DEF4781A6564193180496B450214114AE47C980A65641EE7C3FF5BA502141F0A7C6AB7DA656413BDF4F4DD85021419EEFA7DE6EA6564146B6F3FD65512141355EBA0977A65641A4703D8A52512141AE47E11A85A656413D0AD7234C512141894160BD88A65641010900000014000000010800000003000000DD2406C1E4502141CDCCCCEC71A65641257B72ABDF502141E95C36EE71A65641560E2D72DC5021412731086C72A65641010200000002000000560E2D72DC5021412731086C72A6564183C0CAA1D65021414E62104875A6564101020000000200000083C0CAA1D65021414E62104875A65641CBA14536C5502141E7FBA9D97DA65641010200000002000000CBA14536C5502141E7FBA9D97DA65641D7A370BDC25021418FC2F5107FA65641010200000002000000D7A370BDC25021418FC2F5107FA65641C976BE5FC750214148E17A0480A65641010200000002000000C976BE5FC750214148E17A0480A6564100000000D65021414260E5C880A6564101020000000200000000000000D65021414260E5C880A656417F6ABCB4EE502141CDCCCC1482A656410102000000020000007F6ABCB4EE502141CDCCCC1482A656416ABC74131351214152B81EFD83A656410102000000020000006ABC74131351214152B81EFD83A656418716D98E11512141A69BC47084A656410102000000020000008716D98E11512141A69BC47084A6564106819503275121414260E59085A6564101020000000200000006819503275121414260E59085A656412FDD24862B5121411904564685A656410102000000020000002FDD24862B5121411904564685A656417D3F35DE30512141E17A14EE84A656410102000000020000007D3F35DE30512141E17A14EE84A656411283C00A365121412506813581A656410102000000020000001283C00A365121412506813581A65641448B6CE7355121417F6ABC3481A65641010200000002000000448B6CE7355121417F6ABC3481A6564108AC1C5A3851214185EB51687FA6564101020000000200000008AC1C5A3851214185EB51687FA656418FC2F5E83A512141D578E9867DA656410102000000020000008FC2F5E83A512141D578E9867DA656417593188425512141AE47E18A78A656410102000000020000007593188425512141AE47E18A78A65641105839F414512141EC51B8AE74A65641010200000002000000105839F414512141EC51B8AE74A65641560E2D720851214191ED7CF773A65641010200000002000000560E2D720851214191ED7CF773A65641DD2406C1E4502141CDCCCCEC71A65641
from gdal.
With GDAL 3.9.0dev-d7aed6e0b0, released 2024/02/09 (debug build)
and the original approach in #9238 (comment) there is a valid geometry as result:
out_geometry.zip (created not with recent GDAL)
from gdal.
@kraftto maybe the issue is that your result is missing the namespace declaration?
If xmlns:gml="http://www.opengis.net/gml/3.2"
is added to the Polygon element of your result and the GML is opened via drag'n'drop in QGIS it loads just fine and passes validity checks with the Check validity tool (QGIS and GEOS).
from gdal.
OK, I see now why you are saying the result is invalid :-)
from gdal.
Yeah I should have mentioned that I'm talking about XML Schema validity :) I added this to the original issue description. The GML geometry should look like the one in gdalgml32.zip.
from gdal.
Turns out that this has been reported before in #7294 and was fixed in #7296.
You need minimum GDAL 3.6.3 and then you will get
<gml:interior>
<gml:Ring>
<gml:curveMember>
From https://github.com/OSGeo/gdal/blob/v3.6.3/NEWS.md
GML driver:
fix CurvePolygon export of CompoundCurve and CircularString child elements (#7294)
from gdal.
Related Issues (20)
- gdal_translate -expand rgba produces wrong colors (but pct2rgb.py -rgba produces correct colors HOT 2
- gdal_grid should bomb out if a layer given is not found
- Add ogr2ogr -gcp example
- Say *write* permission denied
- Allow access to user input in output HOT 1
- Should bomb out when given multiple -sql arguments, instead of randomly executing one HOT 8
- gdalwarp not respecting `-wo NUM_THREADS=ALL_CPUS` when using single vrt file HOT 7
- CreateGeometryFromEsriJson Doesn't Support Arcs and Curves HOT 6
- GTiff: endless loop when resampling (bilinear) under some circumstances HOT 1
- Shapefile: error out on valid .sbn file HOT 3
- gdal_viewshed: Attempt to create 5x-1 dataset HOT 2
- gdal_viewshed example has output .png, but neglects showing the command line that created it HOT 3
- drivers/raster/index out of sync with the contents
- 0Warning, 0Error: progress meter starts too early HOT 1
- gdal_edit examples lack usual explanation
- GDAL_DISABLE_READDIR_ON_OPEN default configuration is confusing for remote resources HOT 3
- Access denied when using gdalinfo with Docker Image on EC2 Instance using AWS federation token HOT 8
- OpenFileGDB: After deleteLayer, GetLayerByName() result is not null HOT 6
- [feature request] Adding basic support for AddBand() as 2D variables with netCDF driver
- Region-specific endpoints are not used when AWS_DEFAULT_REGION is set
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdal.