Hello,
I have a problem with displaying details on S-57 map. I’ve made a WinForms application which displays a S-57 map from FDOSamples (download.thinkgeo.com/Webina…amples.zip). Here is my an essential portion of my code and a screenshot of the result:
Map1.MapUnit = GeographyUnit.DecimalDegree;
S57FeatureLayer worldLayer = new S57FeatureLayer(@“C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 7.0\Samples\SampleData\Data\IHO S-57 (ENC)\GB4X0000.000”, null, null, “Area”);
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(worldLayer);
Map1.Overlays.Add(“Layers”, layerOverlay);
Map1.CurrentExtent = GetFullExtent(layerOverlay.Layers);
Map1.Refresh();
s14.postimg.org/nueljhsy9/sample_Poor.png
Then, I check this sample map (GB4X0000.000) in the viewer: SeeMyENC 2.0 (sevencs.com/download). Here is a screenshot of the result:
s14.postimg.org/enwaw7npt/sample_Full.png
As we can see, there is a LOT more in this sample map then I displayed in my application. My questions are as follows. How can I get access to all these details using Map Suite Desktop Edition? When I used S57FeatureLayer worldLayer like above, I didn’t get any symbols, text, numbers. How can I color specific areas of this map? In my application, whole map is one layer. I guess I have to read this map as multiple layers but how can I do this? Please help, this is urgent. I’m a beginner, so examples would be more then welcome.
Details on S-57 map
I’ve figured out that it is somehow related to styles. Can you provide me example of style that colors the sea and land to different colors? This would be a great start for me.
Hi Bart,
Could you please paste your screen shot in post? It looks your link picture is very hard to see clearly.
For your question, we need to know whether your land and sea data are in same file? If they are in same file, we need some way to split sea areas and land areas.
Sorry before we don’t have many samples about S-57 map so we need more detail information, and could you please create a simple project based on small data, which should be helpful for communication.
Regards,
Don
Ok, let’s start from the beginning. I’ll try to give you as much detail as possible.
Let’s assume we are using a sample S-57 map provided by ThinkGeo. You can find it on ThinkGeo wiki on this link: download.thinkgeo.com/Webina…amples.zip. In case you can’t download it, I’ve uploaded this file in this post. It’s in GB4X0000.zip.
Then, I’ve made a WinForms application using Map Suite WinForms Desktop Edition. I’ve tried to upload this application in this post, but the maximum file size allowed is 2048 kb. You can find this code here in this link: speedyshare.com/XWuuT/JustMapWinForms.zip. In case you can’t download it, I’ve pasted the code below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections.ObjectModel;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.DesktopEdition;
namespace JustMapWinForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Collection<
String
> paths = new Collection<
String
>();
paths.Add(“C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 7.0\Samples\SampleData\Data\IHO S-57 (ENC)\GB4X0000.000”);
Collection<
S57FeatureLayer
> areaLayers = new Collection<
S57FeatureLayer
>();
Collection<
S57FeatureLayer
> pointLayers = new Collection<
S57FeatureLayer
>();
Collection<
S57FeatureLayer
> lineLayers = new Collection<
S57FeatureLayer
>();
//these are collections in case of need of importing multiple S-57 cells
int k = 0;
foreach (String path in paths)
{
areaLayers.Add(new S57FeatureLayer(@path, null, “OGRSchema”, “Area”));
areaLayers[k].ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.SimpleColors.Blue, 1), new GeoSolidBrush(GeoColor.SimpleColors.Yellow));
areaLayers[k].ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
pointLayers.Add(new S57FeatureLayer(@path, null, “OGRSchema”, “Point”));
pointLayers[k].ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.SimpleColors.Transparent), new GeoPen(GeoColor.SimpleColors.Red), 2);
pointLayers[k].ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
lineLayers.Add(new S57FeatureLayer(@path, null, “OGRSchema”, “Line”));
lineLayers[k].ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.SimpleColors.Black,1));
lineLayers[k].ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
k++;
}
LayerOverlay layerOverlay = new LayerOverlay();
foreach (S57FeatureLayer areaLayer in areaLayers)
{
layerOverlay.Layers.Add(areaLayer);
}
foreach (S57FeatureLayer pointLayer in pointLayers)
{
layerOverlay.Layers.Add(pointLayer);
}
foreach (S57FeatureLayer lineLayer in lineLayers)
{
layerOverlay.Layers.Add(lineLayer);
}
Map1.MapUnit = GeographyUnit.DecimalDegree;
Map1.Overlays.Add(“Layers”,layerOverlay);
Map1.CurrentExtent = GetFullExtent(layerOverlay.Layers);
Map1.Refresh();
}
private RectangleShape GetFullExtent(GeoCollection<
Layer
> Layers)
{
Collection<
BaseShape
> rectangleShapes = new Collection<
BaseShape
>();
foreach (Layer layer in Layers)
{
layer.Open();
if (layer.HasBoundingBox == true) rectangleShapes.Add(layer.GetBoundingBox());
}
return ExtentHelper.GetBoundingBoxOfItems(rectangleShapes);
}
private void Map1_MouseMove(object sender, MouseEventArgs e)
{
PointShape pointShape = ExtentHelper.ToWorldCoordinate(Map1.CurrentExtent, new ScreenPointF(e.X, e.Y), Map1.Width, Map1.Height);
statusStrip1.Items[“toolStripStatusLabelWorld”].Text = “X:” + Math.Round(pointShape.X, 4) + " Y:" + Math.Round(pointShape.Y, 4);
}
private void btnZoomIn_Click(object sender, EventArgs e)
{
Map1.ZoomIn(60);
Map1.Refresh();
}
private void btnZoomOut_Click(object sender, EventArgs e)
{
Map1.ZoomOut(20);
Map1.Refresh();
}
private void btnPanUp_Click(object sender, EventArgs e)
{
Map1.Pan(PanDirection.Up, 20);
Map1.Refresh();
}
private void btnPanDown_Click(object sender, EventArgs e)
{
Map1.Pan(PanDirection.Down, 20);
Map1.Refresh();
}
private void btnPanLeft_Click(object sender, EventArgs e)
{
Map1.Pan(PanDirection.Left, 20);
Map1.Refresh();
}
private void btnPanRight_Click(object sender, EventArgs e)
{
Map1.Pan(PanDirection.Right, 20);
Map1.Refresh();
}
}
}
In order to better see the displayed map elements, I colored them as follows: Areas are yellow with blue borders, Lines are black, Points are red. You can find the result (a displayed map) of this code in a uploaded file in this post. It’s in sample_in_map_suite.zip.
Now, let’s open the same map in viewer of S-57 map. For example, we can use SeeMyENC, which can be downloaded from here: sevencs.com/files/downlo…ENC.20.zip. I’ve uploaded a file containing a image of what is displayed from this map. It’s in sample_in_seemyenc.zip.
Now, let’s talk what the problem. As you can see from sample_in_seemyenc.zip, there is a lot of data in S-57 file. You can see that land and sea can be distinguished by objects and attributes in S-57 format, each point has his own type and value, each city/port has his name displayed, etc. The problem I have in my Map Suite WinForms application is that the areas are not distinguished from one another, the lines are not distinguished and the points are not distinguished. Also, I don’t know how to extract any text or values from this map, like city names or point’s values. I do not even know how to achieve something so basic as to distinguish which Area is land and which is water, in order to color them in different colors. Is Map Suite capable of extracting all data from a S-57 map and distinguish different areas, lines, points, text? If so, how? We can begin to solve the problem by finding how to distinguish land areas from water areas in Map Suite and color them in different colors.
I hope I gave you enough information and communication is clear. This problem is urgent because my clients need to know if Map Suite will suit their needs and proper S-57 map displaying is one of them.
Best Regards,
Bart
GB4X0000.zip (317 KB)
sample_in_mapsuite.zip (283 KB)
sample_in_seemyenc.zip (550 KB)
Hi Bart,
Thank you very much for your detailed information and paying
attention to our products, but I think I need to say sorry for the questions on
the S-57 support, just as you know, the S57FeatureLayer in Map Suite is based
on FDO (Feature Data Objects), while its
S57 module is created based on the GDAL S57 module, it just support reading the
vector data (like points, lines, polygons etc.) and the related attributions as
column values, but it doesn’t support rendering the S57 vectors and its details
following the S-52
specification, which specifies the styles of each vector based on some
attributions, for example, in the demo data, we have kinds of the points, but
some are the port, some are the cities etc. S52 is the style guidance of these
points. In other words, the S57 rendering should have the embedded styles
following the S52 specification, like the CAD file, but Map Suite just
supporting reading these vectors and attributions, but doesn’t support
rendering them using embedded styles. currently, we have a team who are working
on this project, but you know, it’s really a big task, it will take a bit long
time, so I need to say sorry for this.
Thanks again and best regards!
Johnny