Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Documents from this version have been archived, and will not continue to be maintained. Please use the latest version.
Loads a map. This class is a core class.
Build Method | Description |
HWMapJsSDK.HWMap(div, mapOptions) | div indicates a map filling container and is mandatory. mapOptions specifies map attributes. For details, please refer to MapOptions. |
Method | Description | Parameter Type | Return Value |
fitBounds(bounds) | Sets the map display area. | Coordinate area of the LatLngBounds type. Example: {sw: {lng: 116.38, lat: 39.91}, ne: {lng: 126.56, lat: 41.27}} | None |
getBounds() | Obtains the map display area. | None | Map display area of the LatLngBounds type. |
getCenter() | Obtains the coordinates of the map center point. | None | Longitude and latitude coordinates of the map center point. The value is of the LatLng type. |
getDiv() | Obtains the container for loading a map. | None | Div container. |
getHeading() | Obtains the map heading. | None | Included angle between the map heading and the north. (The value is a number.) |
getMapType() | Obtains the map type. | None | Map type. (The value is a character string.) |
getOpacity() | Obtains the transparency of a map. | None | Transparency of a map. (The value is a number.) |
getSize() | Obtains the map size. | None | An array in [width, height] format. |
getZoom() | Obtains the zoom level of a map. | None | Zoom level of a map. (The value is a number.) |
panBy(x, y) | Offsets the map center point by (x, y). | The x and y parameters indicate the number of offset pixels of the map center point on the X and Y axes. | None |
panTo(latLng) | Moves the map center to a specified coordinate point. | Coordinate point of the LatLng type. | None |
panToBounds(latLngBounds) | Moves a map so that it contains a specified coordinate area. | Coordinate area of the LatLngBounds type. | None |
setCenter(latlng) | Sets the coordinates of the map center point. | Coordinate point of the LatLng type. | None |
setHeading(heading) | Sets the map heading. | Included angle between the map heading and the north. The value ranges from 0 to 360. | None |
setOpacity(opacity) | Sets the map transparency. | The value is a number ranging from 0 to 1. | |
setTitle(title) | Sets the prompt information for the container where the map is located. | The value is a character string. | None |
setZoom(zoom) | Sets the zoom level of a map. | The value is a number ranging from minZoom to maxZoom. | None |
zoomOut() | Zooms out the map by one level. | None | None |
zoomIn() | Zooms in the map by one level. | None | None |
on(event, callback) | Sets a customized function called when an event is triggered. | callback is a customized function. The options for event are as follows: click: Click on the left button of the mouse once or more. contextmenu: Click on the right button of the mouse. singleclick: Click on the left button of the mouse once. dblclick: Double-click on the left button of the mouse. movestart: Map moving start. moveend: Map moving stop. pointerdrag: Map dragging. pointermove: Moving of the mouse pointer. pointerdown: Mouse button press. pointerup: Mouse button release. | None |
Event | Description | Usage |
click | Click on the left button of the mouse once. | map.on('click', callback): The callback parameter indicates a customized callback function. |
singleclick | Click on the left button of the mouse once. | map.on('singleclick', callback): The callback parameter indicates a customized callback function. |
dblclick | Double-click on the left button of the mouse. | map.on('dblclick', callback): The callback parameter indicates a customized callback function. |
contextmenu | Click on the right button of the mouse. | map.on('contextmenu', callback): The callback parameter indicates a customized callback function. |
pointermove | Moving of the mouse pointer. | map.on('pointermove', callback): The callback parameter indicates a customized callback function. |
pointerdown | Mouse button press. | map.on('pointerdown', callback): The callback parameter indicates a customized callback function. |
pointerup | Mouse button release. | map.on('pointerup', callback): The callback parameter indicates a customized callback function. |
movestart | Map moving start. | map.on('movestart', callback): The callback parameter indicates a customized callback function. |
moveend | Map moving stop. | map.on('moveend', callback): The callback parameter indicates a customized callback function. |
pointerdrag | Map dragging. | map.on('pointerdrag', callback): The callback parameter indicates a customized callback function. |
onCenterChanged | Map center change. | map.onCenterChanged(callback): The callback parameter indicates a customized callback function. |
onHeadingChanged | Map heading change. | map.onHeadingChanged(callback): The callback parameter indicates a customized callback function. |
onZoomChanged | Map zoom level change. | map.onZoomChanged(callback): The callback parameter indicates a customized callback function. |
Parameter | Mandatory (M)/Optional (O) | Parameter Type | Description |
value | M | String | Currently, DOM elements of the text or HTML format are supported. The DOM elements support the <font>, <a>, and <image> tags. |
Parameter | Mandatory (M)/Optional (O) | Type | Description |
mapType | O | String | Map type. The default value is the standard map type (ROADMAP). |
center | M | Map center point, for example, {lng: 116.38, lat: 39.91}. | |
minZoom | O | Number | Minimum zoom level of a map. The value ranges from 2 to 20. The default value is 2. |
maxZoom | O | Number | Maximum zoom level of a map. The value ranges from 2 to 20. The default value is 20. |
zoom | M | Number | Zoom level during map initialization. |
language | O | String | Map language. For details, please refer to LanguageCode. |
political | O | String | Political tendency. The value is a two-digit country or region code complying with ISO 3166-1 alpha-2. |
scaleControl | O | Boolean | Indicates whether to display the scale on a map. The default value is false. |
scaleControlOptions | O | Scale attribute. | |
zoomSlider | O | Boolean | Indicates whether to display the zoom slider on a map. The default value is false. |
Code | Language |
AFR | Afrikaans |
AMH | Amharic |
ARA | Arabic |
ASM | Assamese |
AYM | Aymara |
AZE | Azerbaijani |
BAQ | Basque |
BEL | Belarusian |
BEN | Bengali |
BIS | Bislama |
BOS | Bosnian |
BRE | Breton |
BUL | Bulgarian |
BUR | Burmese |
CAT | Catalan; Valencian |
CZE | Czech |
CHI | Chinese |
WEL | Welsh |
DAN | Danish |
GER | German |
DIV | Divehi; Dhivehi; Maldivian |
DZO | Dzongkha |
GRE | Greek, Modern (1453-) |
ENG | English |
EST | Estonian |
FAO | Faroese |
PER | Persian |
FIJ | Fijian |
FIN | Finnish |
FRE | French |
FRY | Western Frisian |
GLA | Gaelic; Scottish Gaelic |
GLE | Irish |
GLG | Galician |
GRN | Guarani |
GUJ | Gujarati |
HAT | Haitian; Haitian Creole |
HAU | Hausa |
HEB | Hebrew |
HIN | Hindi |
HMO | Hiri Motu |
SCR | Croatian |
HUN | Hungarian |
ARM | Armenia |
IBO | Igbo |
IKU | Inuktitut |
IND | Indonesian |
ICE | Icelandic |
ITA | Italian |
JPN | Japanese |
KAL | Kalaallisut; Greenlandic |
KAN | Kannada |
KAS | Kashmiri |
GEO | Georgian |
KAZ | Kazakh |
KHM | Central Khmer |
KIN | Kinyarwanda |
KIR | Kirghiz; Kyrgyz |
KOR | Korean |
KUR | Kurdish |
LAO | Laotian |
LAT | Latin |
LAV | Latvian |
LIT | Lithuanian |
LTZ | Luxembourgish; Letzeburgesch |
MAH | Marshallese |
MAL | Malayalam |
MAR | Marathi |
MAC | Macedonian |
MLG | Malagasy |
MLT | Maltese |
MON | Mongolian |
MAO | Maori |
MAY | Malay |
NAU | Nauru |
NDE | Ndebele, North; North Ndebele |
NEP | Nepali |
DUT | Dutch; Flemish |
NOR | Norwegian |
NYA | Chichewa; Chewa; Nyanja |
OCI | Occitan (post 1500) |
ORI | Oriya |
ORM | Oromo |
PAN | Panjabi; Punjabi |
POL | Polish |
POR | Portuguese |
PUS | Pushto; Pashto |
QUE | Quechua |
ROH | Romansh |
RUM | Romanian; Moldavian; Moldovan |
MOL | Romanian; Moldavian; Moldovan |
RUN | Rundi |
RUS | Russian |
SAG | Sango |
SAN | Sanskrit |
SIN | Sinhala; Sinhalese |
SLO | Slovak |
SLV | Slovenian |
SMO | Samoan |
SNA | Shona |
SND | Sindhi |
SOM | Somali |
SOT | Sotho, Southern |
SPA | Spanish; Castilian |
ALB | Albanian |
SRD | Sardinian |
SCY | Serbian |
SSW | Swazi |
SWA | Swahili |
SWE | Swedish |
TAH | Tahitian |
TAM | Tamil |
TAT | Tatar |
TEL | Telugu |
TGK | Tajik |
THA | Thai |
TIR | Tigrinya |
TON | Tonga (Tonga Islands) |
TSN | Tswana |
TUK | Turkmen |
TUR | Turkish |
UIG | Uighur; Uyghur |
UKR | Ukrainian |
URD | Urdu |
UZB | Uzbek |
VIE | Vietnamese |
WOL | Wolof |
XHO | Xhosa |
YOR | Yoruba |
ZUL | Zulu |
Parameter | Mandatory (M)/Optional (O) | Type | Description |
units | O | String | Scale unit. Four options are available: imperial, nautical, and metric. The default value is metric. |
minWidth | O | Number | Minimum width of the control, in pixels. The default value is 64. |