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 ...


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%...


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({ ...


2

The solution was pretty simple: Just replacing feature.values_.geometry.extent_ with feature.getGeometry().getExtent() That worked fine.


2

A cluster is an auto-created and doesn't have those properties, instead it has an array of real features making up the cluster. This would return the first feature in the cluster if you clicked on one: feature_onClick = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) { var features = feature.get('features'); if (features) { ...


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

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: ...


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


1

Try specifying extent in the OpenLayers layer settings (it needs to be in view projection units regardless of the projection the WMS is using) new ol.layer.Image({ source: new ol.source.ImageWMS({ ... }), extent: [-180, -90, 180, 90] })


1

ol.source.XYZ has a maxZoom option source: new ol.source.XYZ({ url: 'http://localhost:4200/assets/tile/{z}/{x}/{y}.png', maxZoom: 13 })


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&' + ...


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