Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hopefully someone can help. I'm using OpenLayers and have a TMS layer with local tiles stored. When drawing the tiles it seems slow, I see the tiles load one by one.

Is there a way to make getURL request multiple tiles at once?

Thanks

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

You are running into the limit of multiple connections to one server.

According to standards the HTTP 1.1 RFC limits persistent connections to 2 per server. This means that at one time a browser should parallel download/receive only two files from the same server.

This limit was set in the early days of the internet, and thankfully most browsers ignore this limit and request for more resources simultaneously.

So you should see 6 to 8 requests simultaneously, if you use a modern browser like Mozilla Firefox or Google Chrome.

To increase the speed even further, you need to serve the tiles from several hostnames. By configuring additional hostnames, the browser will load more tiles simultaneously, resulting in a faster load time.

To set this up:

  • Set up multiple DNS aliases for the same content. It may make sense to simply set up a wildcard DNS name for tile loading, a la *.tile.openstreetmap.org

  • Change the OpenLayers.Layer creation to use multiple URLs:

Layer.TMS("Name", ['http://tile1.tile.openstreetmap.org/tiles/', 'http://tile2.tile.openstreetmap.org/tiles/'], {'layername':'mapnik'})

You should also have a look at this sample: Multiple Server URLS

share|improve this answer
    
Perfect thanks. –  Strikeforce Mar 19 '13 at 10:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.