How to put multiple marker in c # using GMAP

0

I have the following code:

GMarkerGoogle marker;
GMapOverlay markerOverlay;

Simple initial configuration:

gMapControl1.DragButton = MouseButtons.Left;
gMapControl1.CanDragMap = true;
gMapControl1.MapProvider = GMapProviders.GoogleMap;
gMapControl1.Position = new PointLatLng(LatInicial,LngInicial);
gMapControl1.MinZoom = 0;
gMapControl1.MaxZoom = 24;
gMapControl1.Zoom = 9;
gMapControl1.AutoScroll = true;

Adding the MARKER

//Marcador
markerOverlay = new GMapOverlay("Marcador");
marker = new GMarkerGoogle(newPointLatLng(25.00000,-25.00000),GMarkerGoogleType.green);
markerOverlay.Markers.Add(marker); //agregar marker al mapa

Alli just adds me 1 how can I put several?

    
asked by DoubleM 13.12.2016 в 05:01
source

1 answer

1

The Markers property of GMapOverLay is a collection, so you can add new markers as you are doing there, creating a new instance of GMarkerGoogle and passing it as an argument to the Add() method. Something like this:

    // Declaras un nuevo marker
    GMarkerGoogle marker2 = new GMarkerGoogle(new PointLatLng(25.00000,-25.00000), GMarkerGoogleType.green);
    // Lo añades a la colección
    markerOverlay.Markers.Add(marker2);
    
answered by 14.12.2016 / 17:13
source