i am new in using nokia here map, how i can plot json of lat long in nokia here map without marker but it draw polyline..

Here is my code:

$.each(data, function(i, val){
           var coord = new nokia.maps.geo.Coordinate(parseFloat(val.latitude),parseFloat(val.longitude));
           var markerPolyline = new MarkerPolyline(
            coord,
            {
                polyline: { pen: { strokeColor: "#00F8", lineWidth: 4 } }
            }
        );

        map.objects.add(markerPolyline);
        });

I hope you can give some answer.. thanks in advance :)

有帮助吗?

解决方案

these are the steps you should follow 1.-Create an array of coordinate objects. 2.-assign those coordinates to the new instance of the polyline 3.-add new polyline to map

example:

var aoCoordinates = []
$(data).each(function(i,val){
    var latitude = parseFloat(val.latitude);
    var longitude = parseFloat(val.longitude);
    //create coordinate object
    var coord = new nokia.maps.geo.Coordinate(latitude,longitude);
    //add to array
    aoCoordinates.push(coord);
})
//after the loop ends create instance of polyline
var markerPolyline = new MarkerPolyline(
    aoCoordinates,
    {
        polyline: { pen: { strokeColor: "#00F8", lineWidth: 4 } },
        marker: { brush: { color: "#1080dd" } }
    }
);
map.objects.add(markerPolyline);

there are more examples in Nokias Developer page http://developer.here.com/javascript-apis/api-explorer

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top