Qgis2web coordinates
Hi! I'm new to Qgis2web, but have been playing around with it. Is there a way to get coordinates in the popup, or second best, when movering the mouse. Seems to be a solution to the second best solution here, but I can't figure it out. https://www.ee.co.za/article/how-to-publish-a-layered-web-map-with-open-source-software.html
Hello, you could use appearance - measure tool. So you get the coordinates and in addition you have the measure tool. This is the easy way.
Furthermore you could use leaflet plugins: https://leafletjs.com/plugins.html#mouse-coordinates
Greetings
An option in the plugin to add coordinate feedback (with possibly different implementations (on-click, mousover, ...) would be really conveniant for non-programmers.... It should be available in both OpenLayers, Leaflet (https://gis.stackexchange.com/questions/39055/getting-lat-long-of-clicked-location-using-leaflet-api) and mapbox...
For openlayers
var mousePosition = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(2),
projection:'EPSG:3004',
target: document.getElementById('myposition'),
innerHTML: ' '
});
map.addControl(mousePosition);
я использую вот это
new ol.control.MousePosition({
projection: 'EPSG:4326',
coordinateFormat: function(coord) {
return ol.coordinate.toStringHDMS(coord, 5);
},
className: 'custom-mouse-position',
target: document.getElementById('mouse-position'),
undefinedHTML: ' '
}),
]),