11
votes
Accepted
Splitting a polygon by multiple linestrings leaflet and turf.js
Solution below is not direct answer to the question, it's just improved version of answer to similar question Splitting A polygon into multiple polygon by multiple line strings in Leaflet and turf.js, ...
5
votes
Accepted
How to specify custom CSS to an OpenLayers Zoom Control in Angular 6?
In Angular a style in @Component will only be applied to its own template (see https://angular.io/guide/component-styles#style-scope) You basically have two options:
Overwrite the style in your ...
3
votes
Accepted
De-highlight highlighted features with button click in OpenLayers?
Your code will only de-highlight a feature if it is under the button when clicked. To de-highlight all features you would need
btn.addEventListener("click", (event) => {
event....
3
votes
Accepted
Adding a PNG image to a WFS layer in an OpenLayers?
To display an image on a LineString you will need a style array, one style with geometry function which returns a Point geometry (e.g. the midpoint of the line) where the image is to be placed, and ...
3
votes
Accepted
How to unset an event listener in OpenLayers 6?
To use un you must use a named function for on
Without a named function you must save the event key
eventKey = this.mapObj.on('singleclick', ...
and use
unByKey(eventKey);
imported as
import {...
3
votes
Accepted
Map container is already initialized
Sounds like you want to read a file and create markers, and these markers should be in a layergroup so Leaflet handles them as one layer. Here is something similar to your code that I used.
$....
2
votes
Accepted
AssertionError 25 on getExtent, Openlayers?
The link doesn't work in version 5.3.3 so here is the 5.3.0 version https://openlayers.org/en/v5.3.0/doc/errors/#25
The data is loaded to the source asynchronously so you need to open the view at a ...
2
votes
Accepted
Adding offset to feature of layer in OpenLayers 4.6?
As I wrote in my comment, I'm not familiar with Angular environment. Since you replied that any hint is welcome, here it is, with standard JS.
The simplest way to create such markers is with ol....
2
votes
Accepted
Update WMS layer OpenLayers + Angular?
You could simply update the params in the existing source
this.layer.getSource().updateParams({LAYERS: this.newLayers()});
2
votes
Accepted
Get the properties of highlighted features when de-highlighting one of them in OpenLayers?
To have list of selected features you can create additional vector source selectedFeatures where you add selected feature and remove it, when it's unselected.
Relevant code could then look something ...
2
votes
Accepted
How to get the co-ordinates of the clicked point using 'ol/Draw' in OpenLayers 6?
There will be no .getGeometry().on('change', ... event for a Point because it only requires a single click to draw it.
But you can check for a point at the drawend event
this.draw.on('drawend', (...
2
votes
Accepted
Change popup content with JavaScript
For some reason, Angular wasn't detecting the show_hide() funtion, no matter where I tried putting it. But I was able to achieve what I wanted by embedding the code within the HTML onclick definition:
...
2
votes
Change popup content with JavaScript
Define your show_hide() function on global level and then call it with text parameter you want to replace current text with.
Code could then look something like this:
function show_hide(element, txt) ...
1
vote
Accepted
Leaflet geoJSON - function within setStyle()
Since style_new function returns style object, it must not be embedded in the object specifiers {} when you call it, so code should look like this:
this.map_layer.eachLayer(function (layer: any) {
...
1
vote
Accepted
Angular analysis in sDNA - sensitivity to small angular changes in road segments
sDNA considers both changes within polylines and changes at junctions between polylines, but they are handled differently. With a hybrid metric you can set thresholds for angular change for junctions ...
1
vote
Adding multiple Marker animation by route id in OpenLayers by angular
I think you can simply wrap the fetch block in a function, add some more buttons to the HTML, then you can call the function for each of your jsons, passing a different style and control button for ...
1
vote
Accepted
QGIS2web Export open layers map as PDF, PNG or JPEG
You do not need to use imports, you can use the full build syntax in your code instead, where https://openlayers.org/en/latest/doc/quickstart.html is equivalent to https://openlayers.org/en/latest/...
1
vote
Accepted
Google Earth Engine ee.data.authenticateViaPrivateKey in Angular app not working
If you look at the docs, the privateKey argument in ee.data.authenticateViaPrivateKey(privateKey, success, error, extraScopes) should be the "JSON content of private key". So, not the path of the JSON ...
1
vote
Accepted
Could not locate LayerGroup in catalog GeoServer + OpenLayers?
Any idea of what am I doing wrong here? I'm pretty stuck with this!
Group layers are a WMS construct, you can't access them through a WFS request.
1
vote
Smooth line animation on map
Your marker2 blinks (disappears) because you are removing it by source.removeFeature(marker2) and then adding again by source.addFeature(marker2).
Since it's the same marker that just changes ...
1
vote
How can I prevent a marker being dropped when the map is dragged in Leaflet?
This is all about managing your event handlers. I'm going to remove the HTML into onclick function and do it all in one place in the js:
<div id="map"></div>
What we'll do is add an ...
1
vote
Accepted
Removing shapes on a mouse click - Angular 6
Something as simple as this would do it. It returns true after the first feature, so won't remove more than one if they overlap. You might want to add further checks.
map.on('click', function(evt)...
1
vote
Accepted
Converting GeoJSON to projected coordinates in Leaflet?
If you really want to have GeoJSON in projected coordinates, you can use Leaflet's L.CRS.EPSG3857.project method for that. Since result of drawing is not some complicated feature collection, you could ...
1
vote
Get L.marker individual attributes
2 options, for a single marker:
var lat = 43;
var lng = -76;
var marker = L.marker([lat,lng]).bindPopup(lat.toString()+", "+lng.toString()).addTo(map);
marker.addTo(map);
For multiple markers use ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
angular × 58openlayers × 31
leaflet × 13
geojson × 6
javascript × 5
typescript × 5
arcgis-javascript-api × 4
markers × 3
html × 3
arcgis-javascript-api-4 × 3
authentication × 3
mapbox × 2
proj4leaflet × 2
coordinate-system × 1
geoserver × 1
google-earth-engine × 1
openlayers-2 × 1
layers × 1
vector × 1
distance × 1
google-maps × 1
wfs × 1
style × 1
features × 1
performance × 1