new Map(container, options) [source]
var map = new maptalks.Map("map",{
center: [180,0],
zoom: 4,
baseLayer : new maptalks.TileLayer("base",{
urlTemplate:'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains:['a','b','c']
}),
layers : [
new maptalks.VectorLayer('v', [new maptalks.Marker([180, 0])])
]
});
Parameter | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
container
|
string | HTMLElement | object | The container to create the map on, can be: 1. A HTMLElement container. 2. ID of a HTMLElement container. 3. Any canvas compatible container |
||||||||||||||||||||||||||||
options
|
Object | construct options
Properties
|
Extends:
Mixes From:
Fires:
- spatialreferencechange
- baselayerchangestart
- baselayerchangeend
- setbaselayer
- baselayerload
- baselayerremove
- addlayer
- removelayer
- resize
- movestart
- moving
- moveend
- dragrotatestart
- dragrotating
- dragrotateend
- animating
- animateinterrupted
- animateend
- animatestart
- pitch
- pitchend
- mousedown
- mouseup
- mouseover
- mouseout
- mouseenter
- mouseleave
- mousemove
- click
- dblclick
- contextmenu
- keypress
- touchstart
- touchmove
- touchend
- fullscreenstart
- fullscreenend
- cancelfullscreen
- viewchange
- zoomstart
- zooming
- zoomend
- touchactstart
- touchacting
- touchactend
Members
(constant) options
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
Object | map's options, options must be updated by config method: map.config('zoomAnimation', false); Properties
|
- Source:
(constant) VERSION
Properties:
Type | Description |
---|---|
String | Version of library |
- Source:
(constant) JSON_VERSION
Properties:
Type | Description |
---|---|
String | Version of the JSON schema. |
- Source:
Static Methods
(protected, static) addOnLoadHook(fn) [source]
Add hooks for additional codes when map's loading complete, useful for plugin developping.
Note that it can only be called before the map is created.
Parameter | Type | Description |
---|---|---|
fn
|
function |
Returns:
Map:(static) fromJSON(container, mapJSON, optionsopt) [source]
Reproduce a map from map's profile JSON.
var map = Map.fromJSON('map', mapProfile);
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
container
|
string | HTMLElement | object | The container to create the map on, can be: 1. A HTMLElement container. 2. ID of a HTMLElement container. 3. A canvas compatible container in node, e.g. node-canvas, canvas2svg |
|||||||||||||
mapJSON
|
Object | map's profile JSON | |||||||||||||
options
opt
|
Object | null | options
Properties
|
Returns:
Map:Methods
isLoaded() [source]
Whether the map is loaded or not.
Returns:
Boolean:getContainer() [source]
Get map's container
Returns:
HTMLElement:getSpatialReference() [source]
Get the spatial reference of the Map.
Returns:
SpatialReference: map's spatial referencesetSpatialReference(spatialReference) [source]
Change the spatial reference of the map.
A SpatialReference is a series of settings to decide the map presentation:
1. the projection.
2. zoom levels and resolutions.
3. full extent.
There are some predefined spatial references, and surely you can define a custom one..
SpatialReference can also be updated by map.config('spatialReference', spatialReference);
A SpatialReference is a series of settings to decide the map presentation:
1. the projection.
2. zoom levels and resolutions.
3. full extent.
There are some predefined spatial references, and surely you can define a custom one..
SpatialReference can also be updated by map.config('spatialReference', spatialReference);
map.setSpatialReference({
projection:'EPSG:4326',
resolutions: (function() {
const resolutions = [];
for (let i=0; i < 19; i++) {
resolutions[i] = 180/(Math.pow(2, i)*128);
}
return resolutions;
})()
});
map.config('spatialReference', {
projection:'EPSG:4326',
resolutions: (function() {
const resolutions = [];
for (let i=0; i < 19; i++) {
resolutions[i] = 180/(Math.pow(2, i)*128);
}
return resolutions;
})()
});
Parameter | Type | Description |
---|---|---|
spatialReference
|
SpatialReference | spatial reference |
Fires:
Returns:
Map: thisgetProjection() [source]
Get the projection of the map.
Projection is an algorithm for map projection, e.g. well-known Mercator Projection
A projection must have 2 methods:
1. project(coordinate) - project the input coordinate
2. unproject(coordinate) - unproject the input coordinate
Projection also contains measuring method usually extended from a measurer:
1. measureLength(coord1, coord2) - compute length between 2 coordinates.
2. measureArea(coords[]) - compute area of the input coordinates.
3. locate(coord, distx, disty) - compute the coordinate from the coord with xdist on axis x and ydist on axis y.
Projection is an algorithm for map projection, e.g. well-known Mercator Projection
A projection must have 2 methods:
1. project(coordinate) - project the input coordinate
2. unproject(coordinate) - unproject the input coordinate
Projection also contains measuring method usually extended from a measurer:
1. measureLength(coord1, coord2) - compute length between 2 coordinates.
2. measureArea(coords[]) - compute area of the input coordinates.
3. locate(coord, distx, disty) - compute the coordinate from the coord with xdist on axis x and ydist on axis y.
Returns:
Object:getFullExtent() [source]
Get map's full extent, which is defined in map's spatial reference.
eg: {'left': -180, 'right' : 180, 'top' : 90, 'bottom' : -90}
eg: {'left': -180, 'right' : 180, 'top' : 90, 'bottom' : -90}
Returns:
Extent:setCursor(cursor) [source]
Set map's cursor style, cursor style is same with CSS.
map.setCursor('url(cursor.png) 4 12, auto');
Parameter | Type | Description |
---|---|---|
cursor
|
String | cursor style |
Returns:
Map: thisresetCursor() [source]
Reset map's cursor style.
map.resetCursor();
Returns:
Map: thisgetCenter() [source]
Get center of the map.
Returns:
Coordinate:setCenter(center) [source]
Set a new center to the map.
Parameter | Type | Description |
---|---|---|
center
|
Coordinate |
Returns:
Map: thisgetSize() [source]
Get map's size (width and height) in pixel.
Returns:
Size:getContainerExtent() [source]
Get container extent of the map
Returns:
PointExtent:getExtent() [source]
Get the geographical extent of map's current view extent.
Returns:
Extent:getProjExtent() [source]
Get the projected geographical extent of map's current view extent.
Returns:
Extent:getPrjExtent() [source]
Alias for getProjExtent
Returns:
Extent:getMaxExtent() [source]
Get the max extent that the map is restricted to.
Returns:
Extent:setMaxExtent(extent) [source]
Sets the max extent that the map is restricted to.
map.setMaxExtent(map.getExtent());
Parameter | Type | Description |
---|---|---|
extent
|
Extent |
Returns:
Map: thisgetZoom() [source]
Get map's current zoom.
Returns:
Number:getZoomForScale(scale, fromZoom, isFraction) [source]
Caculate the target zoom if scaling from "fromZoom" by "scale"
Parameter | Type | Description |
---|---|---|
scale
|
Number | |
fromZoom
|
Number | |
isFraction
|
Boolean | can return fractional zoom |
Returns:
Number: zoom fit for scale starting from fromZoomsetZoom(zoom, optionsopt) [source]
Sets zoom of the map
Parameter | Type | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
zoom
|
Number | ||||||||||
options
opt
|
Object | null | options
Properties
|
Returns:
Map: thisgetMaxZoom() [source]
Get the max zoom that the map can be zoom to.
Returns:
Number:setMaxZoom(maxZoom) [source]
Sets the max zoom that the map can be zoom to.
Parameter | Type | Description |
---|---|---|
maxZoom
|
Number |
Returns:
Map: thisgetMinZoom() [source]
Get the min zoom that the map can be zoom to.
Returns:
Number:setMinZoom(minZoom) [source]
Sets the min zoom that the map can be zoom to.
Parameter | Type | Description |
---|---|---|
minZoom
|
Number |
Returns:
Map: thisgetMaxNativeZoom() [source]
Maximum zoom the map has
Returns:
Number:getGLZoom() [source]
Zoom for world point in WebGL context
Returns:
Number:getGLScale(zoomopt) [source]
Caculate scale from gl zoom to given zoom (default by current zoom)
Parameter | Type | Description |
---|---|---|
zoom
opt
|
Number | target zoom, current zoom by default |
Returns:
Number:zoomIn() [source]
zoom in
Returns:
Map: thiszoomOut() [source]
zoom out
Returns:
Map: thisisZooming() [source]
Whether the map is zooming
Returns:
Boolean:isInteracting() [source]
Whether the map is being interacted
Returns:
Boolean:setCenterAndZoom(center, zoom) [source]
Sets the center and zoom at the same time.
Parameter | Type | Description |
---|---|---|
center
|
Coordinate | |
zoom
|
Number |
Returns:
Map: thisgetFitZoom(extent, isFraction) [source]
Caculate the zoom level that contains the given extent with the maximum zoom level possible.
Parameter | Type | Description |
---|---|---|
extent
|
Extent | |
isFraction
|
Boolean | can return fractional zoom |
Returns:
Number: zoom fit for scale starting from fromZoomgetView() [source]
Get map's current view (center/zoom/pitch/bearing)
Returns:
Object: { center : *, zoom : *, pitch : *, bearing : * }setView(view) [source]
Set map's center/zoom/pitch/bearing at one time
Parameter | Type | Description |
---|---|---|
view
|
Object | a object containing center/zoom/pitch/bearing return {Map} this |
getResolution(zoom) [source]
Get map's resolution
Parameter | Type | Description |
---|---|---|
zoom
|
Number | zoom or current zoom if not given |
Returns:
Number: resolutiongetScale(zoom) [source]
Get scale of resolutions from zoom to max zoom
Parameter | Type | Description |
---|---|---|
zoom
|
Number | zoom or current zoom if not given |
Returns:
Number: scalefitExtent(extent, zoomOffset) [source]
Set the map to be fit for the given extent with the max zoom level possible.
Parameter | Type | Description |
---|---|---|
extent
|
Extent | extent |
zoomOffset
|
Number | zoom offset |
Returns:
Map: - thisgetBaseLayer() [source]
Get the base layer of the map.
Returns:
Layer:setBaseLayer(baseLayer) [source]
Sets a new base layer to the map.
Some events will be thrown such as baselayerchangestart, baselayerload, baselayerchangeend.
Some events will be thrown such as baselayerchangestart, baselayerload, baselayerchangeend.
Parameter | Type | Description |
---|---|---|
baseLayer
|
Layer | new base layer |
Fires:
Returns:
Map: thisremoveBaseLayer() [source]
Remove the base layer from the map
Fires:
Returns:
Map: thisgetLayers(filteropt) [source]
Get the layers of the map, except base layer (which should be by getBaseLayer).
A filter function can be given to filter layers, e.g. exclude all the VectorLayers.
A filter function can be given to filter layers, e.g. exclude all the VectorLayers.
var vectorLayers = map.getLayers(function (layer) {
return (layer instanceof VectorLayer);
});
Parameter | Type | Description |
---|---|---|
filter
opt
|
function | a filter function of layers, return false to exclude the given layer. |
Returns:
Array.<Layer>:getLayer(id) [source]
Get the layer with the given id.
Parameter | Type | Description |
---|---|---|
id
|
String | layer id |
Returns:
Layer:addLayer(layer) [source]
Add a new layer on the top of the map.
Parameter | Type | Description |
---|---|---|
layer
|
Layer | Array.<Layer> | one or more layers to add |
Fires:
Returns:
Map: thisremoveLayer(layer) [source]
Remove a layer from the map
Parameter | Type | Description |
---|---|---|
layer
|
String | Array.<String> | Layer | Array.<Layer> | one or more layers or layer ids |
Fires:
Returns:
Map: thissortLayers(layers) [source]
Sort layers according to the order provided, the last will be on the top.
map.addLayer([layer1, layer2, layer3]);
map.sortLayers([layer2, layer3, layer1]);
map.sortLayers(['3', '2', '1']); // sort by layer ids.
Parameter | Type | Description |
---|---|---|
layers
|
Array.<string> | Array.<Layer> | layers or layer ids to sort |
Returns:
Map: thistoDataURL(optionsopt) [source]
Exports image from the map's canvas.
Parameter | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
opt
|
Object | options
Properties
|
Returns:
String: image of base64 format.coordToPoint() [source]
shorter alias for coordinateToPoint
pointToCoord() [source]
shorter alias for pointToCoordinate
coordToViewPoint() [source]
shorter alias for coordinateToViewPoint
viewPointToCoord() [source]
shorter alias for viewPointToCoordinate
coordToContainerPoint() [source]
shorter alias for coordinateToContainerPoint
containerPointToCoord() [source]
shorter alias for containerPointToCoordinate
containerPointToViewPoint(containerPoint, outopt) [source]
Converts a container point to the view point.
Usually used in plugin development.
Parameter | Type | Description |
---|---|---|
containerPoint
|
Point | |
out
opt
|
Point | optional point to receive result |
Returns:
Point:viewPointToContainerPoint(viewPoint, outopt) [source]
Converts a view point to the container point.
Usually used in plugin development.
Parameter | Type | Description |
---|---|---|
viewPoint
|
Point | |
out
opt
|
Point | optional point to receive result |
Returns:
Point:checkSize() [source]
Checks if the map container size changed and updates the map if so.
Fires:
Returns:
Map: thislocate(coordinate, dx, dy) [source]
Computes the coordinate from the given meter distance.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | source coordinate |
dx
|
Number | meter distance on X axis |
dy
|
Number | meter distance on Y axis |
Returns:
Coordinate: Result coordinategetMainPanel() [source]
Return map's main panel
Returns:
HTMLElement:getPanels() [source]
Returns map panels.
Returns:
Object:remove() [source]
Remove the map
Returns:
Map: thisisRemoved() [source]
whether the map is removed
Returns:
Boolean:isMoving() [source]
Whether the map is moving
Returns:
Boolean:getDevicePixelRatio() [source]
Get device's devicePixelRatio, you can override it by setting devicePixelRatio in options.
Returns:
Number:offsetPlatform() [source]
Gets map panel's current view point.
Returns:
Point:getViewPoint() [source]
Get map's view point, adding in frame offset
Returns:
Point: map view pointcoordinateToPoint(coordinate, zoomopt, outopt) [source]
Converts a coordinate to the 2D point in current zoom or in the specific zoom.
The 2D point's coordinate system's origin is the same with map's origin. Usually used in plugin development.
The 2D point's coordinate system's origin is the same with map's origin. Usually used in plugin development.
var point = map.coordinateToPoint(new Coordinate(121.3, 29.1));
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | coordinate |
zoom
opt
|
Number | zoom level |
out
opt
|
Point | optional point to receive result |
Returns:
Point: 2D pointpointToCoordinate(point, zoom, outopt) [source]
Converts a 2D point in current zoom or a specific zoom to a coordinate.
Usually used in plugin development.
var coord = map.pointToCoordinate(new Point(4E6, 3E4));
Parameter | Type | Description |
---|---|---|
point
|
Point | 2D point |
zoom
|
Number | point's zoom level |
out
opt
|
Coordinate | optional coordinate to receive result |
Returns:
Coordinate: coordinatecoordinateToViewPoint(coordinate, outopt) [source]
Converts a geographical coordinate to view point.
A view point is a point relative to map's mapPlatform panel's position.
Usually used in plugin development.
A view point is a point relative to map's mapPlatform panel's position.
Usually used in plugin development.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | |
out
opt
|
Point | optional point to receive result |
Returns:
Point:viewPointToCoordinate(viewPoint, outopt) [source]
Converts a view point to the geographical coordinate.
Usually used in plugin development.
Parameter | Type | Description |
---|---|---|
viewPoint
|
Point | |
out
opt
|
Coordinate | optional coordinate to receive result |
Returns:
Coordinate:coordinateToContainerPoint(zoomopt, outopt) [source]
Convert a geographical coordinate to the container point.
A container point is a point relative to map container's top-left corner.
A container point is a point relative to map container's top-left corner.
Parameter | Type | Description |
---|---|---|
|
Coordinate | coordinate |
zoom
opt
|
Number | zoom level |
out
opt
|
Point | optional point to receive result |
Returns:
Point:containerPointToCoordinate(outopt) [source]
Converts a container point to geographical coordinate.
Parameter | Type | Description |
---|---|---|
|
Point | |
out
opt
|
Coordinate | optional coordinate to receive result |
Returns:
Coordinate:containerToExtent(containerExtent) [source]
Converts a container point extent to the geographic extent.
Parameter | Type | Description |
---|---|---|
containerExtent
|
PointExtent | containeproints extent |
Returns:
Extent: geographic extentdistanceToPixel(xDist, yDist) [source]
Converts geographical distances to the pixel length.
The value varis with difference zoom level.
The value varis with difference zoom level.
Parameter | Type | Description |
---|---|---|
xDist
|
Number | distance on X axis. |
yDist
|
Number | distance on Y axis. |
Returns:
Size: result.width: pixel length on X axis; result.height: pixel length on Y axisdistanceToPoint(xDist, yDist, zoom) [source]
Converts geographical distances to the 2d point length.
The value varis with difference zoom level.
The value varis with difference zoom level.
Parameter | Type | Description |
---|---|---|
xDist
|
Number | distance on X axis. |
yDist
|
Number | distance on Y axis. |
zoom
|
Number | point's zoom |
Returns:
Point:pixelToDistance(width, height) [source]
Converts pixel size to geographical distance.
Parameter | Type | Description |
---|---|---|
width
|
Number | pixel width |
height
|
Number | pixel height |
Returns:
Number: distance - Geographical distancepointToDistance(dx, dy, zoom) [source]
Converts 2d point distances to geographic length.
Parameter | Type | Description |
---|---|---|
dx
|
Number | distance on X axis. |
dy
|
Number | distance on Y axis. |
zoom
|
Number | point's zoom |
Returns:
Number: distancelocateByPoint(coordinate, px, py) [source]
Computes the coordinate from the given pixel distance.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | source coordinate |
px
|
Number | pixel distance on X axis |
py
|
Number | pixel distance on Y axis |
Returns:
Coordinate: Result coordinate(protected) _pointToExtent(extent2D) [source]
Converts a view point extent to the geographic extent.
Parameter | Type | Description |
---|---|---|
extent2D
|
PointExtent | view points extent |
Returns:
Extent: geographic extentanimateTo(view, optionsopt, stepopt) [source]
Update map's view with animation.
map.animateTo({
zoom : 13,
center : [0, 0],
pitch : 30,
bearing : 60
}, {
duration : 6000,
easing : 'out'
}, function(frame) {
if (frame.state.playState === 'finished') {
console.log('animation finished');
}
});
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
view
|
Object | view object | |||||||||||||
options
opt
|
Object | null |
Properties
|
||||||||||||
step
opt
|
function | null | step function during animation, animation frame as the parameter |
Returns:
Map: thisisAnimating() [source]
Whether the map is animating with .animateTo
Returns:
Boolean:getFov() [source]
Get map's fov (field of view);
Returns:
Number: fov in degreesetFov(fov) [source]
Set a new fov to map
Parameter | Type | Description |
---|---|---|
fov
|
Number | new fov in degree |
Returns:
Map: thisgetBearing() [source]
Get map's bearing
Returns:
Number: bearing in degreesetBearing(bearing) [source]
Set a new bearing to map
Parameter | Type | Description |
---|---|---|
bearing
|
Number | new bearing in degree |
Returns:
Map: thisgetPitch() [source]
Get map's pitch
Returns:
Number: pitch in degreesetPitch(pitch) [source]
Set a new pitch to map
Parameter | Type | Description |
---|---|---|
pitch
|
Number | new pitch in degree |
Returns:
Map: thisisFullScreen() [source]
Returns:
Boolean: Element is currently in fullscreen.requestFullScreen() [source]
Request for the full screen
Property | Type | Description |
---|---|---|
dom
|
Object | containerDOM to requestFullScreen |
Properties:
Name | Type | Description |
---|---|---|
dom
|
Object | containerDOM to requestFullScreen |
- Source:
Fires:
Returns:
Map: thiscancelFullScreen() [source]
Cancel full screen
Fires:
Returns:
Map: thispanTo(coordinate, optionsopt) [source]
Pan to the given coordinate
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
coordinate
|
Coordinate | coordinate to pan to | |||||||||||||
options
opt
|
Object | null | pan options
Properties
|
Returns:
Map: thispanBy(point, optionsopt) [source]
Pan the map by the give point
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
point
|
Point | distance to pan, in pixel | |||||||||||||
options
opt
|
Object | null | pan options
Properties
|
Returns:
Map: thistoJSON(optionsopt) [source]
Export the map's json, a snapshot of the map in JSON format.
It can be used to reproduce the instance by fromJSON method
It can be used to reproduce the instance by fromJSON method
Parameter | Type | Default | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
opt
|
Object | null | export options
Properties
|
Returns:
Object: layer's JSONcomputeLength(coord1, coord2) [source]
Caculate distance of two coordinates.
var distance = map.computeLength([0, 0], [0, 20]);
Parameter | Type | Description |
---|---|---|
coord1
|
Array.<Number> | Coordinate | coordinate 1 |
coord2
|
Array.<Number> | Coordinate | coordinate 2 |
Returns:
Number: distance, unit is metercomputeGeometryLength(geometry) [source]
Caculate a geometry's length.
Parameter | Type | Description |
---|---|---|
geometry
|
Geometry | geometry to caculate |
Returns:
Number: length, unit is metercomputeGeometryArea(geometry) [source]
Caculate a geometry's area.
Parameter | Type | Description |
---|---|---|
geometry
|
Geometry | geometry to caculate |
Returns:
Number: area, unit is sq.meteridentify(opts, callback) [source]
Identify the geometries on the given coordinate.
map.identify({
coordinate: [0, 0],
layers: [layer]
},
geos => {
console.log(geos);
});
Parameter | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts
|
Object | the identify options
Properties
|
||||||||||||||||||||||||||||||||
callback
|
function | the callback function using the result geometries as the parameter. |
Returns:
Map: thiszoomToPreviousView() [source]
Zoom to the previous map view in view history
Returns:
Object: map viewhasPreviousView() [source]
Whether has more previous view
Returns:
Boolean:zoomToNextView() [source]
Zoom to the next view in view history
Returns:
Object: map viewhasNextView() [source]
Whether has more next view
Returns:
Boolean:getViewHistory() [source]
Get map view history
Returns:
Array.<Object>:addControl(control) [source]
Add a control on the map.
Parameter | Type | Description |
---|---|---|
control
|
control.Control | contorl to add |
Returns:
Map: thisremoveControl(control) [source]
Remove a control from the map.
Parameter | Type | Description |
---|---|---|
control
|
control.Control | control to remove |
Returns:
Map: this(mixin) on(eventsOn, handler, contextopt) [source]
Register a handler function to be called whenever this event is fired.
foo.on('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventsOn
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | handler function to be called | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
Any: this(mixin) addEventListener(eventTypes, handler, contextopt) [source]
Alias for on
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | handler function to be called | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(mixin) once(eventTypes, handler, contextopt) [source]
Same as on, except the listener will only get fired once and then removed.
foo.once('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(mixin) off(eventsOff, handler, contextopt) [source]
Unregister the event handler for the specified event types.
foo.off('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventsOff
|
String | event types to unregister, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(mixin) removeEventListener(eventTypes, handler, contextopt) [source]
Alias for off
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to unregister, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(mixin) listens(eventType, hanlderopt, contextopt) [source]
Returns listener's count registered for the event type.
Parameter | Type | Default | Description |
---|---|---|---|
eventType
|
String | an event type | |
hanlder
opt
|
function | null | listener function |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
Number:(mixin) copyEventListeners(target) [source]
Copy all the event listener to the target object
Parameter | Type | Description |
---|---|---|
target
|
Object | target object to copy to. |
Mixes From:
Returns:
: this(mixin) fire(eventType, param) [source]
Fire an event, causing all handlers for that event name to run.
Parameter | Type | Description |
---|---|---|
eventType
|
String | an event type to fire |
param
|
Object | parameters for the listener function. |
Mixes From:
Returns:
: this(mixin) setMenu(options) [source]
Set a context menu
foo.setMenu({
'width' : 160,
'custom' : false,
'items' : [
//return false to prevent event propagation
{'item': 'Query', 'click': function() {alert('Query Clicked!'); return false;}},
'-',
{'item': 'Edit', 'click': function() {alert('Edit Clicked!')}},
{'item': 'About', 'click': function() {alert('About Clicked!')}}
]
});
Parameter | Type | Description |
---|---|---|
options
|
Object | menu options |
Mixes From:
Returns:
*: this(mixin) openMenu(coordinateopt) [source]
Open the context menu, default on the center of the geometry or map.
Parameter | Type | Default | Description |
---|---|---|---|
coordinate
opt
|
Coordinate | null | coordinate to open the context menu |
Mixes From:
Returns:
*: this(mixin) setMenuItems(items) [source]
Set menu items to the context menu
Parameter | Type | Description |
---|---|---|
items
|
Array.<Object> | menu items |
Mixes From:
Returns:
*: this(mixin) getMenuItems() [source]
Get the context menu items
Mixes From:
Returns:
Array.<Object>:(mixin) closeMenu() [source]
Close the contexnt menu
Mixes From:
Returns:
*: this(mixin) removeMenu() [source]
Remove the context menu
Mixes From:
Returns:
*: this(mixin) registerRenderer(name, clazz) [source]
Register a renderer class with the given name.
Parameter | Type | Description |
---|---|---|
name
|
String | renderer's register key |
clazz
|
function | renderer's class, a function (not necessarily a Class). |
Mixes From:
Returns:
*: this(mixin) getRendererClass(name) [source]
Get the registered renderer class by the given name
Parameter | Type | Description |
---|---|---|
name
|
String | renderer's register key |
Mixes From:
Returns:
function: renderer's class(inherited) callInitHooks() [source]
Visit and call all the init hooks defined on Class and its parents.
Inherited From:
Returns:
Class: this(inherited) setOptions(options) [source]
Merges options with the default options of the object.
Parameter | Type | Description |
---|---|---|
options
|
Object | options to set |
Inherited From:
Returns:
Class: this(inherited) config(conf) [source]
1. Return object's options if no parameter is provided.
2. update an option and enable/disable the handler if a handler with the same name existed.
2. update an option and enable/disable the handler if a handler with the same name existed.
// Get marker's options;
var options = marker.config();
// Set map's option "draggable" to false and disable map's draggable handler.
map.config('draggable', false);
// You can update more than one options like this:
map.config({
'scrollWheelZoom' : false,
'doubleClickZoom' : false
});
Parameter | Type | Description |
---|---|---|
conf
|
Object | config to update |
Inherited From:
Returns:
Class: thisEvents
spatialreferencechange [source]
spatialreferencechange event, fired when map's spatial reference is updated.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | spatialreferencechange |
target
|
Map | map |
old
|
Map | the old spatial reference |
new
|
Map | the new spatial reference changed to |
- Source:
baselayerchangestart [source]
baselayerchangestart event, fired when base layer is changed.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | baselayerchangestart |
target
|
Map | map |
- Source:
baselayerchangeend [source]
baselayerchangeend event, fired when base layer is changed.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | baselayerchangeend |
target
|
Map | map |
- Source:
setbaselayer [source]
setbaselayer event, fired when base layer is set.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | setbaselayer |
target
|
Map | map |
- Source:
baselayerload [source]
baselayerload event, fired when base layer is loaded.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | baselayerload |
target
|
Map | map |
- Source:
baselayerremove [source]
baselayerremove event, fired when base layer is removed.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | baselayerremove |
target
|
Map | map |
- Source:
addlayer [source]
addlayer event, fired when adding layers.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | addlayer |
target
|
Map | map |
layers
|
Array.<Layer> | layers to add |
- Source:
removelayer [source]
removelayer event, fired when removing layers.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | removelayer |
target
|
Map | map |
layers
|
Array.<Layer> | layers to remove |
- Source:
resize [source]
resize event when map container's size changes
Properties:
Name | Type | Description |
---|---|---|
type
|
String | resize |
target
|
Map | map fires the event |
- Source:
movestart [source]
movestart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | movestart |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
moving [source]
moving event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | moving |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
moveend [source]
moveend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | moveend |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
dragrotatestart [source]
dragrotatestart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | dragrotatestart |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
dragrotating [source]
dragrotating event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | dragrotating |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
dragrotateend [source]
dragrotateend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | dragrotateend |
target
|
Map | map fires the event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
animating [source]
fired when map is animating. (panning, zooming, rotating)
Properties:
Name | Type | Description |
---|---|---|
type
|
String | animating |
target
|
Map | the map fires the event |
- Source:
animateinterrupted [source]
fired when map's animation is interrupted by mouse event or else.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | animateinterrupted |
target
|
Map | the map fires the event |
- Source:
animateend [source]
fired when map's animation ended (panning, zooming, rotating).
Properties:
Name | Type | Description |
---|---|---|
type
|
String | animateend |
target
|
Map | the map fires the event |
- Source:
animatestart [source]
fired when map starts to animate (panning, zooming, rotating).
Properties:
Name | Type | Description |
---|---|---|
type
|
String | animatestart |
target
|
Map | the map fires the event |
- Source:
pitch [source]
pitch event, alias of pitchend, deprecated
Properties:
Name | Type | Description |
---|---|---|
type
|
String | pitch |
target
|
Map | the map fires event |
from
|
Number | pitch from |
to
|
Number | pitch to |
- Source:
pitchend [source]
pitchend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | pitchend |
target
|
Map | the map fires event |
from
|
Number | pitchend from |
to
|
Number | pitchend to |
- Source:
mousedown [source]
mousedown event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mousedown |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mouseup [source]
mouseup event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mouseup |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mouseover [source]
mouseover event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mouseover |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mouseout [source]
mouseout event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mouseout |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mouseenter [source]
mouseenter event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mouseenter |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mouseleave [source]
mouseleave event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mouseleave |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
mousemove [source]
mousemove event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mousemove |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
click [source]
click event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | click |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
dblclick [source]
dblclick event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | dblclick |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
contextmenu [source]
contextmenu event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | contextmenu |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
keypress [source]
keypress event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | keypress |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
touchstart [source]
touchstart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchstart |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
touchmove [source]
touchmove event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchmove |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
touchend [source]
touchend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchend |
target
|
Map | the map fires event |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Source:
fullscreenstart [source]
fullscreenstart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | fullscreenstart |
target
|
Map | the map fires event |
- Source:
fullscreenend [source]
fullscreenend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | fullscreenend |
target
|
Map | the map fires event |
- Source:
cancelfullscreen [source]
cancelfullscreen event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | cancelfullscreen |
target
|
Map | the map fires event |
- Source:
viewchange [source]
viewchange event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | viewchange |
target
|
Map | map fires the event |
old
|
Object | old view |
new
|
Point | new view |
- Source:
zoomstart [source]
zoomstart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | zoomstart |
target
|
Map | the map fires event |
from
|
Number | zoom level zooming from |
to
|
Number | zoom level zooming to |
- Source:
zooming [source]
zooming event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | zooming |
target
|
Map | the map fires event |
from
|
Number | zoom level zooming from |
to
|
Number | zoom level zooming to |
- Source:
zoomend [source]
zoomend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | zoomend |
target
|
Map | the map fires event |
from
|
Number | zoom level zooming from |
to
|
Number | zoom level zooming to |
- Source:
touchactstart [source]
touchactstart event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchactstart |
target
|
Map | the map fires event |
- Source:
touchacting [source]
touchacting event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchacting |
target
|
Map | the map fires event |
- Source:
touchactend [source]
touchactend event
Properties:
Name | Type | Description |
---|---|---|
type
|
String | touchactend |
target
|
Map | the map fires event |
- Source: