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

SharpMap 1.0 can not load Shapefile

Nov 25, 2013 at 1:43 AM
I am programing with SharpMap 1.0 and ShapeFile Data provider, my code:
        SharpMap.Map _map = new Map(_mapImage.Size);
        string shape = @"E:\TD21763.shp";
        SharpMap.Layers.VectorLayer vlayer = new Layers.VectorLayer("Vlayer");
        vlayer.DataSource = new SharpMap.Data.Providers.ShapeFile(shape);
        _mapImage.Map = _map; //error here
Error message: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
What's error in my code? In SharpMap 0.9 it run successful.
Nov 25, 2013 at 7:45 AM
Is it possible for you to share the shapefile so we can use if for debugging?
Nov 25, 2013 at 8:00 AM
Hi petlof,
link of my shapefile:
It run on SharpMap 0.9
I try to add shapefile by using NetTopologySuite ShapefileReader, but it raise an error about GeoAPI.dll version, NTS 1.13 use GeoAPI 1.7.0 and SharpMap 1.0 use GeoAPI 1.7.1, error message:
The type 'GeoAPI.Geometries.IGeometryCollection' is defined in an assembly that is not referenced. You must add a reference to assembly 'GeoAPI, Version=, Culture=neutral, PublicKeyToken=a1a0da7def465678'.    
Nov 26, 2013 at 8:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 27, 2013 at 2:33 AM
Thanks a lot, petlof
It worked on MapImage, but seem not work on MapBox, it do not raise any error but do not display map.
MapImage will be replace by MapBox in next version?
Nov 27, 2013 at 6:48 AM
MapImage is obsolete and is replaced by MapBox, i strongly recommend using MapBox.
Please not that MapBox is Async, so the first load of your shapefile will take some time before it appears but is should be much faster after that.
Nov 28, 2013 at 1:04 AM
It's worked,
Thanks, petlof.