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

some information missing while loading enc ‘.000’ map

Topics: General Topics
Feb 18, 2015 at 7:49 AM
Hi, I am new user of SharpMap, when I call the InitializeS57() method, the enc ‘US5TX51M.000’ file is loaded but some information is missing like lat/long, various text on map etc.. (I think label information is missing from map), but when I load the same file with GlobalMapper sdk, the all label information is displayed, which were not displayed with SharpMap) what I am missing in code ???, please check and reply.

private static Map InitializeS57(float angle)
        //Initialize a new map of size 'imagesize'
        Map map = new Map();

        //Set the datasource to a shapefile in the App_data folder
        Ogr provider;
            provider = new Ogr("GeoData/S57/US5TX51M.000");
        catch (TypeInitializationException ex)
            if (ex.Message == "The type initializer for 'OSGeo.OGR.Ogr' threw an exception.")
                throw new Exception(
                        "The application threw a PINVOKE exception. You probably need to copy the unmanaged dll's to your bin directory. They are a part of fwtools {0}. You can download it from:",

        VectorLayer lay;
        Random rnd = new Random(9);
        for (Int32 i = provider.NumberOfLayers - 1; i >= 0; i--)
            Ogr prov = new Ogr("GeoData/S57/US5TX51M.000", i);
            if (!prov.IsFeatureDataLayer) continue;
            string name = prov.LayerName;
            System.Diagnostics.Debug.WriteLine(string.Format("Layer {0}: {1}", i, name));
            //if (provider.GeometryType )
            lay = new VectorLayer(string.Format("Layer_{0}", name), prov);
            if (prov.OgrGeometryTypeString.IndexOf("Polygon") > 0)
                lay.Style.Fill =
                    new SolidBrush(Color.FromArgb(150, Convert.ToInt32(rnd.NextDouble() * 255),
                                                  Convert.ToInt32(rnd.NextDouble() * 255),
                                                  Convert.ToInt32(rnd.NextDouble() * 255)));
                lay.Style.Outline =
                    new Pen(
                        Color.FromArgb(150, Convert.ToInt32(rnd.NextDouble() * 255),
                                       Convert.ToInt32(rnd.NextDouble() * 255),
                                       Convert.ToInt32(rnd.NextDouble() * 255)),
                        Convert.ToInt32(rnd.NextDouble() * 3));
                lay.Style.EnableOutline = true;
                lay.Style.Line =
                    new Pen(
                        Color.FromArgb(150, Convert.ToInt32(rnd.NextDouble()*255),
                                       Convert.ToInt32(rnd.NextDouble()*255), Convert.ToInt32(rnd.NextDouble()*255)),
        _ogrSampleDataset = "S-57";

        Matrix mat = new Matrix();
        mat.RotateAt(angle, map.WorldToImage(map.Center));
        map.MapTransform = mat;

        return map;
Feb 18, 2015 at 8:24 AM
There is no LabelLayer in the code you are presenting.
Feb 20, 2015 at 4:49 AM
Above mention code has been captured from WinFormSample \ OgrSample.cs file, my scenario is same, I give any ‘.000’ file to this procedure and this method load enc file in map object, but without labels, how can I add label layers in the above code, please give me a short example