Coordinates transform and loading tile layer

Topics: SharpMap Project
Mar 13, 2012 at 10:41 AM

I apologize if this topic has already been discussed: After browsing, shortly, the list of discussions and not finding it, I decided to give it a try.

My problem is this: I have a ShapeFile with coordinates in meters. I load it in a SharpMap view, and it is displayed ok. I load a tile layer (GoogleMaps), and it is not visible anymore: The coordinates are incompatible, the whole world map is an infinitesimal point inside a region of the SharpMap. Or the other way around.

I tried then to write a small function for loading ShapeFiles, where I define a coordinates transformation whose output is geographical coordinates, and attach this transformation to the ShapeFile layer. My transformation got lost after loading the tile layer: In my version of LayerCollection, the function OnInsert(...) sets the CoordinateTransformation of all vector layers to a TransformToMercator, regardless of whether the vector layers already had their own transformation or not.

What am I doing wrong?...