Polygon Positioning

Topics: Bugs, WPF
Sep 11, 2012 at 8:56 PM


I am using the WPF version of GMaps.NET and I have a question concerning the positioning of Polygon markers.

I am using the polygon to represent the FOV of a camera. I have tiepoints for the FOV in LatLng, and I am adding them to the GMapMarker.Polygon collection. However the points are not being displayed in the correct position.

To my surprise, I found that when I set the position of the marker itself, e.g. the GMapMarker.Position property, it moves the polygon around on the map.

1. My assumption now is that I have to compute the center of the FOV and find its LatLng location to position the polygon correctly, is this correct? 

2. Why do I enter the tiepoints in LatLng if they are not displayed at the LatLng coords I give it?

3. Is there a better way to do this?

thanks a lot 

Sep 11, 2012 at 9:04 PM

gpolygon is just a marker with a first point as polygon start point

Sep 11, 2012 at 9:46 PM

Thanks for the quick reply


Unfortunatly I don't really understand your answer. Do you mean that the position of the polygon determines the location of the first point in the collection?

Sep 11, 2012 at 9:52 PM

not determines, but it's a reference point

Sep 11, 2012 at 11:09 PM

Sorry man not enough detail, maybe it is my fault. I need to position the following polygon correctly, here is my code. 

	    //convert the LLH Tie points of the camera to overlay coordinates
            List<PointLatLng> TiePtsLLH = _CurrentCam.LLHTiePts();

            PointLatLng cen = (PointLatLng)_CurrentCam.Site.EnuOrigin;

            //update the fov polygon
            GMapMarker polyMark = new GMapMarker(cen);
            for (int i=0; i<4; i++)

            (polyMark.Shape as DrawPath).Stroke = Brushes.Maroon;
            (polyMark.Shape as DrawPath).Fill = Brushes.Transparent;
            (polyMark.Shape as DrawPath).StrokeThickness = 2;



What I want is for the LLH points I am adding in the loop to be the actual displayed locations of the corners in the polygon, can you advise me on how to do this?

Right now I am using the origin of our local ENU coordinate system as this "reference" location, but this is not giving me correct locations.


Also note that

using DrawPath = System.Windows.Shapes.Path

appears at the top of the file to distinguish it from System.IO.Path


Thanks a lot, and if you need more detail to help me please ask

Sep 12, 2012 at 11:11 AM

can you paint the picture? ..the code itself doesn't help much ;}

Sep 12, 2012 at 12:50 PM

Not sure if that was a serious question, I guess I could post a screenshot, will this codeplex thing even let me do that? Anyway couldn't you just explain the math behind its positioning with detail? All the code says is that I have four LLH points that are the four corners of a quad. How can I make those four corners display at the correct geo locations? 

Sep 12, 2012 at 12:59 PM

hit the html button, insert the picture, 'talking mathematics' doesn't work..

Sep 13, 2012 at 1:04 PM

In case anyone else needs to solve a similar problem, set the geo location of the marker to be the same as the geo location of the first point and things will line up, like this:

//update the fov polygon
GMapMarker polyMark = new GMapMarker(TiePtsLLH[0]);
for (int i=0; i<4; i++)

In other words, the position of the marker does determine the geo location of the first point on the polygon