//地址逆解析; function getAddress(pt) { var geoc = new BMap.Geocoder(); geoc.getLocation(pt, function (rs) { var addComp = rs.addressComponents; var tra_name = addComp.province + "" + addComp.city + "" + addComp.district + "" + addComp.street + "" + addComp.streetNumber; //记录入库; addTrajectory(tra_name, pt.lng, pt.lat); }) }
Done!