目录

Map Attribute

You can call methods in HWMap to customize map attributes, such as the map center, zoom level, and heading. The following sample code changes the map center:

<tr>
    <td>Latitude:</td>
    <td><input id="latInput" type="text" value="48.95"/></td>
</tr>
<tr>
    <td>Longitude:</td>
    <td><input id="lngInput" type="text" value="2.35"/></td>
</tr>

var lat = Number(document.getElementById("latInput").value);
var lng = Number(document.getElementById("lngInput").value);
map.setCenter({lat: lat, lng: lng});

The following table describes map attributes that can be customized. For details, please refer to HWMap Methods.

Attribute

Description

setCenter(latlng)

Sets the coordinates of the map center point.

setHeading(heading)

Sets the map heading, that is, the angle between the map and the north direction.

setOpacity(opacity)

Sets map transparency.

setTitle(title)

Sets the prompt information for the container where the map is located.

setZoom(zoom)

Sets the zoom level of a map.

zoomOut()

Zooms out on the map by one level.

zoomIn()

Zooms in on the map by one level.