1

I am currently working on sharpmap project with the need to work on offline maps. As i am fresher in this field,I am following the sharpmap tutorial and facing a problem with loading new shape files in the given tutorial code.

For Example :

SharpMap.Layers.VectorLayer("States");
        vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("path_to_data\\states_ugl.shp", true);

At this line of code,if i pass a different shapefile,code builds with a blank background or no display. I have tried with different shape files with different sizes but the result is the same. It only works for the mentioned states_ugl.shp file given in the code.

1

1 Answer 1

1

My suggestion is look at the sample code the is in the SharpMap solution. Source code: older on CodePlex https://sharpmap.codeplex.com/

Current Fork on GitHub https://github.com/SharpMap/SharpMap It was pretty easy to get to compile using VS2013 or VS2015. Open SharpMap.sln Take a look at Examples\WinFormSamples and Examples\DemoWinForm projects

A couple things I learned over the years using shapeFiles. - Older shapefiles mid 1990s can be problematic to use. (I have a volcanoes shape file what had a duplicate column name (allowable in DBF but not MS access or FoxPro). And older versions SharpMap would error out

  • Check shapefile projection/Coordindations. Most common issue is the shape file is plotted to an incorrect position due coordinate transformation error.

  • Use a viewer like ESRI ArcGIS Explorer to validate the shapefile.

3
  • Thans Sir i finally cleared my doubt and code is running.
    – Shreee
    Commented Jul 12, 2016 at 6:10
  • Sir can u tell me how to draw a circle on a given layer or on a shapefile?Is there any way to draw a circle knowing the center point and the radius?Being a beginner i have very less knowledge of this part.Also if u can tell me if it is necessary to add a layer on existing layer while drawing a circle or we can draw it on the same existing layer of the shapefile?Thanks
    – Shreee
    Commented Jul 12, 2016 at 6:14
  • sory forgot to mention using sharpmap only.Thanks.Please can anyone guide me through this?Thanks again.
    – Shreee
    Commented Jul 12, 2016 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.