This project has moved. For the latest updates, please go here.

View height

Topics: SharpMap v2.0, WinForms Controls
May 15, 2011 at 3:38 PM

Can I get the height of the view in metres, kilometres, etc.?

Thanks in advance.

May 18, 2011 at 8:20 AM


the SharpMap.Presentation.WinForms.MapViewControl has a WorldHeight property. It returns the height of the view in units of the underlying data. If you need e.g. meters and your data is lat/lon,  you need to setup a projection.

Hth FObermaier

May 19, 2011 at 3:52 PM

I saw this property, but don't understant how to use it, can you show example, please.

May 23, 2011 at 7:48 AM

I must admit, I do not understand your question.


May 24, 2011 at 5:56 AM

If your data is Lat/Lon you need to define a projection (for example Google World Mercator EPSG:900913 or an UTM-Zone projection covering your area) and then project the Maps current Envelope to that projection. Then the Height property will contain you views height in meters.

If your projection is already meterbased you only need to use the MapHeight property of the Map.


May 24, 2011 at 5:51 PM
Edited May 24, 2011 at 5:52 PM

I have created  my Projection:


            List<ProjectionParameter> parameters = new List<ProjectionParameter>(5);
            parameters.Add(new ProjectionParameter("latitudeoforigin", 0));
            parameters.Add(new ProjectionParameter("central_meridian", -93));
            parameters.Add(new ProjectionParameter("scale_factor", 0.9996));
            parameters.Add(new ProjectionParameter("false_easting", 500000));
            parameters.Add(new ProjectionParameter("false_northing", 0));
            IProjection projection = GeometryServices.CoordinateSystemFactory.CreateProjection("TransverseMercator", parameters, "TransverseMercator");
How to bind it to my map?


May 26, 2011 at 7:57 PM

Please help, after defining projection(and layer.CoordinateTransformation), my map became blank.

May 27, 2011 at 3:44 PM

Is that the projection of your data used?

In that case (it looks like a projected meter-based projection) the Value of the WorldHeight property of your map-object is the distance in meters from the top to the bottom of your map.

May 31, 2011 at 6:26 PM

After aplied my transformation, i have got my Height(in metres), but my map became blank (and i called map.ZoomToExtents() and extends is not null), but after some steps my map is shown normal. This steps are:

1. Many clicks on the map with ZoomOut tool.

2. Recall mapViewControl1.ZoomToExtents(),

(don't ask me how i found this way))

plese help me to fix that. i want a normal map after first mapViewControl1.ZoomToExtents() call.

Thanks in advance.

Jun 11, 2011 at 1:16 PM

Is there any ideas about problem with blank map after transformation

(why must to do mapViewControl1.ZoomToExtents();

to show my map). Thanks in advance.