OpenLayers 3: Reload failed tiles - openlayers-3

I am using OpenLayers 3 with a Zoomify tile source. Based on various conditions I have to re-render my set of tiles on the server side and display the new set to the user as soon as possible.
What I would want to do is to display a single zoom level as soon as this is rendered on the server side, and OpenLayers automatically try to get the other tiles when they are ready. But I found that once a tile is not found OpenLayers won't try to reload it afterwards.
I am trying to do this manually and I want to catch the tileloaderror event on the Zoomify Source. The event is triggered correctly and I receive the Tile url that was not found. What would I want to do is to add a function here on a timeout to retry to load the tile but I didn't find anything in the API.
Is there any method to try to reload a tile if it fails ?

If anyone has encountered this issue, this will be supported natively by OpenLayers. Reference

Related

handle drop event in ol.interaction.DragAndDrop

Why is non of the specified formatconstructors called for dragging and drop images on the map? I would like to write my own ol.format to read geotagged images (e.g. jpg), but the handled event has never an image file attached.
Thanks.

OpenLayers 3: Map is blurry

Sometimes the map is blurry when I add my map (same html, css, js) to a different page. The different page may have other html, css and js inside of it. The clear picture on the left is inside a page with added CSS from a third party. The one on the right is without someone else's html, css, and js.
How do I fix this issue?
One thing I noticed when inspecting their details is that the canvas dimensions for the second example is much smaller.
Edit [Fixed!]:
I found the problem looking at the ol.js source. On console, the blurry image has map.frameState_.pixelRatio = 0.89 (defaults to window.devicePixelRatio), while the clear image had map.frameState_.pixelRatio = 1. If I set pixelRatio = 1 when I initialize the map, it fixes the problem:
var map = new ol.Map({pixelRatio: 1, ...});
It turns out that if you your internet browser is zoomed in (eg, to 90%), window.devicePixelRatio will change, which causes the blurriness. However, when you zoom back to 100%, the map is still zoomed until you refresh the page.
This is a well known issue that has not been fixed yet.
I would suggest detecting if the browser has been zoomed and post an alert to the user like - "Hey. The map will suck if you don't have browser zoomed at 100%".
And a little offtopic - if you change the container size and the map if blury, just call map.updateSize() to fix it.

javaFX webview with openlayers, i drag map tiles "as images" out of the programs screen instead of map dragging

I use javaFX 8 with Openlayers 3 in a webview.
Whenever i try to drag the mouse it works for only a small distance (maybe the tile thats loaded on application start?).
After that i seem to grab the entire map tile image (like you can do e.g. in chrome with normal images) and i can move it out of the application screens border.
Because of this i can not move the map around.
Any idea what could cause this or how i could start debugging? Openlayers inspected via weinre throws no js errors it seems, javaFX itself is completely new to me and i get no default errors as well.
Ok, even when you haven't got the problem any more as you are using different tools, for the record:
What for me seems to be working is to define the divfor the map with the ondragstart handler like this:
<div id="map" ondragstart="javascript: return false;"></div>
It seems that in OL 3.1.1 sometimes the start of a drag bubbles up to the WebView as it receives a drag detected event and this starts the image drag. This did not happen in OL 3.0.0
Defining the div like that helped in my case.

Delphi Teechart - Save Image without User Interaction

I am using the Teechart component that comes with Delphi XE3.
I need to have multiple graphs and then save them out to a jpg file.
The user can select a keyword and that displays each graph.
What I need to do is for each keyword, draw the graph and then
save it out to a file, without user interaction.
I have tried the event OnAfterDraw and then save the chart as an
image and then call for another keyword. However this does not work
because when you save the image it recalls the OnAfterDraw and I
either end up an endless loop OR if I set the event to nil and then
reset it back, it never gets called again.
Does anyone have any suggestions on how to do this please ?
Regards
Anthoni
You could try calling TChart.Draw(); the chart to force the chart being rendered before exporting so that you don't have the need to use the OnAfterDraw event.
OK, So I've found a way but it seems very kludgy to me.
Basically, I placed a Timer on the form and moved the teechart OnAfterDraw event to the private section. Then I build my keyword list and then start the timer.
The timer, first disables itself then adds the OnAfterDraw event to the TeeChart before calling a procedure to fill in the chart information.
Inside OnAfterDraw I save out the chart as an image, check if any more keywords are available and if so, reactivate the timer, otherwise fire my own event.
Like I said, this works but not sure of the overall ramifications of it.
If anyone has any suggestions or comments on this method I would greatly aprpeciate it.
Regards
Anthoni

Refresh browser?

I am working with images and changing their sizes dynamically from the input I get from the user.
when I change the size of the image first time it doesnot reflect the changes when I click the refresh the page using the browser button the change gets reflected and after that tere is no need to click the refresh button
Please tell how shall I do it so that there is no need to click the refresh button of the browser ,the changes but get reflected at one shot.
Thanks
Ritz
Your browser is cacheing the image. One easy way to get around this is to append something to the image URL such as "?v=101", "?v=102", etc. where the number is a version # you track on each image.
E.g.:
http://mysite.com/image.jpg?v=101
http://mysite.com/image.jpg?v=102
http://mysite.com/image.jpg?v=103
...
Or:
http://mysite.com/imagegen.php?name=foo&v=101
http://mysite.com/imagegen.php?name=foo&v=102
http://mysite.com/imagegen.php?name=foo&v=103
...
You don't have to look at the version number in your code, but its presence on the URL makes the browser think it's a different resource and therefore load it again without having to refresh.

Resources