Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Centering a map on a longitude, latitude point
posted

I know this should be simple, but I can't seem to get it to work. I have a simple map that is an openStreetsTileSource. I'd like to center the map on a particular location based on the longitude and latitude point. I have written code that I thought would work, but it doesn't:

 

 

 

 

public 

 

 

void MoveMapToLocation(double longitude, double latitude)
{
    Point worldLocation =
new Point(longitude, latitude);

 

 

 

    // Convert Geodetic to Cartesian coordinates
    Point winCenter = this.theMap.MapProjection.ProjectToMap(worldLocation);
    this.theMap.WindowCenter = winCenter;
}

Does anyone have any ideas?

Thanks in advance.