This is how QGIS writes the proj-string and WKT with +towgs84-parameter:
+proj=longlat +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +no_defs
GEOGCS["DHDN",DATUM["Deutsches_Hauptdreiecksnetz",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[598.1,73.7,418.2,0.202,0.045,-2.455,6.7],AUTHORITY["EPSG","6314"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4314"]]
But keep in mind that there is no overall value for converting any Bessel-1841-Data to WGS84.
For Germany, there were a lot of parametres published, until a NADgrid for the whole country was created. This applies the correct shift for every point inside Germany.
Other surveying authorities have done similar conversions, but with other values.
EDIT
There is a forum entry in Russian http://gis-lab.info/forum/viewtopic.php?t=9386
giving the following proj parameters:
+proj=tmerc +lat_0=55.6666666667 +lon_0=37.5 +x_0=0 +y_0=0 +k_0=1. +a=6377397 +rf=299.15 +towgs84=396,165,557.7,-0.05,0.04,0.01,0 +no_defs
Maybe you get lucky with those values.
I've made some changes to your code, to make it work as you wish. Here's only the code between the body tags:
<body>
<div id="map"></div>
<script type="text/javascript">
// init the map with Stamen Terrain tiles
var map = L.map('map').setView([40.3025, -121.2347], 15);
var layer = new L.StamenTileLayer("terrain");
var animatedMarker;
map.addLayer(layer);
// create geojson layer
var geojson = new L.geoJson(pct);
geojson.addTo(map);
// temporary array to store geojson lat, lon
var temp = [];
var eachLayer = geojson.eachLayer(function(layer){
var coordinates = layer.feature.geometry.coordinates,
len = coordinates.length,
i = 0;
for (i; i<len; i++){
var lat = coordinates[i][1],
lon = coordinates[i][0];
// reverse order of lon, lat for L.polyline
temp.push([lat, lon]);
}
});
var line = new L.polyline(temp),
animatedMarker = L.animatedMarker(line.getLatLngs(), {
autoStart: false,
distance: 500,
interval: 1000
});
map.addLayer(animatedMarker);
var flag = 0; // the variable used to signalise the animation stop
function pan_map(){
map.panTo({lon: animatedMarker['_latlng'].lng, lat: animatedMarker['_latlng'].lat});;
}
pan_map(); // pan the map to the marker start position
// set the interval timer
var vInterval = setInterval(function(){
if (flag == 1){
animatedMarker.stop();
clearInterval(vInterval); // stops the interval timing, also
}
pan_map(); // pan the map to follow the marker
}, 100);
// delay start so that data has time to load
Timeout = setTimeout(function(){
animatedMarker.start();
}, 3000);
// function to track animatedMarker's position
// and stop it at given lat lon values
var checkLatLon = function(e) {
var lat = 32.608639206779,
lon = -116.49114320162762;
if (e.latlng.lng === lon && e.latlng.lat === lat){
flag = 1; // signals the animation can be stopped
}
}
// event listener to check animatedMarker's position
animatedMarker.on('move', checkLatLon);
</script>
</body>
Best Answer
Welcome to GIS Stack Exchange!
There should be no special difficulty in attaching a callback to marker(s) click event. You would simply use
myMarker.on('click', callback)
like you did with the map. You would also have to do that for every marker you want to attach a callback to.Another possibility would be to add all your markers into a Feature Group (e.g. simply instantiate your
markersLayer
withL.featureGroup()
instead ofL.layerGroup()
), so that you can attach the callback directly to that Group. It will receive the click events from individual markers, and you can access the individual clicked feature usingevent.layer
.Demo: http://jsfiddle.net/ve2huzxw/74/
Similar question asked by someone else on Leaflet forum: https://groups.google.com/forum/#!topic/leaflet-js/RDTCHuLvMdw