Displaying custom markers on an OpenStreetMap map

Hi,
I need to display a list of markers on an SfMaps control, with the markers defined in a List - i.e. have an ItemsSource for the Layer.

However, it seems that ItemsSource is only available for a ShapeFileLayer.

How can I have a List of items displayed on an ImageryLayer? I need to create a custom Marker with bound properties - the attributes of the marker being bound to the Item's properties (to display wind speed and direction at the location).

Regards,

James



3 Replies

BK Bharathiraja K Syncfusion Team June 17, 2019 12:50 PM UTC

Hi James, 
 
Greetings from Syncfusion. ShapeFileLayers’s ItemsSource property is used to bound the data to the shape file. You can add the custom marker in a Markers collection and bind the properties using MarkerTemplate as like the below code snippet. 
 
[XAML]: 
 
<maps:ImageryLayer Markers="{Binding CustomMarkers}"> 
                
                <maps:ImageryLayer.MarkerTemplate> 
                    <DataTemplate> 
                        <StackLayout Orientation="Horizontal"> 
                        <Image Source="{Binding ImageName}" Scale="1"  
                               Aspect="AspectFit " HorizontalOptions="StartAndExpand" VerticalOptions="Center"  
                               HeightRequest="15" WidthRequest="23" /> 
                        <Label Text="{Binding Label}"/> 
                        </StackLayout> 
                    </DataTemplate> 
                </maps:ImageryLayer.MarkerTemplate> 
                 
</maps:ImageryLayer> 
 
 
Please find the sample for your reference. 
 
 
Refer the following help document link for to know more about Markers. 
 
Regards, 
Bharathi.  



JL James Lavery June 17, 2019 12:55 PM UTC

Thank you - that's exactly what I needed!

Regards,

James


RA Rachel A Syncfusion Team June 18, 2019 05:36 AM UTC

Hi James, 
 
Thanks for your feedback. 
 
Regards, 
Rachel. 


Loader.
Up arrow icon