Vaibhav Pandya
Vaibhav Pandya

Reputation: 125

Map rotation in Gmap.Net to make it track-up

I am working on an aviation moving map application and it needs to have track-up orientation instead of north-up. In order to do that, I would have to rotate the map in the background instead of the aircraft symbol. Has anyone accomplished that yet with Gmap.Net winforms. I have tried gmap.Bearing property and it does rotate the map but the map labels(cities, states, etc) also rotate. Is there a way?

Upvotes: 2

Views: 2071

Answers (2)

daniel lozano
daniel lozano

Reputation: 429

I have been looking for the way to rotate the map too, I have found the bearing property and i didn't know how to use it. You both are talking about the rotation of the map, but there no code if someone want to know how to use this property, because you both know how to do it so it is not necessary to put how to use this property. Anyway, looking for an answer, I found this thread, so let me to put a piece of me here.

I know that this is not an answer to your solution, but maybe to see how to use this property in this thread could be useful for someone.

The bearing property is of Single type, and if someone wants to rotate the map, this property is used like this:

GMapControl.Bearing += 10

or

GMapControl.Bearing -= 10

And the value you are writing means the degrees you want to rotate the map. if you put '+= 10', you are rotating the map 10 degrees. And if you put '-= 10', you are rotating 10 degrees in the opposite side.

I have used this control like this:

Private Sub RotationButton_Click(sender As Object, e As EventArgs) Handles RotationButton.Click
    GMapControl.Bearing += 10
End Sub

I hope this could be useful for someone.

Upvotes: 2

T James
T James

Reputation: 502

The Gmap rotation works by applying a rotational matrix to the graphics, and because all the labels are part of the actual image, they are also rotated. This is consistent with most map provides. Try opening google maps on your phone and rotate the map. All the generic labels, like street names, will rotate with the map.

The only way to accomplish what you are trying to do is to have two layers, one for your map, and one for the primary labels such as city, states, etc.. your second layer will have markers corresponding to the location of the label. Set the marker to transparent, turn on labeling of the marker and the labels should stay horizontal even when the map is rotated. Here is where you can download a list of most cities by lat/lng:

https://www.maxmind.com/en/free-world-cities-database

Wish there was an easier way...

Upvotes: 1

Related Questions