S57 map files

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

S57 map files

Florian El Ahdab
Hello the lists.

I have been trying to open S57 maps that I use at work in Qgis 1.0.0 without too much success (I tried a few months ago on a previous version without success either...).

Actions:
Fresh new Qgis project
Add a vector layer
Select the XXXXXXX.000 s57 file and click ok.

Results:
A new layer appears. Nothing gets displayed in the map window. The attributes table for the layer is empty (there are some columns available, but no data). No error is displayed on the console.

Research already conducted:
I have been trying to understand what was happening by browsing qgis and gdal sources, and writing a python plugin to inspect the layer.
I think I can now say:
- OGR loads the map without any error (the s57 driver is correctly loaded, and generates no error when given my data file)
- Qgis gets the layer from OGR without error. However, this layer as seen trough the QgsVectorLayer or the QgsMapLayer interfaces (python plugin to do that) presents 0 features and no subLayers. The extent is 0,0,0,0.

The file itself is good. I can convert it to Mapinfo or GML with ogr2ogr even if some layers generate errors (s57 features that can't be converted to other format I believe). All files that I have tried are used every day in an ECDIS commercial system so I assume the data to be correct.

So here are my questions:
- has anyone ever worked with S57 and OGR and/or Qgis?
- I believe Qgis doesn't use the S57 sublayers and that's why nothing gets displayed. Is there any chance that I am right? If I am right, I would like to help with the implementation for this kind of problem. Can anyone in the dev team give me directions on where to begin (I have spent some time in the source and API of both Qgis and GDAL and feel I can contribute here...)

Thanks a lot.
Florian

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: S57 map files

Chris Herrnberger
On Sunday 18 January 2009 11:04:13 Florian El Ahdab wrote:

> So here are my questions:
> - has anyone ever worked with S57 and OGR and/or Qgis?

This discussion came up on the gpsdrive list and i've included the pertinent
parts for you review:

----------------------------------------------------------------
From Hamish Bowman:

For ENC support in GpsDrive it is still my hope that libS52
could be used to render the data, in a similar way as Mapnik
is rendering OSM data now.

see
http://apps.sourceforge.net/mediawiki/gpsdrive/index.php?title=Marine_Howto
  (please help improve the wiki page!)

http://grass.osgeo.org/wiki/BSB_data
http://grass.osgeo.org/wiki/S-57_data#libS52
http://openev.cvs.sourceforge.net/openev/contrib/S52/


the very tricky bit is choosing which layers to include. the S-52
gives recommendations of which features to display based on map
scale class, I'd say reuse those. But you would have to enter
that data by hand. If someone provides a list of layernames
per scale band, I might do the rest.

----------------------------------
response: me, requesting a tutorial to review the material.
---------------------------------------------------
response: Hamish
---------------------------------------
see SCAMAX and SCAMIN entries in the libS52 CVS file doc/att.txt,

for each token these control which map scales (e.g. 1:25,000-1:100,000)
the feature should be rendered.

and read through the remarks in S52CS.c in the libS52 source
// S52CS.c : Conditional Symbologie procedure 3.2 (CS)

(ignore the code, just look at the comments...)

and the IHO PDF spec docs,
http://grass.osgeo.org/wiki/S-57_data#GRASS_S-52_interface_for_rendering_S-57_data

and you may see why I defer :). It's all there & coded, but a bit daunting
to me.

My idea is a little wrapper C program around S52CS.c to export tokens
based on a list of scales would help us make a table which we could use
in developing the list of layers for the WMS request.

------------------------------
since qgis is used extensively in preparing maps for gpsdrive and there is
significant interest wrt marine navigation where most charts are S-57 vectors
the long term goal (very long term) is to move toward a plugin for qgis to
manipulate the data in order to make it available to gpsdrive. However its a
bit of a challenge as you can see, I'm not a developer, rather just a listee
with sailboat so I keep interested in this stuff.


> - I believe Qgis doesn't use the S57 sublayers and that's why nothing gets
> displayed. Is there any chance that I am right? If I am right,

Your most likely correct.

> I would like
> to help with the implementation for this kind of problem. Can anyone in the
> dev team give me directions on where to begin (I have spent some time in
> the source and API of both Qgis and GDAL and feel I can contribute here...)

Perhaps a good start would be reviewing the submitted material above and then
following the directions and advice of the qgis development team.

Best of luck

/ch

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: S57 map files

Martin Dobias
On Sun, Jan 18, 2009 at 6:52 PM, Chris h <[hidden email]> wrote:
> On Sunday 18 January 2009 11:04:13 Florian El Ahdab wrote:
>> - I believe Qgis doesn't use the S57 sublayers and that's why nothing gets
>> displayed. Is there any chance that I am right? If I am right,
>
> Your most likely correct.

Yes, QGIS always opens first sublayers and doesn't care about the rest.


>> I would like
>> to help with the implementation for this kind of problem. Can anyone in the
>> dev team give me directions on where to begin (I have spent some time in
>> the source and API of both Qgis and GDAL and feel I can contribute here...)
>
> Perhaps a good start would be reviewing the submitted material above and then
> following the directions and advice of the qgis development team.

First of all, a small change in OGR provider in QGIS will be needed to
allow sublayers. This provider awaits a file as input string - let's
add an optional parameter that would specify the layer inside the
file, e.g.:
/data/gis/s-57/ca49995b.000&layer=4
(note the added "&layer=4")

Then in GUI: when an input file for OGR provider is selected, check
whether there's more than one sublayer - if so, open a dialog and let
user select which sublayers he would like to see. Create input strings
for OGR provider from the chosen sublayers and load them.

Patches are always welcome :-)

Martin
_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: S57 map files

Florian El Ahdab
Thank you to both of you for your very valuable inputs.

I've browsed the ogrprovider code and found how to implement your proposal. Although I still haven't modified anything, I've made a few tries that seem encouraging.

Martin: I am hoping to reach an acceptable solution for opening S57 layers on demand soon. I will also have to set up svn to produce the actual patch appropriately.

Chris: The S52 implementation will obviously be the next step. Thank you for all this information (I had no idea the S52 was actually already coded somewhere... That's good news!)

See you soon.
Florian

On Sun, Jan 18, 2009 at 8:14 PM, Martin Dobias <wonder.sk@gmail.com> wrote:
On Sun, Jan 18, 2009 at 6:52 PM, Chris h <[hidden email]> wrote:
> On Sunday 18 January 2009 11:04:13 Florian El Ahdab wrote:
>> - I believe Qgis doesn't use the S57 sublayers and that's why nothing gets
>> displayed. Is there any chance that I am right? If I am right,
>
> Your most likely correct.

Yes, QGIS always opens first sublayers and doesn't care about the rest.


>> I would like
>> to help with the implementation for this kind of problem. Can anyone in the
>> dev team give me directions on where to begin (I have spent some time in
>> the source and API of both Qgis and GDAL and feel I can contribute here...)
>
> Perhaps a good start would be reviewing the submitted material above and then
> following the directions and advice of the qgis development team.

First of all, a small change in OGR provider in QGIS will be needed to
allow sublayers. This provider awaits a file as input string - let's
add an optional parameter that would specify the layer inside the
file, e.g.:
/data/gis/s-57/ca49995b.000&layer=4
(note the added "&layer=4")

Then in GUI: when an input file for OGR provider is selected, check
whether there's more than one sublayer - if so, open a dialog and let
user select which sublayers he would like to see. Create input strings
for OGR provider from the chosen sublayers and load them.

Patches are always welcome :-)

Martin
_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user


_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: S57 map files

Chris Herrnberger
On Sunday 18 January 2009 17:25:05 Florian El Ahdab wrote:

> Chris: The S52 implementation will obviously be the next step. Thank you
> for all this information (I had no idea the S52 was actually already coded
> somewhere... That's good news!)

Thanks for the compliment but passing on information as received from Hamish
on the gpsdrive list. He's one of the developers driving the nautical
component. I'm just testing stuff as it comes down the pipe but glad to beof
help as such a pluggin would be very very practical. Pls allow me to
encourage you.

Best regards and thanks

--
/ch
_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: S57 map files

hamish-2
In reply to this post by Florian El Ahdab
[sorry, I replied to the wrong list (and missed most of the thread).
Thankfully Gmane does a nice job of rejoining cross-posts]

Chris mostly posted what I was going to say, but FWIW here is my message
to the qgis-dev list:
  http://thread.gmane.org/gmane.comp.gis.qgis.user/3685/focus=4887


Martin wrote:
> Yes, QGIS always opens first sublayers and doesn't care about the rest.

:-/


Florian:
> I had no idea the S52 was actually already coded somewhere... That's
> good news!

Yes, it's great news. It is a huge task and I am quietly amazed at the job
Sylvain Duclos has done on it.


Chris:
> since qgis is used extensively in preparing maps for gpsdrive

is it? personally to make map tiles I use a combination of gdal tools,
grass's d.out.gpsdrive module, and gpsdrive code which creates a
specially crafted WMS request.

> Pls allow me to encourage you.

me too,
Hamish
_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user