x

Re: Position abgreifen


Geschrieben von Oskar07 (Gast) am 13. August 2018 19:29:47: [flux]

Als Antwort auf: Position abgreifen geschrieben von Oskar07 (Gast) am 12. August 2018 18:58:

@gormo

Hab jetzt mal nen mouseup event genommen. Die Daten habe ich jetzt als console.log.
Jetzt gehts weiter - Danke

Hier mein Script, wenns einer brauchen kann

<script>
var␣la=␣48.7603058
var␣lb=9.0812284
var␣z=12
var␣map␣=␣L.map('map').setView([la,lb],z);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png',␣{
attribution:␣'<a␣href="http://osm.org/copyright">&copy;␣</a>␣'
}).addTo(map);
L.control.mapCenterCoord({
latlngFormat:␣'DD',
latlngDesignators:␣false,
template:␣'{y}␣|␣{x}',
}).addTo(map);
map.on('mouseup',␣	function␣(clickEvent)␣{
console.log("Center␣is␣"+map.getCenter());
});
L.Map.extend({␣getCenter␣:␣function␣()␣{
if␣(this.options.projected)␣return␣this._getProjectedCoord(this._map.options.crs.project(this._map.getCenter()));
return␣this._getLatLngCoord(this._map.getCenter());
}
});
</script>