NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I want to have tiles available for and offline web-app (local server). However the overlay of POIs will change occasionally. Furthermore, I need to draw routes (vector lines) on the map in real-time based on updating data from the db.

Is this possible?

asked 20 Feb '11, 07:00

Lee's gravatar image

Lee
1111
accept rate: 0%

How big is this area you are talking about, how many routes, and what database?

(20 Feb '11, 08:13) emj

Yes it's possible. OpenLayers (a popular slippy map javascript library) can be downloaded and run locally, hence on openlayers.org you see a "Link to the hosted version" and a download link. You want to download. And when you come to invoke it with a <script> tag, you would reference a relative path rather than the openlayers.org URL.

Likewise for the tileset. Rather than having OpenLayers point at a tileset on a remote server (the normal setup) you would point it at relative tile URLs.

You then need tile images arranged in a standard directory structure on your local disk. You might come by these tile files by downloading them from someone else's tile server, e.g. using tile downloader software, but this approach tends to be problematic for the source server, if you're downloading more than a couple of hundred tiles (a large area of map or several zoom levels). A better thing to do (and much more flexible and fun!) is Creating your own tiles (various approaches) Once you've got a directory full of tiles, and figured out how to initialise OpenLayers to the right part of the world... it will happily all work from your local machine, or on webserver on a local network, with no internet connection.

This a unique advantage of OpenStreetMap. Google maps and other providers do not allow their maps to be used in this way.

permanent link

answered 21 Feb '11, 15:55

Harry%20Wood's gravatar image

Harry Wood
9.5k2588128
accept rate: 14%

It all depends on what you want to do, and what you have: one way would be to:

  1. setup a reverse proxy for tile.osm.org, to cache tiles. Either a small php script, or Varnish
  2. install postgis
  3. install tinyows
  4. load WFS from Tinyows on top of Openlayers

But I have not seen any tools for updating this in realtime, I'm not entirely sure there are standard tools for that, except just reloading all the features.

permanent link

answered 20 Feb '11, 08:28

emj's gravatar image

emj
2.0k123547
accept rate: 15%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×106
×57
×42

question asked: 20 Feb '11, 07:00

question was seen: 11,791 times

last updated: 21 Feb '11, 15:55

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum