Arrows on a map

1 Answer 70 Views
Map
David
Top achievements
Rank 1
Iron
Iron
Veteran
David asked on 04 Nov 2022, 12:41 PM
I know we can add lines to a RadMap. I would like these lines to resemble arrows and have some curvature. Is it possible?

1 Answer, 1 is accepted

Sort by
0
Valentin Dragnev
Telerik team
answered on 09 Nov 2022, 10:26 AM

Hi David,

Richard has shown you an example in your ticket with ID: 1180291. You can review that to see the full conversation.

I will also share that example in this forum thread to make it available to the public.

You can use the Kendo Map API to draw custom shapes on the RadMap. Below is an example that draws a red triangle on a Map. The Shape Layer is created after the RadMap is loaded using the OnInitialize Event.


Markup:
<telerik:RadMap RenderMode="Lightweight" runat="server" ID="RadMap1" Zoom="8" Width="1000" Height="500">
    <ClientEvents OnInitialize="OnInitializeHandler" />
    <CenterSettings Latitude="0.5" Longitude="100.5" />
    <LayersCollection>
 
        <telerik:MapLayer Type="Tile"
            UrlTemplate="http://a.tile.opencyclemap.org/transport/#=zoom#/#=x#/#=y#.png">
        </telerik:MapLayer>
    </LayersCollection>
</telerik:RadMap>


JavaScript:
function OnInitializeHandler(sender, eventArgs) {
    var currOptions = eventArgs._options;
 
    var shapeData = [
        {
            "type""Feature",
            "geometry": {
                "type""Polygon",
                "coordinates": [
                    [[100.0, 0.0], [101.0, 0.0], [100.5, 1.0],
                    [100.0, 0.0]]
                ]
            }
        }
    ];
    var theNewLayer = {
        type: "shape",
        style: {
    fill: {
        color: "red",
        opacity: 1
    }
        },
        dataSource: {
            type: "geojson",
            data: shapeData
        }
    }
    currOptions.layers.push(theNewLayer);
}

 

Other helpful articles:

 

Regards,
Valentin Dragnev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Map
Asked by
David
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Valentin Dragnev
Telerik team
Share this question
or