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

Shapefile Layer + Google Map Layer

Topics: Data Access, General Topics, SharpMap Project, SharpMap v0.9 / v1.x, Web Controls, WinForms Controls
Jan 9, 2011 at 10:10 PM

Dear All


Is there some way I can have a SharpMap Map with my own local *.SHP file layer and a corresponding layer from Google Maps?  If so does anyone have the code for using the Google Map layer... the SHP layer is easy to impliment based on the "How to" code.





Jan 10, 2011 at 8:16 AM
Edited Jan 10, 2011 at 8:45 AM

Hello James,

it is fairly easy to do that using TileLayer class.

private static Map InitializeMapGoogle(GoogleMapType mt)
    Map map = new Map();

    GoogleRequest req;
    ITileSource tileSource;
    TileLayer tileLayer;
    if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels))
        req = new GoogleRequest(GoogleMapType.GoogleSatellite);
        tileSource = new GoogleTileSource(req);
        tileLayer = new TileLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite);
        req = new GoogleRequest(GoogleMapType.GoogleLabels);
        tileSource = new GoogleTileSource(req);
        mt = GoogleMapType.GoogleLabels;
        req = new GoogleRequest(mt);
        tileSource = new GoogleTileSource(req);

    tileLayer = new TileLayer(tileSource, "TileLayer - " + mt);
    return map;

You can use other tile sources as well, e.g. OpenStreetMap or Bing Maps. For more samples look at WinFormSamples project.

For Google Maps to work properly, you will have to update BruTile and -doing so- update the TargetFramework to 3.5.

You will need to reproject your shapefile to match coordinate system used by web tile provider.

Hth FObermaier

Jan 12, 2011 at 11:06 PM


I can reproject my shapefiles to GoogleMaps coordinate system, but ¿can I do it the other way?, I mean reproject the Google TileLayer to UTM for example.

That would help me because I have some Oracle Table with UTM X and Y coordinates and other Tables with Lat/Long coordinates. 

Jan 12, 2011 at 11:30 PM


with the help of gdal that would be possible, but will be very expensive and probably not look good. It is not the way to go.

I'd suggest you create some views on your Oracle database which reproject the features using Oracle database capabilities.

Hth FObermaier

Jan 13, 2011 at 3:04 PM

Ok Fobermaier, thanks. I'll do that.

Mar 3, 2011 at 11:18 AM

Is there any Codeexample for Google-Maps or Google-Earth or how to implement other sources?

Mar 3, 2011 at 12:27 PM

The WinFormSamples project has quite a few samples for doing that.

(see TileLayerSample.cs)

Hth FObermaier