4

Maybe @Mike ha some trick upon his sleeve, but I couldn't get around this problem some normal way. I have tile layer with custom tile grid. Without constrainResolution: true option in the view definition, view honors maxZoom option. As soon constrainResolution: true option is added to view definition, view disregards maxZoom option. Below is my actual code, ...


4

If you look at the specification of the view extent option, it says: The extent that constrains the view, in other words, nothing outside of this extent can be visible on the map. In your case that means that nothing to the left of 60° and right of 100° longitude should be visible in the map view. Since at zoom 3 more would be visible, higher zoom is used ...


3

I think Openstreetmap has changed theier response data. Simply update your code to: var searchControl = new GeoSearchControl({ provider: provider, resultFormat: function (t) { return '' + t.label }, });


2

The main thing that is wrong in your code is that in the function AddLayer, where you define new GeoJSON layer for newly selected month, GeoJSON layer is defined and added to the map three times. You also define and add to the map info and legend controls inside AddLayer function, so new controls are added to the map at each change of the data. In the code ...


2

It is possible to dynamically update the content of the views's resolutions array, for example var source = new OSM(); var resolutions = source.getTileGrid().getResolutions().slice(0, 8); var liveResolutions = resolutions.slice(); var map = new Map({ layers: [ new TileLayer({ source: source }) ], target: "map", view: new View(...


2

There might be other, more 'official' ways, but the only way I could find to get some parameter from marker creation button to marker creation event, is through marker icon properties when marker is created through handler, defined with getModeHandlers option. Before marker is created with handler new L.Draw.Marker(map, { icon: new L.Icon.Default() }), we ...


1

I don't know a solution for Leaflet-Draw but for Leaflet-Geoman a more modern draw tool. var MyCustomMarker = L.icon({ shadowUrl: null, iconAnchor: new L.Point(12, 12), iconSize: new L.Point(24, 24), iconUrl: 'https://upload.wikimedia.org/wikipedia/commons/6/6b/Information_icon4_orange.svg' }) var HospitalIcon = L.icon({ shadowUrl: null, ...


1

Define the layergroup outside and then add the marker: var spots = L.layerGroup(); $.get("./data.csv", function (csvString) { var data = Papa.parse(csvString, { header: true, dynamicTyping: true }).data; for (var i in data) { var row = data[i]; var marker = L.marker([row.Latitude, row.Longitude], { opacity: 1, }).bindPopup(...


1

You are nearly there with the answer. The 'Certain Coordinate' value just needs to be a meaningful and useful location. If the map you are building is for a specific City, maybe set it to the CBD. Or if its a global map, set it to 0,0 at a high map scale (I think Google Earth desktop app does this) You should do this in your onLocationError function, ...


1

After eventually making sense of the Leaflet documentation it states the watch option if true, starts continuous watching of location changes (instead of detecting it once) using W3C watchPosition method. You can later stop watching using map.stopLocate() method. I made the changes below removing the watch: true. map.locate({setView: true}) .on('...


1

Indeed, that feature is not supported by GEE, as the others said. What you can do is comment out the lines you don't want to run by selecting them and use the keyboard shortcut Ctrl+/


1

Use L.CRS.latLngToPoint(), e.g. L.CRS.EPSG3857.latLngToPoint( L.latLng([-30, 60]), // L.LatLng instance 6 // Zoom level ); See a working example


1

You can simply use something like: var popupContent = '<p>' + feature.properties.Name + '<br>' + feature.properties.PopupInfo + '<br>' popupContent += feature.properties.image_link ? '<img src="' + feature.properties.image_link +'" style="width:200px;height:125px;"> </p>' : ' </p>' var popup = new ...


1

I'd like to point out that checking validity with JSTS is about geometry fx. to detect self-intersections in polygons. It has nothing to do with WKT. The WKTReader in JSTS assumes valid WKT and will throw on invalid WKT. Also, the import in the above example is wrong. It should be: import IsValidOp from 'jsts/org/locationtech/jts/operation/valid/IsValidOp'


1

I use turf.js library for calculating centroid of a polygon. It also provides other functions which might be useful like calculating distance. import * as turf from "@turf/turf"; const demoGeometry = { "type": "Polygon", "coordinates": [ [ ...


Only top voted, non community-wiki answers of a minimum length are eligible