The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

The solution I adopted isn't working because putting the self intersection check on the condition doesn't always lead to check for a complete Polygon feature (until the drawing is finished the feature is of type MULTILINESTRING). What I did was to put the self-intersect checks on the drawend, the feature will be added to the layer anyway and I handle ...


1

Using turf.js#intersect method you can find out if two features share a border. from their docs: Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined. Using this, you can convert open layer features to turf.js#polygonand feed them to the intersect method. If the return ...


1

You can select the geometries on front end using openlayers and then write a postgres query to check if they intersect with each other by using ST_Intersects and apply ST_UNION if the intersects is true. This works if the backend is postgres. If you use any other DB, use appropriate spatial queries and return the result to front-end for providing appropriate ...


3

OpenLayers passes the extent in view projection units so you should use that if your server supports it (otherwise you would need to transform the extent to EPSG:4326) url: function (extent, resolution, projection) { return 'http://localhost:8080/geoserver/misproject/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=misproject%...


0

For anyone facing this problem in the future I got to the bottom of it. The problem was that I was adding multiple interactions at the same time - i.e. Modify, Translate, and Select. I saw this issue only selecting points and lineStrings while all the interactions were active. If I only use the interactions one at a time (although Translate and Select seem ...


3

here's a solution using proj4js: Demo I put some transparency to check the alignment, you can remove it in the options of the WMTS layer (set opacity to 1). Code : var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], view: new ol.View({ ...


1

In qgis2web.js, set the default view in the map and remove/comment the line after the map definition : var map = new ol.Map({ controls: ol.control.defaults({attribution:false}).extend([ expandedAttribution ]), target: document.getElementById('map'), renderer: 'canvas', overlays: [overlayPopup], layers: layersList, view: ...


3

To open the view at those coordinates at zoom 10 use view: new ol.View({ maxZoom: 18, minZoom: 4, center: ol.proj.fromLonLat([-74.006998, 40.722120]), zoom: 10 }) EPSG:3857 is the OpenLayers default projection so need not be specified. You must convert Lon/Lat values to view projection coordinates (methods beginning OpenLayers. were used ...


1

The map file is correct. In OpenLayers, you have created a tile layer and its source is tileWMS, that's why you are getting WMS. to get WFS, africa_wfs_source = new ol.source.vector({ format : new ol.format.GeoJson(), url: function(extent) { return 'http://*****/cgi-bin/mapserv? map=/data/mapFile/South.map&service=WFS&' + ...


1

If you take a look at actual GeoJSON data, you'll see that it's coded in EPSG:4326, so reading features statement should be: var features = (new ol.format.GeoJSON()).readFeatures(data.geometry, {dataProjection: 'EPSG:4326', featureProjection: 'EPSG:27700'}); You'll also have to change order of layers in map declaration, otherwise features will be covered ...


1

After analyzing the map initializer, I noticed that I was setting the minZoom attribute in my map view. After removing it, I now get the same value of mapView.getMaxResolution (). Conclusion: The minZoom and maxZoom attributes influence the formula


0

The popup was appearing blank because of CORS error and I fixed it by adding Moesif CORS extension to chrome browser. Now, the above code works as expected. Hence,I am marking this as answer.


0

My approach was to abandon labels (set all layers in QGIS to have no labels (double click on layer in the Layer Panel to open Layer Properties > Labels > No Labels)), and focus on the popups, which are very nice and comparatively easy to deal with for a non-programmer. I did see there are some Leaflet label plugins (though am not finding them now), but ...


Top 50 recent answers are included