Simple Multi-Layer Zoom (map) Tiles in HTML / JavaScript

6.2k Views Asked by At

I'm trying to create a simple multi-layer zoom map with tiles in JavaScript (similar to Google Maps --- the more you zoom in the more details you see). I don't want to use the Google Maps API because I am creating fictional treasure maps.

I only want 2 zoom levels --- zoomed out and zoomed in. I made 500 pixel by 500 pixel tiles. The zoomed out view uses only one tile and the zoomed in view uses 4 tiles. The viewable area for the tiles is 75 pixels by 75 pixels (window). In both views the user can pan.

Below are both views:

Zoomed In View

Zoomed Out View

I'm having a tough time getting started. I would like to do this in HTML / CSS / JavaScript. I found something called Polymaps (http://polymaps.org) which seems to offer what I want but with a lot of extra features. There's no tutorial on creating a map with custom tiles. Is this possible to easily do with JavaScript? Any recommendations on what to use?

3

There are 3 best solutions below

2
coderLMN On

Try SVGPan library :

The SVGPan library features:

  • Panning (pan à la Google maps) (click on the white background and pan)

  • Zooming (using the mouse wheel)

  • Element dragging (click on a drawing element and drag it somewhere else)

  • Combinations of the above like zooming while dragging

demo

0
user3661656 On

Here are three options for implementing zoomable, multi-resolution images:

0
polloss On

Maybe these js libs will serve the purpose:

I'm using jQuery-Tiles to display a fantasy map for a personal/fun project.