[gdal-dev] ogr gml Box handling
Andrew Terry
andrew.terry at centremaps.co.uk
Thu Dec 22 05:48:04 PST 2022
Hi Jukka,
Thanks for responding and apologies for not including enough context.
I'm converting GML into a SQL file form during testing using a command like:
ogr2ogr --config GML_GFS_TEMPLATE test.gfs --config PG_USE_COPY YES -skipfailures -lco spatial_index=NONE -lco create_table=off -lco schema=test -lco create_schema=off -f PGDump output.sql input.gml
An example GML with one feature would be:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<osgb:FeatureCollection xmlns:osgb='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:gml='http://www.opengis.net/gml' xmlns:xlink='http://www.w3.org/1999/xlink' xsi:schemaLocation='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb http://www.ordnancesurvey.co.uk/xml/schema/v9/OSDNFFeatures.xsd' fid='LOCAL_ID_0'>
<gml:description>Ordnance Survey, (c) Crown Copyright. All rights reserved, 2022-10-27</gml:description>
<gml:boundedBy>
<gml:null>unknown</gml:null>
</gml:boundedBy>
<osgb:queryTime>2022-10-27T00:10:00</osgb:queryTime>
<osgb:queryChangeSinceDate>2022-09-15</osgb:queryChangeSinceDate>
<osgb:departedMember>
<osgb:DepartedFeature fid='osgb1000000849991256'>
<osgb:boundedBy>
<gml:Box srsName='osgb:BNG'>
<gml:coordinates>254337.630,617076.680 254337.630,617076.680</gml:coordinates>
</gml:Box>
</osgb:boundedBy>
<osgb:theme>Roads Tracks And Paths</osgb:theme>
<osgb:reasonForDeparture>Deleted</osgb:reasonForDeparture>
<osgb:deletionDate>2022-09-26</osgb:deletionDate>
</osgb:DepartedFeature>
</osgb:departedMember>
</osgb:FeatureCollection>
It defines an item's unique fid and some basic attributes along with the "Box" as a bounding box / envelope indication of its location.
Ultimately, the purpose is to form an indication of a feature to be deleted - in this case a point but not always.
ogr2ogr will load the data but doesn't understand the geometry type - and I note a bounding box doesn't seem to be mentioned under types in the documentation
A positive result would be any way to retain the content of gml:coordinates as a geometry or even as text which I could then handle within postgres as something I could turn into a geometry. My assumption has been that I would need to modify the gfs created by org2ogr to try and explicitly pull this element out
Thanks
Andy
From: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
Sent: 22 December 2022 13:20
To: Andrew Terry <andrew.terry at centremaps.co.uk>; gdal-dev at lists.osgeo.org
Subject: Re: ogr gml Box handling
Hi,
Sorry but I do not understand at all what you want to do. Would you, if you read your question?
Do you have some GML data that has a bounding box for each feature and you would like to convert the bbox into something? Would that be a second geometry for the attribute if the target format supports multiple geometries? Or an attribute that contains the bbox expressed as WKT of GeoJSON? Please give complete GML test data sample and an example about what would be the ideal result.
In your example the bounding box seems to be a point so probably the data contains also just one point but probably you want to deal with more generic data.
-Jukka Rahkonen-
Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> Puolesta Andrew Terry
Lähetetty: torstai 22. joulukuuta 2022 15.08
Vastaanottaja: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] ogr gml Box handling
Hi,
Trying to pull in the bounding box / envelope "Box" when loading gml with ogr2ogr
<osgb:boundedBy>
<gml:Box srsName='osgb:BNG'>
<gml:coordinates>257023.700,620210.000 257023.700,620210.000</gml:coordinates>
</gml:Box>
</osgb:boundedBy>
I've tried <GeometryElementPath>boundedBy</GeometryElementPath> in my gfs file.
I've also tried seeing if I can pull through as a string using:
<PropertyDefn>
<Name>bbox</Name>
<ElementPath>boundedBy|Box|coordinates</ElementPath>
<Type>String</Type>
</PropertyDefn>
Any tips - if it's even possible?
Thanks
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221222/dee1c10b/attachment-0001.htm>
More information about the gdal-dev
mailing list