Home > front end >  Scott map of how to realize dynamic drag modify the longitude and latitude
Scott map of how to realize dynamic drag modify the longitude and latitude

Time:09-16

Scott map is implemented for static tagging a custom icon, mass tagging, wgs84 conversion,
The question now is how to implement page after drag icon, behind the actual latitude and longitude of also follow changes, realize the function of the latitude and longitude data modification,
Var lnglats=[
[120.127561344765, 29.907395940616, 1, '001 credit cooperatives edge - fork road]]

Var markers=[];

For (var I=0; i Var lnglat=lnglats [I];
Var m2;

//coordinate transformation
The function convertFrom (lnglat, type) {
AMap. ConvertFrom (lnglat, type, function, status, and the result) {
If (result. The info==='ok') {
Var resLnglat=result. Locations [0];
M2=new AMap. Marker ({
Position: resLnglat,
Icon: './red. PNG ',
});
The map. The add (m2);
//set the tag

M2. SetLabel ({
Offset: new AMap. Pixel (0, 0),//set the text annotation offset
Content: lnglat [2],
Direction: 'center'//set the text annotation bearing
});
M2. SetTitle (lnglat [3]);
}
});
}
ConvertFrom (lnglat, 'GPS');
}
  • Related