Using HyperCities Maps in Other Applications

From HyperCities Help
Revision as of 16:14, 30 May 2013 by Davidshepard (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Many of the maps that HyperCities uses are available on HyperCities' own tile server. Since they are tiled in the standard Google Maps tile format, they can be used in any map tile service that accepts that format.

Contents

The server

The server is http://tiles.ats.ucla.edu. This is a standard HTTP server; to get a list of all the maps, visit http://tiles.ats.ucla.edu/tiles/. Every folder represents a map.

The format

Google Maps tiles can be used in any Google Maps application, as well as OpenLayers and Google Earth. They may also work in other geobrowser applications as well.

OpenLayers Example

In OpenLayers 2.x, you can use the OpenLayers.Layer.TMS layer type. All our maps are in EPSG:4326 projection. Here's an example:

   // Example using Aegaron
   var layer = new OpenLayers.Layer.TMS(
       "Aegaron",
       "http://tiles.ats.ucla.edu/tiles/Aegaron_0001/", {
       isBaseLayer: false,
       type: "png",
       getURL: function($bounds) {
           var res = this.map.getResolution(),
               x = Math.round(($bounds.left - this.maxExtent.left) /
                   (res * this.tileSize.w)),
               y = Math.round((this.maxExtent.top - $bounds.top) /
                   (res * this.tileSize.h)),
               z = this.map.getZoom(),
               path = z + "/" + x + "/" + y + ".png",
               url = this.url
           ;
   
           if (url instanceof Array) {
               url = this.selectUrl(path, url);
           }
           return url + path;
        },
        maxExtent: new OpenLayers.Bounds(-20037508.3427892, 
                                                   -20037508.3427892, 
                                                   20037508.3427892, 
                                                   20037508.3427892
        ),
        numZoomLevels: 21,
        maxResolution: 156543.0339,
        units: 'm',
        projection: "EPSG:4326",
        displayProjection: new OpenLayers.Projection("EPSG:4326")
   });


Using maps in Google Earth

To use a map in Google Earth, you need to add a network link to the map's doc.kml. Click on the map service and copy the URL of the doc.kml file in there, for example http://tiles.ats.ucla.edu/tiles/Aegaron_0001/doc.kml.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox