If you have a marker on Google Map which moves on a flight path/ road track but you want it to rotate when it turns. To rotate the image marker Icon from GMap.NET C#, in first create new class, add public class function named "GMapMarkerPlane"
For icon picture, create the icon and add it into resource folder.
private readonly Bitmap icon = Resources.planetracker;
In the declaration, create new layer name from GMapOverlay:
public static GMapOverlay routesoverlay;
Next, in main form create new layer and add it to the gmap:
routesoverlay = new GMapOverlay("routes");
gMap.Overlays.Add(routesoverlay);
and then, add the code below in the GPS heading function (use timer 1 second or more):
routesoverlay.Markers.Clear();
// Get the most up-to-date data received from the sensor.
var curMeas = vn200.CurrentMeasurements;
PointLatLng point = new PointLatLng((float)curMeas.LatitudeLongitudeAltitude.X,
(float)curMeas.LatitudeLongitudeAltitude.Y);
gMap.Position = point;
var plane = new GMapMarkerPlane(point, (float)curMeas.YawPitchRoll.YawInDegs);
routesoverlay.Markers.Add(plane);
and finally, the Plane Marker heading will following your heading data sensor.
Keyword: Rotate GMap.NET marker, C#, heading Marker, IMU, google map marker, GPS tracking heading marker.
Excellent!
ReplyDeleteExcellent.. I was searching for this
ReplyDeleteDoes anyone have any idea how to place the picture I added in the center of the coordinate I showed?
ReplyDeleteI can rotate the photo. There is no problem with that. but it was not centered in the coordinate I wanted. For example, the point I want is 0.0 but it always stands on it.
ReplyDeleteu never said what vn200 is what is it ?
ReplyDelete"vn200.CurrentMeasurements" is the heading data from IMU sensor V200 from Vectorav.
Delete