I'm using Openlayers 7.
Is it possible to force the layer source (ImageWMS) to load a CQL filtered image, i.e. to buffer it, while the layer is not visible?
I would like to avoid the image from a previous filter to flash on the map, when the filter is changed while the layer is invisible, and the layer is then subsequently made visible after the filter change. The flash of the old image is obviously for the duration of the new filtered image downloading.
Event imageloadend only seems to fire after the layer has been made visible, so while the filter had been updated programmatically, the image wasn't requested from the server and refreshed since the layer wasn't visible at the time of the filter change.
As possible option you could remove extra layers and save only base layer (like osm).
Related
I'm trying to load points(image coordinates) from a file and display it on openseadragon using svg-overlay. Converted the points to viewport coordinates using imageToViewportCoordinates but they don't look positioned correctly.
I am using a slider to display different images into the viewer and for each image some points are displayed. The points are correctly marked for some of the images. I just create a single overlay at the beginning, clear elements and set points corresponding to the image in slider change event.
Is it possible that using a single overlay is causing the issue? Do I have to set any offset or make additional tranformations to the svg elements.
Markers from Matlab plot and Openseadragon.
set points corresponding to the image in slider change event
Perhaps waiting until the Viewer open event will work better, as the image dimension properties will be set before using the conversion functions
Is it possible to change map style from Streetview to satellite retaining all manually drawn layers (geojson shapes)?
e.g.
Let's say we have a circle on Streetview map and want to show the same circle in street view mode. After we change map style to satellite we have to add the circle again. Is there any possibility to avoid that?
I want to find the possibility do not process something that was processed already again, to exclude listening for style changes and adding layers again.
Is any multi styles map instances supported by mapbox?
Or the possibility to render the whole style as a background or might be even having Streetview as a layer in my main style to achieve that?
Check out https://github.com/mapbox/mapbox-gl-js/issues/4006 for a few ideas of how this could be made easier along with some workarounds.
I have large files (~100mb each) with GeoJSON/TopoJSON data.
These have states and counties boundaries. States layer loads just fine as it doesn't have so much data, but the one with counties just makes page crash in Chrome.
So, files themselves load from network and are parsed properly, but when it comes to putting them on a Leaflet map, it freezes and crashes.
As a solution, I wonder if I can filter features by their coordinates?
I can get viewport boundaries of the map.
Are there methods I can filter features with coordinates that are inside some boundaries?
This way I could filter only those that should be rendered in the current view and ignore the rest, then repeat this routine on map/zoom.
First of all, Leaflet has a getBounds() method that you can use in order to load only the features that are inside the Bounding Box. This could be done by triggering the getBounds() method when the map "moves" (zoom, dragging), using the moveend event.
So, basically:
map.on('moveend', function() {
map.getBounds()
//erase the features you had on the map
//Then load on the map only the features with coordinates inside the Bounging Box.
}
Of course, the above is just an approach. Every time the map "moves", the previous feautures are erased and new ones are loaded. It may result to slow loading of features but you may have to live with it for so large files.
Also, you can experiment with the code by, for example, loading the new features and then erasing the old. In addition, you can load features for a Box bigger than the Bounding Box.
Our website selects establishments from a query and returns the results to the user in batches of 10 locations displaying details in a gridview and locations as user pushpins in bing maps. Hovering the item in the map pops up info panel etc.
My requirements to make this more useable are as follows:-
1) When a user hovers over the item in the gridview list, the corresponding pin on the map should be highlighted.
2) When a user clicks an item in the list, the map zooms to that location. (which I think is relatively simple by redrawing map with different centre and scale)
My thoughts for the first one are to use JavaScript to get the element of the associated pushpin and replace it with a new image in the ‘highlighted’ state and to replace it with the original afterwards.
So my question is:-
Is this the right approach or is there a better one and is there any sample code doing something similar available out there?
Many thanks
Paul
That's exactly the approach I use ;) The only slight modification I'd suggest is that, instead of replacing the image with an entirely new one, you make use of a sprite sheet that has both the highlighted and unhighlighted images on it.
Then, in the onmouseover event handler, set the typeName property of the pushpin to assign a CSS class that offsets the image to display only the highlighted state, and in the onmouseout event reset the CSS class again so that the unhighlighted background image is displayed. That way, your page will load quicker and you won't have to risk a flicker as the old image is replaced with the new.
Reference for typeName property: http://msdn.microsoft.com/en-us/library/gg427629.aspx
Ok, I have page (html, javascript, css) with two layers that completely cover the browser window. The one in front contains a navigation that should clickable. The one in the back contains a map with markers that should also be clickable. The navigation (the one in the front) at times can occupy the complete window height and width so limiting it's size is not really an option.
Now the problem is how to get the click events to the back layer so the map markers can receive their click event. backlayer.dispatchEvent(e) takes backlayer as the event target, but any of my markers inside the backlayer could be the target, so I was wondering if there is a simpler way then check the bounding-box of every map marker element and call dispatchEvent on the map marker that matches directly?
Thanks!
You can try using jQuery or a similar library to simulate a click on the bottom layer when clicking the upper one.