Andrew,

the GMLAS driver will fetch it as a string:

$ ogrinfo GMLAS:input.gml -oo remove_unused_layers=yes -al -q
Warning 1: Unhandled type: gMonthDay
Warning 1: Unhandled type: gMonthDay

Layer name: departedfeature
OGRFeature(departedfeature):1
  ogr_pkid (String) = FDD58DEB0E04A917AB5BAEA4DFA65C70_DepartedFeature_1
  fid (String) = osgb1000000849991256
  osgb_boundedby_box_srsname (String) = osgb:BNG
  osgb_boundedby_box_coordinates_decimal (String) = .
  osgb_boundedby_box_coordinates_cs (String) = ,
  osgb_boundedby_box_coordinates_ts (String) =
  osgb_boundedby_box_coordinates (String) = 254337.630,617076.680 254337.630,617076.680
  theme (StringList) = (1:Roads Tracks And Paths)
  reasonfordeparture (String) = Deleted
  deletiondate (Date) = 2022/09/26

Even


Le 22/12/2022 à 14:48, Andrew Terry a écrit :

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 <[email protected]>
*Sent:* 22 December 2022 13:20
*To:* Andrew Terry <[email protected]>; [email protected]
*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 <[email protected]> *Puolesta *Andrew Terry
*Lähetetty:* torstai 22. joulukuuta 2022 15.08
*Vastaanottaja:* [email protected]
*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


_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to