This project has moved and is read-only. For the latest updates, please go here.

how to add points in geo location on s57 map and how to fill the file

Topics: Data Access, SharpMap Project, SharpMap v0.9 / v1.x
Aug 25, 2010 at 8:20 PM


i have to develop a project that track boats in the sea then update the boats location on s57 map. Now, i can load s57 but i can't add layer of boats objects.

please, i want to know how i can add objects on s57 map and what about *.tab file data?



Aug 26, 2010 at 7:37 AM
Edited Sep 15, 2010 at 9:53 AM

Hello msmprogrammer,

sharpmap v0.9 does not have updatable providers, you'd have to code updating your s57 map yourself.

sharpmav v2.0 does not have an OgrProvider yet, with witch you'd be able to update your s57 map.

EDIT: S57 OGR Driver is readonly, so still no chance to update S57 file.

If your boat positions are to be kept outside of the s57 file, you'd use some modified GeometryFeatureProvider and do updating of positions and/or I/O operations there.
You may want to look at the v0.95 deltares branch since it uses NHibernate for persisting objects.

Hth FObermaier

Aug 26, 2010 at 8:35 PM

Hello FObermaier,

Thank you for replay.

yes, i have the boat positions with x and y geo location outside of s57 file. what i want to add this objects on s57 map and the map after each 5 minutes refresh itself  with a new objects location .

i saw the file used in ogrsample class and the tab file is empty so how i can file it and used it. 

 i just want simple code to add object or layer of objects with a real geo location from database or file source on s57 map file.

the code that i saw in ogrsample file 


  LabelLayer layCityLabel = new LabelLayer("City labels");
            layCityLabel.DataSource = layCities.DataSource;
            layCityLabel.Enabled = true;
            layCityLabel.LabelColumn = "Name";
            layCityLabel.Style = new LabelStyle();
            layCityLabel.Style.ForeColor = Color.Black;
            layCityLabel.Style.Font = new Font(FontFamily.GenericSerif, 11);
            layCityLabel.MaxVisible = layLabel.MinVisible;
            layCityLabel.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left;
            layCityLabel.Style.VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom;
            layCityLabel.Style.Offset = new PointF(3, 3);
            layCityLabel.Style.Halo = new Pen(Color.Yellow, 2);
            layCityLabel.TextRenderingHint = TextRenderingHint.AntiAlias;
            layCityLabel.SmoothingMode = SmoothingMode.AntiAlias;
            layCityLabel.SRID = 4326;
            layCityLabel.LabelFilter = LabelCollisionDetection.ThoroughCollisionDetection;
            layCityLabel.Style.CollisionDetection = true;



Aug 27, 2010 at 7:39 AM
Edited Aug 27, 2010 at 7:43 AM

In that case I'd suggest you store and update your boat positions in a database (SqlServer2008, PostgreSQL (w/Postgis), SQLite (w/SpatiaLite)) and use the appropriate provider.

Be sure that Boat postitions and S57 data is in the same spatial reference system.

You cannot update/edit any data or geometry with SharpMap v0.9.

Hth FObermaier

Aug 27, 2010 at 12:50 PM

what is the scheme of datebase table and do you mean the boat positions and s57 data in the same file with extension (*.000) ?

please, can you describe your suggestion in more details and with simple code or example



Aug 31, 2010 at 9:02 PM

Ping... :D

Sep 1, 2010 at 9:08 AM

Hello msmprogrammer,

I don't quite understand what your requirements are:

  • Where do the boat positions come from?
  • Do you need to update any data in the s57 file or is that just for background?
  • What is the spatial reference system (coordinate system) of your boat positions, what is that of the s57 data.

cheers FObermaier

Sep 1, 2010 at 10:30 AM

Hello FObermaier

Thank you very much for replay.

  • each boat will send SMS every a period of time with it's coordinate and i will parse it .
  • the s57 will be just for background.
  • i don't know the coordinate system customer will be use and i asked the customer for coordinate system and example of s57 file.

After i get the s57 data file, i will send it to you.

Please, Can you tell me What is most common coordinate system used in 57 maps ?





Sep 15, 2010 at 2:59 AM

Hello FObermaier,

i got the s57 file from the customer but i can't load it and display message "Object reference not set to an instance of an object".

SharpMap demo work only on US5TX51.000

the s57 file link




Sep 15, 2010 at 9:15 AM

Hello msmprogrammer,

you are right, OgrProvider does not load the file you provided. I have no clue why. It seems to be FWTools related, since OgrProvider for SharpMap v2, relying on binaries provided by Tamas Szerekes works as expected. I'm not sure if a previous version of FWTools might help solve your problem.


Sep 22, 2010 at 5:15 AM

Hey msmprogramer,

Just thought I might make a comment and say that I dont think that attempting to store a track position in the S57 is the correct solution. The S57 format is used for electronic navigation chart distribution only, not a generic spatial database. You should probably use another spatial store and layer for track locations, and use the S57 as the chart behind it.



Sep 22, 2010 at 5:19 AM

Another note, the SRS is provided by the DSID layer of the S57 ENC. user ogr info to find it:

i.e. "ogrinfo US5TX51.000 DSID"

you can also access this in code. Example is shown in the FWTools installation. Check out

<fw tools install dir>\csharp\apps\ogrinfo.cs

Sep 22, 2010 at 8:11 AM

The driver for S57 in OGR is readonly anyway.