A method to create a map object.
Parameter |
Value |
---|---|
id: string |
Identity of object. |
config (optional): |
Configuration. |
eventItem: boolean (default=false) |
Enable event items. |
overLayer (optional): |
Overlayer. |
name: string |
Name of overlayer. |
function: name |
An asynchronous JavaScript function that implements the logic when the function call returns. Needs to return { url: "<image>", opacity: <number> } for the overlay. |
scope: name (optional) |
Owner of the current object. |
panButton: boolean (default=false) |
Show the pan button on the map. |
zoomButton: boolean (default=false) |
Show the zoom button on the map. |
hideScaleText: boolean (default=false) |
Hide the map scale on the map. |
disableZoom: boolean (default=false) |
Disable zoom with mouse. |
disablePan: boolean (default=false) |
Disable pan with mouse. |
disableZoomWheel: boolean (default=false) |
Disable zoom with mouse wheel. |
defaultZoom: integer (default=0) |
Default zoom level (0 = highest, 10 = lowest). |
defaultCenterPoint: a point set (default={x: 500000, y: 500000}) |
Default map center location (isn93 map point locations). |
showMyLocation: boolean (default=false) (optional): |
Track your GPS location on the map. |
Return |
Value |
---|---|
object: |
A map object. |
Example:
var map = SWMap.create("map",
{
panButton: true,
zoomButton: true,
defaultZoom: 6,
defaultCenterPoint: { x: 358762, y: 407377 }
});
Or
var point = SWPoint.create(358762, 407377);
var map = SWMap.create("map",
{
panButton: true,
zoomButton: true,
defaultZoom: 6,
defaultCenterPoint: point,
showMyLocation: true
});