Path on map given a location collection

3 posts, 1 answers
  1. Etienne
    Etienne avatar
    47 posts
    Member since:
    Sep 2014

    Posted 09 Nov Link to this post

    Hi,

    I would like to draw a path on a RadMap using locations from an ObservableCollection. I looked at MapPathFigureView (from http://www.telerik.com/forums/draw-a-curve-on-the-map#62RbZ0kLxkCXT7mDVmvT8A) but I didn't find a way to bind to segments collection.

    So is there a way to do that ?

    Thanks,

    Etienne

  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 Nov Link to this post

    Hello Etienne,

    I assume your ObservableCollection of points contains a Latitude/Longitude pairs, if no, please make sure to prepare collection of such Telerik.Windows.Controls.Map.Location objects.

    So how to show path / polyline, having such location collection ?

    A) Data Objects. These are the shape data objects used in Visualization Layer. This will be the fastest solution because internally multiple threads process the geometries. You need to build the Polyline segments or Path Figures in code behind - iterate your collection and build the collection shape data objects need. IMO you can use both PolylineData and PathData with PathFiguresData collection.

    B) Bindable wrappers. These are the MapPathView, MapPathFigureView (Map__X__View naming). They internally create and use shape data objects, should be used only in DataTemplates and support databinding. However, they are slower than the shape data objects. Here you can bind directly the Points collection of MapPolylineView. On the other hand MapPathFigureView, has Segments property of type MapPathSegmentViewCollection. You can create such collection and populate it with MapLineSegmentView objects. However, since you need to do this is model / code behind (before binding the Segements collection), there is no big benefit compared to simply using data objects. So if you need MVVM , we encourage you to use MapPolylineView / MapPolygonView.

    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Etienne
    Etienne avatar
    47 posts
    Member since:
    Sep 2014

    Posted 15 Nov in reply to Petar Mladenov Link to this post

    Hi Petar,

    Thanks for the informations, I used the solution with MapPolylineView and it works great.

    Have a nice day!

    Etienne

Back to Top