[gdal-dev] GDAL 2.1 and Norwegian SOSI

Blumentrath, Stefan Stefan.Blumentrath at nina.no
Fri May 6 02:12:45 PDT 2016


Hei Even,

Now I investigated a bit more and it seems that the development at our mapping authority and gdal diverged a bit.

There is a (partly) newer version of the OGR-SOSI driver at the github repository of our mapping authority:
https://github.com/OSGeo/gdal/compare/trunk...kartverket:trunk

Especially this commit contains changes that might fix the issue with geometry type 5 (and 20), plus provides some improvements on attribute-type mapping:
https://github.com/OSGeo/gdal/commit/321bc979f112e46e05e45a9363d39de5343709fc

Would you mind integrating those changes? That would be really great. However, I understand that you already spend a significant amount of unpaid time (unfortunately I have no resources I could allocate to this) on this rare driver, so I understand if you choose not to. In the latter case I could try to provide a fix myself. Would you prefer a SVN diff in that case?

Since geometry type 5 is a curved geometry, which was not supported by GDAL OGR at that time, the commit above interpolates the curve to a line feature. Maybe better to generate a curved OGR geometry instead of a line?

Anyway, thanks for all your support and work on GDAL/OGR!

Cheers
Stefan

-----Original Message-----
From: Even Rouault [mailto:even.rouault at spatialys.com] 
Sent: 4. mai 2016 09:49
To: Blumentrath, Stefan <Stefan.Blumentrath at nina.no>
Cc: gdal-dev at lists.osgeo.org; Thomas Hirsch (Thomas.Hirsch at kartverket.no) <Thomas.Hirsch at kartverket.no>
Subject: Re: [gdal-dev] GDAL 2.1 and Norwegian SOSI

Le mercredi 04 mai 2016 09:32:13, Blumentrath, Stefan a écrit :
> Hei again,
> 
> First of all, now the SOSI file opens fine again. So, many thanks for that!
> 
> Unfortunately, I now get a new error on ogrinfo 
> ./ADM_kommune_0620_Hol.sos lines
> 
> Layer name: lines
> Geometry: Line String
> ERROR 4: Unrecognized geometry of type 5.
> ERROR 1: Feature 82 referenced by 2204, but it was not initialized.
> Aborted (core dumped)
> 
> I get it for polygons too. Geometries of type 5 are curved geometries 
> which got introduced in SOSI version 4.5 - if I am not mistaken...
> 
> Geometry type 5 (BUEP) is defined in
> https://github.com/kartverket/fyba/blob/master/src/FYBA/fyba.h (Line 
> 408)... Would it be sufficient to add something like: case
> wkbCompoundCurve: {
>             pszSosi = ".BUEP";
>             break;
>         }
> to: ogr/ogrsf_frmts/sosi/ogrsosilayer.cpp (not sure if the translation 
> is 100% correct)

That would be for the write side of the driver. GetNextFeature() should likely be modified

> 
> But maybe also trunk/gdal/ogr/ogrsf_frmts/sosi/ogrsosidatasource.cpp 
> needs modification...? (I am no programmer).

Yes, the Open() method seems to be where OGR geometries are built from SOSI ones. Would need to be extended for curves.

> 
> Seems to be an older issue and other GeometryTypes seem to cause 
> trouble
> too:
> http://gis.stackexchange.com/questions/132888/ogr2ogr-problem-converti
> ng-s
> osi-fil-to-kml-or-anything-else
> 
> Cheers,
> Stefan
> 
> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at spatialys.com]
> Sent: 3. mai 2016 21:33
> To: gdal-dev at lists.osgeo.org
> Cc: Blumentrath, Stefan <Stefan.Blumentrath at nina.no>
> Subject: Re: [gdal-dev] GDAL 2.1 and Norwegian SOSI
> 
> Le mardi 03 mai 2016 21:06:14, Blumentrath, Stefan a écrit :
> > Dear GDAL-devs,
> > 
> > I just tried to open a Norwegian SOSI file with ogrinfo from GDAL 
> > 2.1dev but get: FAILURE:
> > Unable to open datasource `./ADM_kommune_2018_Masoy.sos' with the 
> > following drivers.
> > 
> > 'ogrinfo --formats' does not list the SOSI driver either. But I am 
> > sure I did compile with '--with-sosi' and gdal-config --dep-libs 
> > lists the openfyba libs used for the driver.
> 
> Hum, I see this is actually a 2.1.0 regression.
> Fix available in https://trac.osgeo.org/gdal/ticket/6500
> 
> > So my question is,: were there any changes from 1.11 to 2.x which 
> > may affect the driver? Any chance someone will make that working again?
> > Unfortunately our mapping authority does not seem to be maintaining 
> > the OpenFYBA lib any more (SOSI version 4.5 not yet supported), so I 
> > can understand if you are not too keen on fixing the issue (if it is 
> > not local).
> > 
> > Thanks for any help.
> > 
> > Kind regards,
> > Stefan
> 
> --
> Spatialys - Geospatial professional services http://www.spatialys.com

--
Spatialys - Geospatial professional services http://www.spatialys.com


More information about the gdal-dev mailing list