Focus on a specific area with latitude/longitude

Dec 3, 2009 at 11:22 AM

i want to focus desired location in mapControl by giving longitude and latitude as input
It has the ability to focus on a specific area ?

Dec 4, 2009 at 2:21 PM

Hi qasem,

To center the map on a position you can use:

mapControl1.Transform.Center = new BTPoint(629816, 6805085);

However, the center you specify here needs to be in the coordinate system of the of the map. In most of the samples I use this is in SphericalMercator (epsg:3785). So if you have a point in LonLat you need to convert is to SphericalMercator. There is no functionality for projection in the current version. The plan is to use SharpMap's projection for this and integrate it in BruTile. The sample project here: has an aspx page which happens to show how to do the projection you need. 

Good luck, and let me know if it works. 

btw, which platform do you use?


Dec 6, 2009 at 8:30 PM

hi Paul :)

Thank you for helping me

i m use windows application

I also wpf and silverlight to try

Thanks again for developing this nice project . good luck

Dec 9, 2009 at 9:27 PM
Edited Dec 9, 2009 at 9:29 PM

Hi ...

This code worked for me

i'm using this WKT EPSG:3395

PROJCS["Mercator_2SP",GEOGCS["unnamed ellipse",DATUM["D_unknown",SPHEROID["Unknown",6378137,0]],




This article will help me too:)

/// <summary>
    /// Create coordinatesystem based on a Well-Known text
    /// </summary>
    /// <param name="wkt"></param>
    /// <returns></returns>
    private ICoordinateSystem CreateCoordinateSystemFromWKT(string wkt)
        CoordinateSystemFactory cFac = new CoordinateSystemFactory();
        return cFac.CreateFromWkt(wkt);

        IProjectedCoordinateSystem utmProj =(IProjectedCoordinateSystem) CreateCoordinateSystemFromWKT(WKM_string);
        //Create geographic coordinate system (lets just reuse the CS from the projection)
        IGeographicCoordinateSystem geoCS = utmProj.GeographicCoordinateSystem;
        //Create transformation
        CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
        ICoordinateTransformation trans = ctFac.CreateFromCoordinateSystems(geoCS, utmProj);
        double[] fromPoint = new double[] { 51.422539 , 35.709026};
        double[] toPoint = trans.MathTransform.Transform(fromPoint);
     mapControl1.Transform.Center = new Point((int)toPoint[0], (int)toPoint[1]);



Dec 10, 2009 at 11:10 AM

Thanks for posting this back!

Did spherical mercator (epsg 3785 or 900913) not work for you?


Dec 10, 2009 at 2:29 PM


900913 did not test , but 3785 did not work correctly for me

Dec 10, 2009 at 3:29 PM

okay, and what kind of background data did you use?


Dec 10, 2009 at 5:55 PM
pauldendulk wrote:

okay, and what kind of background data did you use?


I do not understand your purpose!!!

But if you mean this is what was my source for the conversion

i must say,I use the WGS 84 That is read from the GPS device

Excuse me , my English is poor :)

Dec 11, 2009 at 12:43 PM

I expected that 3785 would work for the OSM, Bing or Google backgrounds that are mostly used. So I am trying to figure out where I was wrong, maybe you use a differend background layer, that is why I asked. 

I just download the project and saw that 3785 was not supported yet. It still uses the old 900913 espg. So that is probably why it didnt work for you.


Dec 11, 2009 at 2:43 PM

Yes I know does not yet supported.
So I tried to find the WKT 3785,

PROJCS["Popular Visualisation CRS / Mercator", GEOGCS["Popular Visualisation CRS", DATUM["Popular Visualisation Datum", SPHEROID["Popular Visualisation Sphere", 6378137, 0, AUTHORITY["EPSG",7059]], TOWGS84[0, 0, 0, 0, 0, 0, 0], AUTHORITY["EPSG",6055]], PRIMEM["Greenwich", 0, AUTHORITY["EPSG", "8901"]], UNIT["degree", 0.0174532925199433, AUTHORITY["EPSG", "9102"]], AXIS["E", EAST], AXIS["N", NORTH], AUTHORITY["EPSG",4055]], PROJECTION["Mercator"], PARAMETER["False_Easting", 0], PARAMETER["False_Northing", 0], PARAMETER["Central_Meridian", 0], PARAMETER["Latitude_of_origin", 0], UNIT["metre", 1, AUTHORITY["EPSG", "9001"]], AXIS["East", EAST], AXIS["North", NORTH], AUTHORITY["EPSG",3785]]

Unfortunately, this does not work for me

So I found WKT  3395, that worked for me  in the background of "OSM" and "Google" and "Bing"

900913 still did not test