Sotoy
Sotoy

Reputation: 13

Here Maps api: how to get current center showing on the map (JavaScript)

Is there a way to retrieve the coordinates of the center showing on the map?

The user can navigate freely on the map, so the center constantly changes.

How can I retrieve the current center?

Upvotes: 1

Views: 1376

Answers (2)

hoogw
hoogw

Reputation: 5525

      center_latLng = map.getCenter();

      center_lat = center_latLng.lat;

      center_long = center_latLng.lng;

      center_zoom = map.getZoom();

api doc is at

https://developer.here.com/documentation/maps/3.1.37.0/api_reference/H.Map.html#getZoom

Upvotes: 0

DevBab
DevBab

Reputation: 879

In JS, map.getCenter() . Check javascript developer’s guide at developer.here.com

Upvotes: 2

Related Questions