Le lundi 15 décembre 2014 14:46:06, Piotr Pachół a écrit : > Hello, > > I have gml file with geometries of different types (Points, Lines, > Polygons) > I try to import it into PostGIS with this command: > ogr2ogr -a_srs EPSG:2180 -f "PostgreSQL" PG:"host=localhost > user=postgres dbname=test password=*** port=5432" c:\test.xml -nlt > PROMOTE_TO_MULTI > > Almost everything works OK except objects like that: > > <gml:featureMember> > <KR> > <bt:kod>0010_803</bt:kod> > <bt:geometria> > <gml:LineString gml_id="ID_1" srsName="EPSG:2180" srsDimension="2"> > <gml:posList>479444.04 317832.37 479447.99 317823.28 > </gml:posList> > </gml:LineString> > </bt:geometria> > <bt:geometria> > <gml:LineString gml_id="ID_2" srsName="EPSG:2180" srsDimension="2"> > <gml:posList>479659.15 318668.28 479695.28 318671.1 > </gml:posList> > </gml:LineString> > </bt:geometria> > </KR> > </gml:featureMember> >
Piotr, Hum, this is an annoying form of GML with several geometry fields AND with the same name... GDAL 1.11 should normally be able to support multiple geometry fields, but in that case, that will not work as they have the same name. In fact, you might want to try instead an older trick, quite experimental and not officially documented. Try setting GML_FETCH_ALL_GEOMETRIES=YES as configuration option/environment variable <!-- OGR 1.8.0 adds support to "merge" the multiple geometries found in a feature by setting the configuration option <b>GML_FETCH_ALL_GEOMETRIES</b> to <b>YES</b>. The geometries will be collected into a GeometryCollection (or Multipolygon if individual geometries are polygons or multipolygons). This can be useful when reading some GML application profiles. If a <GeometryElementPath> element is specified in the .gfs, the fetching will be limited to paths that match the value of <GeometryElementPath>.<p> --> Even > In above example object consists of 2 parts and only second part of > geometry(gml_id="ID_2") is imported to PostGIS. > What should I do to import all the parts of the geometry of an object? > > Regards, > Piotr > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
