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

shapefile question

Topics: SharpMap v2.0, WinForms Controls
Jan 31, 2014 at 2:30 PM
Hi, im using sharpmap to display lots of layers with moving points(vehicles) on top of a shapefile of our country, and everything is working fine... even the scaling of the symbols.

Then i try to swap the shapefile with one of the world, and now none of my pointlayers are showing.
Unless I zoom out like 50 times so that the world map is just a dot, then i see my point layers.

Any ideas what might cause this?
Any settings i should have on the shapefile,that i've missed?

Regards Roar
Feb 1, 2014 at 10:54 AM
It seems that your vector data is in a different coordinate system than your world shape file.
You need to set up a coordinate transformation

it should be sth like this
var ctFac = new ProjNet.CoordinateSystems.Transformation.CoordinateTransformationFactory();

var shpWorldProvider = new ShapeFile(....);
var csWorld = shpWorld.CoordinateSystem;

var shpLocalProvider = new ShapeFIle(...);
var csLocal = shpLocal.CoordinateSystem;

var lyrWorld = new VectorLayer("World", shpWorldProvider);
lyrWorld.CoordinateTransformation = ctFac.CreateFromCoordinateSystems(csWorld, csLocal);
For more information look at the Documentation | HowTo section
Feb 3, 2014 at 9:31 AM
Thanks for putting me on the right track!

After applying your code i realize they both already have the same crs namely:
{GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]]}
Which is the content of both the shapefiles .prj files.

So now i realize it must be some scaling issue.
seems the worldmap is 1:10m not quite sure what the scaling is on my localCountry shapefile..will investigate further
Thanks :)