HERE Venues provides a wealth of hyperlocal information about indoor spaces, including building geometry and points of interest, spanning across multiple floors. HERE has mapped thousands of buildings globally, including, shopping malls, airports, train stations, parking garages, corporate campuses, factories, warehouses and many other types of buildings. If you are a venue owner and are interested in leveraging HERE Venues with the Maps API for Javascript, contact us at venues.support@here.com.
The Venues module provides access to given venues including full JSON models with polygons/geometry, areas and POI information.
All these features can be accessed through the venues module (mapsjs-venues.js) in the Maps API for JavaScript for easy integration into a map application.
Setting up venues
To be able to use Venues in the Maps API, requires
Access to venue data In order the load venue data, the app credentials should have access to the requested venue data.
Including the venues module script in the <head> section of the HTML page:
To create the map, make sure to follow the Get Started guide.
Loading the venue data
Than use the platform object to get the instance of H.venues.Service to load Venue data and create a H.venues.Provider to enable control of the loaded venues on the map:
// Get instance of venues service using valid apikey for venuesconst venuesService = platform.getVenuesService({ apikey:'API KEY'});// Venues provider interacts with tile layer to visualize and control the venue mapconst venuesProvider =newH.venues.Provider();// Venues service provides a loadVenue method
venuesService.loadVenue(VENUE_ID).then((venue)=>{// add venue data to venues provider
venuesProvider.addVenue(venue);
venuesProvider.setActiveVenue(venue);// create a tile layer for the venues provider
map.addLayer(newH.map.layer.TileLayer(venuesProvider));// center map on venue
map.setCenter(venue.getCenter());
map.setZoom(15);});
Example map
Figure 1.
The example above shows a venue map loaded on the map.
Changing levels
The Provider facilitates control of the venue map. To get information about the current level or change the level:
// Get active venueconst venue = venuesProvider.getActiveVenue();// get current level index
venue.getActiveLevelIndex();// and change level
venue.setActiveLevelIndex(1);
Search
The H.venues.Venue object also provides a search functionality through the search method. It is performed on geometry data where names and address are taken into account. The search string is not case sensitive and also looks for close matches:
// Get active venueconst venue = venuesProvider.getActiveVenue();// Search for bathrooms
venue.search('Bathroom');
Venue UI
Default UI elements give control over Drawings and Levels using H.venues.ui.DrawingControl and H.venues.ui.LevelControl:
The venue data is encapsulated in a hierarchy of objects. These objects perform as other MapObjects and are represented by the following classes:
H.venues.Venue
H.venues.Drawing
H.venues.Level
H.venues.Geometry
The root is Venue, which contains one or more Drawings, which contains one or more Levels. And the Level object holds the relevant collection Geometry objects.
The row data associated with each of the objects is accessible through the getData() method.