Category / Section
How to draw a line (route) between two terminals in SfMaps
1 min read
This article explains how to draw a line between two terminals using the SfMaps control. Refer to the following steps to draw a line between two terminals.
Step 1: Initialize the SfMaps control and add ShapeFileLayer to the layer collection of the control with the Uri property. Using the SubLayers support, you can add a sub shape layer that contains line points between two routes over the main ShapeFileLayer.
The following code snippet demonstrates how to add a sub shape file layer over the main shape file layer.
<maps:SfMaps x:Name="sfmap" BackgroundColor="LightGray" > <maps:SfMaps.Layers > <maps:ShapeFileLayer Uri="world-map.shp" x:Name="layer" > <maps:ShapeFileLayer.Sublayers> <maps:ShapeFileLayer Uri="river.shp"> <maps:ShapeFileLayer.ShapeSettings > <maps:ShapeSetting ShapeStrokeThickness="2"/> </maps:ShapeFileLayer.ShapeSettings> </maps:ShapeFileLayer> </maps:ShapeFileLayer.Sublayers> </maps:ShapeFileLayer> </maps:SfMaps.Layers> </maps:SfMaps>
Step 2: Add markers to ShapeFileLayers using the Markers property with latitude and longitude values.
<maps:ShapeFileLayer.Markers> <maps:MapMarker Latitude = "28.6139391" Longitude = "77.2090212"/> <maps:MapMarker Latitude = "39.9041999" Longitude = "116.4073963"/> <maps:MapMarker Latitude = "31.2303904" Longitude = "121.4737021"/> <maps:MapMarker Latitude = "23.12911" Longitude = "113.264385"/> <maps:MapMarker Latitude = "22.396428" Longitude = "114.109497"/> <maps:MapMarker Latitude = "19.0759837" Longitude = "72.8776559"/> <maps:MapMarker Latitude = "13.0826802" Longitude = "80.2707184"/> <maps:MapMarker Latitude = "22.572646" Longitude = "88.363895"/> <maps:MapMarker Latitude = "24.880095" Longitude = "102.832891"/> </maps:ShapeFileLayer.Markers>
You can find the sample in the following link: Sample
Screenshot