Hi,
By looking at your documentation, I was able to view my markers on the map with Bing Map provider. However, I want to do the same with the coordinate information of the markers by returning the Model from the Controller. How can I do it?
Thanks,
@{
var data = new[]
{
new {latitude= 39.2447, longitude= -77.2539, city= "Baltimore" },
new {latitude= 39.6184, longitude= -76.6616, city= "Baltimore" },
new {latitude= 40.5716, longitude= -76.9667, city= "Baltimore" }
};
var marker = new List<MapsMarker>
{
new MapsMarker{Visible=true, DataSource=data, Width = 30, Height = 30}
};
var zoom = new Syncfusion.EJ2.Maps.MapsZoomSettings
{
Enable = true,
ZoomFactor = 7,
MaxZoom = 20
};
var centerPosition = new Syncfusion.EJ2.Maps.MapsCenterPosition
{
Latitude = 40.047095,
Longitude = -77.901296
};
}
@using Syncfusion.EJ2.Maps;
@using Syncfusion.EJ2;
<div id="control-section">
<ejs-maps id="maps" height="800px" zoomSettings="zoom" centerPosition="centerPosition">
<e-maps-layers>
<e-maps-layer layerType="Bing" bingMapType="CanvasLight" markerSettings="marker" key="{bingmapkey}"></e-maps-layer>
</e-maps-layers>
</ejs-maps>
</div>
|
[HomeController.cs]
public IActionResult Index()
{
List<MarkerModel> marker = new List<MarkerModel>();
MarkerModel markerone = new MarkerModel();
markerone.Latitude = 39.2447;
markerone.Longitude = -77.2539;
markerone.City = "Baltimore";
marker.Add(markerone);
//..
//..
ViewBag.MarkerData = marker;
return View();
}
[Index.cshtml]
@{
var marker = new List<MapsMarker>
{
new MapsMarker{Visible=true, DataSource= ViewBag.MarkerData, Width = 30, Height = 30}
};
}
[MarkerModel.cs]
public class MarkerModel
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public string City { get; set; }
} |
Thanks it works. I have one more question. As you mentioned, I take the coordinates and show them as markers on the map. However, the number of markers in a certain area is high. For this reason, I use Marker clustering. I did it as you described in your documentation, but when using marker clustering, the markers load very late, especially when zooming, sometimes it cannot load, the page remains blank. When the number of markers is high in a certain area, when marker clustering is not used, it loads slowly, but it is faster than clustering. Is there any method you can suggest for this problem?
Hi,
Is there any development on the subject?