Zh GoogleMap CustomMapType: Difference between revisions

From Documentation
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 25: Line 25:
* size and type of tiles
* size and type of tiles
* Get Tile URL function by using it Google Maps API can get tiles
* Get Tile URL function by using it Google Maps API can get tiles
* Layer Type - it is way to how map of this type will be displayed
** Map - displays only your tiles
** Overlay - display your tiles over main map. This useful if your map covers only part of world and you want to show the other part too.


The result is
The result is

Revision as of 20:58, 28 January 2012

Creating Custom Map Type

In this tutorial we will create two Custom Map Types


Creating custom map type for common map

This map types for map, which you are not created (not create tiles), but you want use it in component (or plugin).

For example create custom map type for Open Street Map (which is included in component as predefined map type)


Go to Map Types


Lets create new type

In Map Types Details you have to fill required filds

  • Title - this is Name of your button on map
  • Descripion - tooltip for button
  • minZoom and maxZoom for map (you should know for what zoom tiles exists)
  • size and type of tiles
  • Get Tile URL function by using it Google Maps API can get tiles
  • Layer Type - it is way to how map of this type will be displayed
    • Map - displays only your tiles
    • Overlay - display your tiles over main map. This useful if your map covers only part of world and you want to show the other part too.

The result is


This is function code (this is JavaScript function)


function(ll, z) {
	var X = ll.x % (1 << z);  /* wrap */
	return "http://tile.openstreetmap.org/" + z + "/" + X + "/" + ll.y + ".png";
}