We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Blazor Map Markers using complex / nested lists

Hello, I'm working with the Blazor Maps, specifically going off of the examples given in https://ej2.syncfusion.com/blazor/documentation/maps/markers/

I'm curious if there is a way to plot the markers by using a list of points where the Latitude/Longitude are within more complex structures.
For a simple example, given the following definition:

 public class GPS
    {
        public double Latitude;
        public double Longitude;
    }

    public class City2
    {
        public GPS gpslocation;
        public string Name;
    };

    private List<City2> cities2 = new List<City2> {
        new City2 { gpslocation = new GPS { Latitude = 35.145083, Longitude = -117.960260 }, Name= "California"}
    };

If I try calling <MapsMarker Visible="true" DataSource="@cities2"> </MapsMarker> , then the marker will not display.
Is there a way to tell the Map where within the structure to find the latitude and longitude, similar to how the XName and YName parameters can be set on the EjsChart?

Thanks,
Sorin 


Attachment: Map_Test_8061afaa.zip

4 Replies

SO Sorin November 17, 2019 12:13 AM UTC

I found one possible workaround being the following:
<MapsMarker Visible="true" DataSource="@cities2.Select(e => e.gpslocation).ToList()"> </MapsMarker> 

But I'm still wondering if there is a way to explicitly define the latitude and longitude parameters within the "DataSource" element.

Thanks,
Sorin


BP Baby Palanidurai Syncfusion Team November 18, 2019 10:10 AM UTC

Hi Sorin, 

Thanks for your update. 

We have analyzed your query. As of now, we need to define latitude and longitude parameters within the data source to render the marker for maps. If we define other than those parameters within the data source, then the markers will not render. So, we need to use latitude and longitude parameters within the data source.  

As of now, there are no explicitly binding attributes for latitude and longitude from the data source to render markers. And also, there is no support to access complex input data for marker data sources like our charts. Kindly use your workaround solution to access the values from complex inputs for the marker data sources. 

Kindly revert us, if you have any concerns. 

Regards, 
Baby. 



SO Sorin November 19, 2019 01:14 PM UTC

Hello Baby,

Thank you for your feedback. 
It's no problem for me for now to use the workaround.
Would it be possible to put this functionality as a low priority feature request to the development team?

Thanks,
Sorin


BP Baby Palanidurai Syncfusion Team November 20, 2019 01:36 PM UTC

Hi Sorin, 

Thanks for your update. 

We have considered your request as new feature request and logged a feedback for this. It can find from the below link. 


Please cast your vote to make it count. We will prioritize the features of every release based on the demands.   
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.   

Regards, 
Baby. 



Loader.
Live Chat Icon For mobile
Up arrow icon