Ok, I found it.
Code:
map.addListener("click", function (event) {
var s = map.getDevInfo();
// then you can access s.Longitude or zoomLongitude
});
Frage
I'm writing a program with AmMaps where I want a user to click on a map of a country, and to be able to select and save locations.
I'm stuck on getting data back after the user clicks on the map. I used the "clickMapObject" event on another page, but in this case they aren't clicking anything.
<script>
var map;
$(document).ready(function () {
map = new AmCharts.AmMap();
map.pathToImages = "ammap/images/";
var dataProvider = {
mapVar: AmCharts.maps.irelandHigh,
getAreasFromMap: false,
};
map.dataProvider = dataProvider;
map.areasSettings = {
autoZoom: false,
color: "#CDCDCD",
colorSolid: "#5EB7DE",
selectedColor: "",
outlineColor: "#666666",
rollOverColor: "#88CAE7",
rollOverOutlineColor: "#FFFFFF",
selectable: false,
};
map.addListener("click", click);
map.write("mapdiv");
function click() {
//Can i get long and lat here?
};
});
</script>
Lösung 2
Ok, I found it.
Code:
map.addListener("click", function (event) {
var s = map.getDevInfo();
// then you can access s.Longitude or zoomLongitude
});
Andere Tipps
I didn't use this map control, but I ever used google map, so I think maybe you can try this:
map.addListener("click", function (e) {
//get lat and lng from e object
var latLng = e.latLng;
});