Ubuntu Tile Server, tile generation for specific area(country) - render

I built a tile server on Ubuntu 14.04 LTS using this. It works fine.
Short intro how it works:
When a request is thrown on apache, it sends the request to
renderd and mapnik. If tile doesn't exist for those coordinates, it renders(creates) on-the-fly needed tiles, and saves it to tile
folder using .meta extension, so next time when a request comes, it
wont re-render if tile already exsits, it just servers the existing
tile in file system.
Problem:
When multiple requests are thrown, mapnik and renderd most of
the time they need to render(create) tiles, because they don't exist. It takes long time
sometimes, few seconds before loading map in specific areas.
Question:
I know there is some workaround for this, for example using:
render_list, to pre-render tiles, but I couldn't understand how to use
it, and how to give it parameters so it will generate tiles for a
specific country only(the one my map is used the most).

Related

How to prevent rendering artifacts in PDFKit/NSImage?

I'm trying to create a tool to rasterise vector images—stored in PDF files—on macOS, but the resulting images contain artifacts around the edges of some shapes. Preview.app, on the other hand, always renders the PDF flawlessly, as shown in this example:
I've tried:
Loading the PDF document using PDFKit, and rendering the page using both draw(with:to:) and thumbnail(of:for:)
Loading the PDF document into an NSImage (which creates an NSPDFImageRep), and using cgImage(forProposedRect:context:hints:)
In both cases I get these aliasing-like artifacts as seen on the left-hand-side of the image above. The PDF file is out of my control, so can't be changed to fix any issues it might have. I'm currently trying to migrate away from Cairo (which renders correctly) to Apple's PDF rendering for performance reasons (PDFKit renders it much more quickly, albeit with these artifacts).
Is there anything I've missed which would fix the output?
So it looks like the issue was caused due to me rasterising PDFs on multiple threads (specifically my tool rasterises PDFs in multiple resolutions, so I thought why not simultaneously).
Performing the operations sequentially on the main thread instead fixed it. I thought that I had come up with a way to use it concurrently by initialising the CGContext manually (instead of using NSImage's lockFocus()/unlockFocus() and NSGraphicsContext.current), but alas, as I soon as I add a context.scaleBy (to generate the images at different sizes), it fails again.
So for now I'm just doing it on the main thread until another solution comes along.

The volt view never releases memory

A beginner volt question here :-).
I’ve created a simple volt app which pulls random images from the file system - a slide show. The image data is retrieved in a server task (in addition to the file path, I want dimensions orientation etc, so I use a ruby library) and then its passed back to the main controller. So I have a method (get_random_pic) in the controller which sets the img path etc on the page for a img tag to use in the view:
<img width="{{page._image_data[3]}}}}" src="{{page._image_data[0]}}">image</img>
(An aside: I am using an array in an effort for the value binding "signals" to arrive at the same time - otherwise the image width updates at a different time to the image path - however its still not synchronous with an array)
Then I use setTimeout in the controller to call the get_random_pic method again (via a button).
setTimeout(function(){ document.getElementById("myButton").click(); }, 5000);
This works perfectly however memory usage never stops growing (e.g. after 20min it will 2GB). I assume this is because each time the image is being loaded in the view, the previous image is orphaned and the GC can’t run. Actually I don’t know enough about JS to come to any intelligent reasons as to why, nor an elegant work around. Maybe I could load up the image in a controller instance method and the img tag references directly the binary (rather than pull via file path from file system), and on each iteration I could set it to nil, but I’m hoping there is nicer solution, before I try that.

How to improve performance in image loading on web application?

I have a web application running on local host. The requirement is to load multiple rectangular jpg images (96 images, average 7k in size each) and show on home page when it runs. Images are showed in a grid of 8x12 rows/columns. I am loading image by setting the 'src' attribute of the 'img' in javascript. The url assigned to the 'src' attribute is same for all images but the image id is different. Images are loading but the main issue is that they are not loading very quickly and they are some what loading in a sequence means 1,2,3,4... and so on but some images are not loaded in sequence. I want to improve the performance of this page. I have tried the figure out the timings at different points like:
When call is originated form client (image src attribute is set)
When server is receiving call. (the page on server which serve individual image)
When server is about to return the image.
When on client side image is received/showed (image loaded event called in javascript)
It turned out after looking at the collected data that main time is lost between 1 and 2 above that is between the client side call is originated and server is receiving call for a particular image.
I have also tried setting parameters like maxWorkerThreads, minWorkerThreads, requestQueueLimit and maxconnection in machine.config but no significant improvement yet.
Can someone please help me in this situation as i am stuck here since many days and i am really short of time now. Desperately needs to improve the performance of these images loads.
Thanks in advance.
Since you stress the lack of time, I would advise you to try a jQuery plugin that loads images on demand. The gallery in which you load the pictures, does the user scroll in it? Or is it 1 big field?
If it's a gallery the user can scroll in, I'd strongly suggest you take a look at lazyload. What this plugin does, is it fetches the image only when it is needed. As long as it's not on the screen, it will not be loaded. For a brief example, have a look at this demo.
I hope this can help you out.

working with images in windows phone app - performance

I have an app that allows users to take pictures and store them in the IsolatedStorage. These images are then retrieved to display them in a list. The app suffers from performance issues when there are more than 30+ images in the list. It is taking a long time to retrieve these images from the storage and bind them to the list. A lot of times, the app is just closed by OS because it takes too long.
Also, I think as better resolution devices are coming in the market, the images are getting created with bigger sizes and affecting performance even more.
I need some guidance on how to resolve this. Couple of things I have though about:
1) how can I asynchronously retrieve every image to be retrieved from IS so the page can load but the images are being retrieved in async fashion. Any sample code is appreciated.
2) the other approach will be where I create a thumbnail photo of the actual photo (smaller size and resolution) while storing the original photo and use this thumbnail photo in binding to the list later. If this should be done, then how should I go about processing the image on the fly to create a smaller size thumbnail version of the original photo.
Any other ideas are appreciated as well.
Thanks for your time.
If you are able to, I would recommend using the Async CTP and making the code that loads images from isolated storage async. The methods that generate the thumbnails can be async as well.
If you cannot do this (add these dependencies to your project), use a BackgroundWorker. Perhaps this article can help you get started.
This will allow your UI to be responsive while processing continues on threads in the background.
Do not pretend the Isolated Storage as a SQL Server. There will be great performance difference. If you want to process too much data, send them to server.
However, there is a method for getting a thumbnail. You can use it:
http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx
Also, please check this answer:
Create thumbnail image

Preventing Request Spamming

Scenario
A client application that features a map. The map is an interactive control that upon move/zoom will request tiles (as needed) from a tile server -- a GeoServer in this case. The tile server receives requests for tiles as the user moves around the interactive map. Let us imagine that there is no limit on how many requests the client can make.
Problem
When a user is moving fast, requests to the tile server pile up. The tile server gets bogged down and is not able to provide tiles in a timely fashion.
Additionally, the tile request queue is responded to in request order. So, the user could go from Florida to California and have to wait for Florida tiles to load before seeing any tiles in California.
Questions
How can we improve the perceived performance of the client?
What are some strategies to employ on the client-side to prevent a large amount of requests when panning fast? Zooming fast?
What are some strategies to employ on the server-side to determine if a request is no longer needed or should take lower priority?
Possible Solution
Place a custom proxy in front of the Tile Server such that tiles could be requested with a time-stamp -- later tiles always receiving priority. The proxy could also implement a feature allowing the client application to abandon a request.
Thank you in advance.
I looked at various solutions on stopping image loading. But it seems no one has found a way to stop loading an image when browser has already started downloading it.
So, I can recommend alternative. Browser has a limit of 2 parallel downloads per domain. So, that means you need to load images of different locations from different subdomain so that browser can load multiple locations in parallel.
So, say california images are coming from:
california.yourwebsite.com/images
And florida images from:
florida.yourwebsite.com/images
Moreover, you can use different subdomain for different zoom level so that if images for a certain zoom level are still loading and user chages zoom level, browser can download the new zoom level images immediately.
zoom10.florida.yourwebsite.com/images
For this, you need to create a *.yourwebsite.com DNS mapping to your webserver(s) from your domain panel.
Does this answer your question?

Resources