There is a method to convert and insert geospatialdata directly into LocationCollection as a collection of points?

2 posts, 0 answers
  1. Yan Moura
    Yan Moura avatar
    89 posts
    Member since:
    Feb 2010

    Posted 16 Nov 2011 Link to this post


    So I have a LocationCollection object and would like to load directly into that a geospatial polygon such as:

    POLYGON ((-94.264725 45.562850,-94.264735 45.562850,-94.264735 45.562860,-94.264725 45.562860,-94.264725 45.562850))

    The question is: there is a method to do that automatically or will I have to write a function to parse the polygon string and insert points one by one into the LocationCollection object through the Add method?

  2. Andrey
    Andrey avatar
    1681 posts

    Posted 21 Nov 2011 Link to this post

    Hi Yan Moura,

    The LocationCollection class contains the static Parse method. You can use it to get the LocationCollection from a string.
    The sample code is below.
    LocationCollection collection = LocationCollection.Parse("-94.264725 45.562850,-94.264735 45.562850,-94.264735 45.562860,-94.264725 45.562860,-94.264725 45.562850", true);

    Best wishes,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top