Dynamic Map Shape Problem

2 posts, 0 answers
  1. Matt
    Matt avatar
    38 posts
    Member since:
    Nov 2014

    Posted 17 Jul 2015 Link to this post

    I'm having trouble adding shapes to my map.

    Here's my shape layer definition:

    {
                    type: "shape",
                    style: {
                        stroke: {
                            color: "blue",
                            width: 4,
                            dashType: "solid",
                            opacity: 0.5
                        }
                    },
                    dataSource: shapes
                }

    And this is how I'm adding things to it:

    shapes.add({ "id": "FRA", "type": "Feature", "geometry": {
                "type": "MultiLineString",
                "coordinates": [myList] }
            });

    When I hardcode the populating of myList using numbers I found in another thread on shapes it works:

    var myList = [];
     
    var pos = myList.length;
    myList[pos] = [];
    myList[pos][0] = -9.10531212;//I put these in here to make sure the problem wasn't that my coordinates were too precise.
    myList[pos][1] = 43.91251212;
    pos = myList.length;
    myList[pos] = [];
    myList[pos][0] = 3;
    myList[pos][1] = 43;
    pos = myList.length;
    myList[pos] = [];
    myList[pos][0] = 2;
    myList[pos][1] = 36;
    pos = myList.length;
    myList[pos] = [];
    myList[pos][0] = -9;
    myList[pos][1] = 37;

    But when I try to use the numbers from my data it doesn't work:  

    var pos = myList.length;
            myList[pos] = [];
            myList[pos][0] = 42.3055286;
            myList[pos][1] = -87.89389;
            pos = myList.length;
            myList[pos] = [];
            myList[pos][0] = 42.3055415;
            myList[pos][1] = -87.8938938;
            pos = myList.length;
            myList[pos] = [];
            myList[pos][0] = 42.3055766;
            myList[pos][1] = -87.8938775;
            pos = myList.length;
            myList[pos] = [];
            myList[pos][0] = 42.3055958;
            myList[pos][1] = -87.8938808;

    It looks like it should work to me, but it's not.  It never draws the line when I use my own data.

     Any ideas?

     

  2. Matt
    Matt avatar
    38 posts
    Member since:
    Nov 2014

    Posted 17 Jul 2015 in reply to Matt Link to this post

    I figured it out.  I expected the coordinates to be in the format [Latitude, Longitude], but actually they need to be in the opposite order [Longitude, Latitude].
  3. Kendo UI is VS 2017 Ready
Back to Top