Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#4897 closed enhancement (fixed)

OGR GML driver - import multiple geometries in inspire data

Reported by: 45136 Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: OGR_SF Version: 1.11.1
Severity: normal Keywords:
Cc:

Description

Referring to this bug report: http://gis.stackexchange.com/questions/37217/why-are-the-polygons-in-my-gml-not-rendered?lq=1 only the last of several geometry tpyes inside a gml file gets imported. With a simple workaround - by editing the newly created .gfs file (as described in the answer), the data will get imported completely into Qgis using OGR2OGR driver in second run.

It would be nice to get this as a OGR2OGR layer creation option or even default. It might be necessary to parse the input file a second time.

Sample file can also be found here: http://gis.stackexchange.com/questions/41065/rendering-gml-in-qgis-1-9-0/41077#41077 I'm not sure why it did not work for the asker, I used the same data and got it working.

Change History (10)

comment:1 by Even Rouault, 11 years ago

Resolution: fixed
Status: newclosed

I had read that thread actually a few days ago and commited r25183 "GML: when there are several geometries per feature, use geometry inside <XX:geometry> element for Inspire compatibility" . I should have mentionned it in the gisstackexchange thread

in reply to:  1 comment:2 by 45136, 11 years ago

Replying to rouault:

I had read that thread actually a few days ago and commited r25183 "GML: when there are several geometries per feature, use geometry inside <XX:geometry> element for Inspire compatibility" .

I found that, but was not sure if it solves the problem the same way as the workaround.

I should have mentionned it in the gisstackexchange thread.

Can we hope that it will run with GDAL 1.10.0? I have no possibility to compile trunk myself.

comment:3 by Even Rouault, 11 years ago

You can already test the fix if you download a -development package from http://www.gisinternals.com/sdk/ for example (Windows builds)

comment:4 by 45136, 11 years ago

Resolution: fixed
Status: closedreopened

OK, got it running (only outside Qgis), but: now all polygons are imported (to shapefile with ogr2ogr), but not the points. The editor workaround did it the same way. Importing the gml again with Qgis and GDAL 1.9.1 driver gives me only the points. But this will not work with the next GDAL version anymore ...

Tested it with this dataset:

http://services.cuzk.cz/wfs/inspire-cp-wfs.asp?service=WFS&request=GetFeature&srsname=urn%3aogc%3adef%3acrs%3aEPSG%3a:5514&bbox=-551748,-1124214,-550000,-1124000&version=2.0.0&typename=CadastralParcel

comment:5 by Even Rouault, 11 years ago

I'm not sure to completely understand your need. You don't want only the geometry called "geometry", but all the geometries ? If so, yes you need to create .gfs file to access the "hidden" geometries, because there's no way in the OGR datamodel for a feature to have 2 geometries. One way to workaround this would be to extend the GML driver to report different layers, but this would be non trivial. Personaly, I'm not planning to implement that in the near future. A better investment would be for GDAL 2.0 to support multiple geometries per feature (which would be non trivial too !)

in reply to:  5 comment:6 by 45136, 11 years ago

Replying to rouault:

You don't want only the geometry called "geometry", but all the geometries ?

Yes, just import everything that fits to the OGR data types. Or let the user choose what he wants, by -lco or dco options.

If so, yes you need to create .gfs file to access the "hidden" geometries, because there's no way in the OGR datamodel for a feature to have 2 geometries. One way to workaround this would be to extend the GML driver to report different layers, but this would be non trivial.

GPX and libkml drivers do it in some way, so GML should be able to do it also.

Personaly, I'm not planning to implement that in the near future.

Thats why I would like to keep this ticket open.

comment:7 by Even Rouault, 9 years ago

Resolution: fixed
Status: reopenedclosed

Multiple geometry fields are supported since GDAL 1.11 and the GML driver was upgraded, so I believe this issue is fixed now

comment:8 by AndreJoost, 9 years ago

Milestone: 2.0
Version: 1.9.21.11.1

Still not working.

Loading the test dataset mentioned above into current QGIS, I see 76 polygon elements loaded, but not visible (why?). Transforming with GDAL 1.11.1 ogr2ogr to spatialite, I get the polygons visible, but still no way to access the stored points. Manipulating the gfs file to Geometry type 1 gives me the 76 points stored inside the when loading into QGIS.

Still no easy way to let the user choose which datatype he wants (preferably all).

comment:9 by Even Rouault, 9 years ago

qgis probably doesn't support yet multiple geometry fields. Spatialite driver hasn't been extended either (there's a ticket related to that), but PostGIS does. And you should be able to see geometries with ogrinfo. With ogr2ogr you can also select the geometry with -select geometry_field_name.

comment:10 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.