New answers tagged

2

This is not really a GIS question, but pure JS one, but any way ... When going to the next row, your forgot so set value of right to initial value of left + size, so it retained the last value from previous row, which it utmost right + size, so the first feature/cell drawn has the length of five widths. Relevant code should then be: while(topPx > 0) { ...


0

Thanks for the help from professional people. Now the problem is clear. If I want pass character parameter to a SQL view in Geoserver, I should use double quotes and single quotes like this: "viewparams": "col:" + "'GREEN'", where 'GREEN' is the value I want pass. Meanwhile, on the Geoserver side, I should modify the default ...


1

To update viewparams you will need untiled.getSource().updateParams({"viewparams": 'id:'+num});


1

In QGIS you could render something like the graphic you show using the geometry generator marker option. Each cardinal direction could have a field associated with it - N, NE, E, etc. Each triangle would be built using the coordinates ($x, $y) of the point and rotated depending on the compass direction: make_triangle( make_point($x, $y), ...


3

In your first example teren should be global so you can remove the old layer before adding a new one $( document ).ready(function() { var teren; $("#id_primarie").change(function(){ console.log('test'); map.removeLayer(teren); var id_primarie = $('#id_primarie').val();...


1

Apart from directly fetching feature collection from Postgres itself, if you have an array of Polygon/MultiPolygon you can do - ol.proj.proj4.register(proj4);// This line is optional and required if you have different source projection, here you are registering proj4 js for projection. const polygon = new ol.Feature({ geometry: new ol.geom....


1

It is not clear if the passed in geojson argument is an array of rows of TEXT representing a geometry each. This is assumed in your function. Do you ever hit the "here" console log? As mentioned in comments, better fetch a FeatureCollection (as JSONB) from the DB directly [*]: SELECT JSONB_BUILD_OBJECT( 'type', 'FeatureCollection', ...


0

Macromedia Freehand - if the year was 1999. Thats what i used when i was at University, to do a very similar project. Jokes aside though, the point im making is that perhaps this is less of a 'GIS Software' question and maybe more of a 'multimedia software' question? You could potentially create the windmills in said multimedia software and then ave them as ....


1

You will need a tileLoadFunction to load the tile via xhr with an Authorization header. See https://openlayers.org/en/latest/apidoc/module-ol_Tile.html#~LoadFunction var source = new ol.source.TileWMS({ url:url, serverType: 'geoserver', params: { 'LAYERS': '2-0', 'TILED': true ...


1

Deduplicating a polygon is possible, I use the following code: private LineString deDuplicate(LineString exteriorRing) { ArrayList<Coordinate> outRing = new ArrayList<>(); int nPoints = exteriorRing.getNumPoints(); Point lastPoint = exteriorRing.getPointN(0); for (int i = 1; i < nPoints; i++) { Point p = exteriorRing....


0

I opened an issue here, on the GitHub repo of OpenLayers. M393 Answered me a way of changing declutter and it worked truly. I used this code and it worked truly. layer.declutter_ = !layer.declutter_; let source = layer.getSource(); source.refresh() Also, M393 said, A PR adding the missing setDeclutter(declutter) method with the above code might make sense, ...


2

You can use a geometry function in the draw to ensure the third point is always to the right of the second point const draw = new Draw({ source: this.vectorLayer.getSource(), type: 'LineString', maxPoints: 3, geometryFunction: function(coordinates, geometry) { if (!geometry) { geometry = new ol.geom.LineString(coordinates); ...


0

The XML being posted, formatted for reability, looks as follows: <Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <Insert&...


0

It's refreshing for me. I don't know it's good for your case or not. (zoom filtering just extra.) var lyrSource = new VectorTileSource({ cacheSize: 1, format: new MVT(), url: 'http://localhost:9080/maps/mapname/:layer/{z}/{x}/{y}.vector.pbf', }); var layer = new VectorTileLayer({ preload: 0, declutter: ...


2

The interaction is designed to handle multiple formats and errors are to be expected until it finds a format which works. Some formats will throw an error if not caught while others fail silently, so if no format works which error would it return? For a single format where you you need specific error handling it is easy to add your own drag and drop map....


0

I think, this is not possible. Working with labels is difficult within qgis2web. You have two possibilities: Vector - Geometry tools - Centroids Save your layer. Set zoom/scale level for the layer, NOT for the labels (create labels). Size for points: 0px. Other placement for the labels: Move all points or move some points (...before 0px.....) Now you have ...


2

If you have a EPSG:4326 tilegrid but are only interested in tiles from a smaller region you should use tileGrid: new ol.tilegrid.WMTS({ origin:ol.extent.getTopLeft(projectionExtent), resolutions: resolutions, matrixIds: matrixIds, extent: [44.03, 23.34, 63.34, 39.78] }) You should also check the WMTS capabilities document to ...


0

map.getInteractions().forEach(x => x.setActive(false)); Works also with setActive(true) to re-enable interactions.


1

If you are processing a map click using forEachFeatureAtPixel, getFeaturesAtPixel or hasFeatureAtPixel each of those methods has a layer filter option: layerFilter: function (layer) { return layer === mylayer; }, so you can create separate handlers for each of your layers if you wish. You can determine the topmost visible layer using var topLayer = map....


0

function hideshowfeature(layer,id) { feature=layer.getSource().getFeatureById(id); if (feature) { if (!feature.get('hidden')) { feature.setStyle(new ol.style.Style({})); feature.set('hidden',true); } else { feature.setStyle(); feature.unset('hidden'); } ...


2

Instead of using all your WMS sources wmsLayersSources.forEach(function(value, i){ Only use sources which are in visible layers wmsLayers.forEach(function(layer, i){ if (layer.getVisible()) { const value = layer.getSource(); queryLayers = `${value["params_"].LAYERS}` } ...


2

Create separate datasets for the countries and for the borders. (They can be subdivided independently.) Then you can simply fill the land polygons without a border. You might want to style coastlines and borders on land differently; Natural Earth alreay has those datasets.


0

Thank you @Mike for helping me to get off the wrong track. Now it works fine with OpenLayers 6 The problem in my case was that I could remove the proj4 library which made life easier. I started with the OSM Example Map with EPSG:3587 and added my own WMS Server with EPSG:25832. Therefore I initially neeeded a reprojection. But as all my layers in my final ...


0

This is the code, maybe it's will help someone: var exportOptions = { filter: function(element) { var className = element.className || ''; return ( className.indexOf('ol-control') === -1 || className.indexOf('ol-legend') > -1 || (className.indexOf('ol-attribution') > -1 && className.indexOf('ol-...


Top 50 recent answers are included