1

I'm using Mapstraction and trying to draw polygon by invoking map.addFeature('polygon');

It shows the exception Uncaught TypeError: Object [object Object] has no method 'addFeature'

Why am getting this exception?

JS Code:

var polyPoint;
    var polyPoints = []

    //Adding polygon to map
    polyPoint = new mxn.LatLonPoint(17.447612 , 78.223686)
    polyPoints.push(polyPoint);
    polyPoint = new mxn.LatLonPoint(17.504593 , 78.306084)
    polyPoints.push(polyPoint);
    polyPoint = new mxn.LatLonPoint(17.471193 , 78.417320)
    polyPoints.push(polyPoint);
    polyPoint = new mxn.LatLonPoint(17.414201 , 78.470879)
    polyPoints.push(polyPoint);


    var polygon = new mxn.Polyline(polyPoints);
    polygon.setClosed(true);
    map.addPolyline(polygon)
    map.addFeature('polygon', polyPoints);
4

0 回答 0