[gdal-dev] S57 objects’ catalog reload

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] S57 objects’ catalog reload

Jerome Siot-2

Hi,

 

I would like to change the s57 objects’ catalog while running between two open of  datasources.

How can I make S57ObjectClasses.csv reloaded ?

Or how can I change the loaded S57ObjectClasses ?

 

--

Merci, Jerome

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: S57 objects’ catalog reload

Even Rouault-2

Jerome,

 

>

> I would like to change the s57 objects’ catalog while running between two

> open of datasources. How can I make S57ObjectClasses.csv reloaded ?

> Or how can I change the loaded S57ObjectClasses ?

 

If your workflow is

 

open dataset 1

work with it

close dataset 1

change .csv file

open dataset 2

work with it

close dataset 2

 

then after "change .csv file", you could unload and reload the S57 driver so that the S57ClassRegistrar singleton gets destroyed and reloaded, with something like (untested):

 

GDALDriverManager* poDM = GetGDALDriverManager();

GDALDriver* poDrv = poDM->GetDriverByName("S57");

poDM->DeregisterDriver(poDrv);

delete poDrv;

RegisterOGRS57();

 

If you need to operate on 2 simultaneously opened datasets with different .csv files, then changes would be needed in the S57 driver.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: S57 objects’ catalog reload

Jerome Siot-2

Hi Even,

Thank you for your quick answer,

We work with C#, and unfortunately, we didn’t find GDALDriverManager API.

 

Instead, we tried algorithm you proposed with OGR Driver.DeRegister()/Register() : this does not work, csv change is not taked into account (csv file seems to be cached)

 

--

Jerome

 

From: Even Rouault [mailto:[hidden email]]
Sent: Friday, February 9, 2018 2:53 PM
To: [hidden email]
Cc: Jerome Siot
Subject: Re: [gdal-dev] S57 objects’ catalog reload

 

Jerome,

 

>

> I would like to change the s57 objects’ catalog while running between two

> open of datasources. How can I make S57ObjectClasses.csv reloaded ?

> Or how can I change the loaded S57ObjectClasses ?

 

If your workflow is

 

open dataset 1

work with it

close dataset 1

change .csv file

open dataset 2

work with it

close dataset 2

 

then after "change .csv file", you could unload and reload the S57 driver so that the S57ClassRegistrar singleton gets destroyed and reloaded, with something like (untested):

 

GDALDriverManager* poDM = GetGDALDriverManager();

GDALDriver* poDrv = poDM->GetDriverByName("S57");

poDM->DeregisterDriver(poDrv);

delete poDrv;

RegisterOGRS57();

 

If you need to operate on 2 simultaneously opened datasets with different .csv files, then changes would be needed in the S57 driver.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: S57 objects’ catalog reload

Even Rouault-2

Jerome,

 

> Thank you for your quick answer,

> We work with C#, and unfortunately, we didn’t find GDALDriverManager API.

 

There's in fact a more radical solution, and that should be available in C# as it is in the generic SWIG .i files

 

In Python (and likely the same in C#):

gdal.GDALDestroyDriverManager()

gdal.AllRegister()

 

 

>

> Instead, we tried algorithm you proposed with OGR

> Driver.DeRegister()/Register() : this does not work, csv change is not

> taked into account (csv file seems to be cached)

 

Yes, Driver.DeRegister() just removes the driver from the list of drivers that are tried, but that doesn't destroy it.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


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