Saturday 18 May 2019

c# - sharpmap overlay mapinfo on bing/google


I want to use sharpmap to overlay a mapinfo tab file onto google or bing.


I have it working pretty much at the moment however the co-ordinates that bing/google show are in correct so my mapinfo file doesnt make any sense to teh region its being overlayed on. I think I need to transform the mapinfo co-ordinates to the bing/google type but I'm not entirely sure how to do this or if this is the correct thing.


Im using sharpmap 0.9



This is my code so far


myMap = new Map(new Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));

var ogrProvider = new Ogr(@"C:\test.tab");

var layer = new VectorLayer("test");
layer.DataSource = ogrProvider;

var layerbing = new TileLayer(new BingTileSource(BingRequest.UrlBing, "", BingMapType.Aerial), "TileLayer");
//var layergoogle = new TileLayer(new GoogleTileSource(GoogleMapType.GoogleMap), "googlemaps");


myMap.Layers.Add(layerbing);
// myMap.Layers.Add(layergoogle);

myMap.Layers.Add(layer);
myMap.ZoomToBox(layer.Envelope);

When I run it up the "layer" has a SRID of 7 and the "layerbing" has a SRID of -1, I think this might be the issue and I need to transform the co-ordinates, but I'm not sure how to transfrom them and from/to what I need to.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...