[Gdal-dev] ogr2ogr more GML 3.1 compatible

Jørn Vegard Røsnes jorn at spacetec.no
Fri Jan 27 11:15:02 EST 2006


On Friday 27 January 2006 15:03, Frank Warmerdam wrote:
> On 1/27/06, Jørn Vegard Røsnes <jorn at spacetec.no> wrote:
> > Hi,
> >
> > I'm continuing my experiments with ogr2ogr and GML.
> >
> > GML 3.1 is not using gml:coordinates anymore (deprecated)
> > Instead is this used in GML 3.1:
> > <gml:pos>17.0 69.0</gml:pos>
> > Unfortunately isn't this supported by ogr2ogr. Could this be implemented
> > soon?
>
> Jørn,
>
> I wouldn't mind doing this.  Please submit a bugreport against OGR
> with an example of a GML 3.1 file that you think would work if the
> gml:pos handling was added.  I will attempt to add it in the fairly
> near future.
>
Filed in bugzilla.

> > Another thing I notice is that only direct childs of the <feature>
> > element is extracted to PostGIS. Is it possible to implement so that all
> > childs and sub-elements are extracted?
>
> This is possible, but I have avoided it in the past due to the
> complexity.  I am assuming that nested elements would be
> treated as having unrolled column names?
>
> so
> <date>
>   <year>2005</year>
>   <month>December</month>
>   <day>25</day>
> </date>
>
> would appear in the result as attributes:
> date_year: 2005
> date_month: December
> date_day: 25
>
> Does that seem reasonable?  Please file a separate bug
> report with this suggestion but I don't have any plans to
> do it in the near term.
>
Sounds reasonable, may introduce some issues if element name contains 
underscore.
Another solution is to have XML subelements as separate tables with foreign 
keys, for example:

<gml:featureMember>
                <ais:feature>
                        <ais:MMSI>123456</ais:MMSI>
                        <ais:callsign>"CallMe"</ais:callsign>
                        <ais:name>"MS Ship</ais:name>
                        <ais:IMONumber>65432d1</ais:IMONumber>
                        <ais:length>75.3</ais:length>
                        <ais:beam>35.</ais:beam>
                        <ais:wesselType>cargo</ais:wesselType>
                        <ais:antennaLocation>aft of bow</ais:antennaLocation>
                        <ais:draught>3.2</ais:draught>
                        <ais:hazardousCargo>none</ais:hazardousCargo>
                        <ais:destination>Rotterdam</ais:destination>
                        <ais:expectedTimeOfArrival>2005-08-13T15:00:00</ais:expectedTimeOfArrival>
                        <ais:extraInfo>none</ais:extraInfo>
                        <ais:trackProperty>
                                <ais:track>
                                        <ais:objectStatus>
                                                <gml:pos 
srsName="LL-WGS84">17.0 69.0</gml:pos>
                                                <ais:time>2005-08-13T04:37:15</ais:time>
                                                <ais:speedOverGround>11.</ais:speedOverGround>
                                                <ais:courseOverGround>17.3</ais:courseOverGround>
                                                <ais:heading>16.0</ais:heading>
                                                <ais:bearing>15.3</ais:bearing>
                                                <ais:rateOfTurn>2.14</ais:rateOfTurn>
                                                <ais:navigationalStatus>underway</ais:navigationalStatus>
                                                <ais:safetyMessage>none</ais:safetyMessage>
                                                <ais:dataSource>AIS transp. 
sys. x</ais:dataSource>
                                        </ais:objectStatus>
                                        <ais:objectStatus>
                                                <gml:pos>17.5 69.5</gml:pos>
                                                <ais:time>2005-08-13T04:38:00</ais:time>
                                                <ais:speedOverGround>11.</ais:speedOverGround>
                                                <ais:courseOverGround>17.3</ais:courseOverGround>
                                        </ais:objectStatus>
                                </ais:track>
                        </ais:trackProperty>
                        <ais:time>1967-08-13T17:39:15</ais:time>
                        <ais:dataSource>Kystverket</ais:dataSource>
                        </ais:feature>
        </gml:featureMember>

would in PostGIS result in the following tables:
ais:feature
ais:trackProperty with foreign key (fk) to ais:feature
ais:track with fk to ais:trackPropery
ais:objectStatus with fk to ais:track


If someone has ideas how to redesign this XML I would appreciate it. The XML 
is a response to a AIS query (WFS or DB),  with one static part (ship info) 
and one dynamic part (ship tracking info).

cheers
Joern
Have a nice weekend!



More information about the Gdal-dev mailing list