HEREMAP
A framework to simplify the use of HERE Maps, which a bunch of higher level functions. In addition, it brings geocoding and routing functions to Node.js
See examples in the demo directory, starting with demo/demo-basic.html.
Get your credentials at http://developer.here.com
Installation
1/ For use in Node.js, install the package:
npm install --save-dep heremap
To use in a js file
const hm = require("heremap");
hm.config({
app_id: YOUR APP_ID,
app_code: YOUR APP_CODE,
});
let res = await hm.geocode("avenue des champs elysees, paris);
console.log(res.coord);
2/ For use in browser, add these lines in your html file
<link rel="stylesheet" type="text/css" href="http://www.unpkg.com/heremap@2.2.6/css/heremap.css" />
<script src="http://www.unpkg.com/heremap@2.2.6/dist/libhere.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://www.unpkg.com/heremap@2.2.6/dist/heremap.min.js" type="text/javascript" charset="utf-8"></script>
<div id="map"></div>
Then in your JS script:
const hm = window.heremap;
hm.config({
app_id: YOUR APP_ID,
app_code: YOUR APP_CODE,
});
hm.map("map", {
zoom:5,
center: [48.8,2.3],
click: function(coord,button,key) {console.log("clicked on",coord,"with button",button);}
});
Demo
See under directory demo:
- demo-basic.html: how to display a simple map in a web pgae
- demo-cluster.html: how to cluster thousands of points on a map
- demo-markers.html: different kind of svg or png markers, with different size, anchor..
- demo-screenshot.html: how to do a screenshot of the map
- demo-asia.html: how to display high quality ap in Japan and Korea. (requires special credentials)
- demo-autocomplete.html: autocomplete exemple
- demo-touch.html: draw a polyline on a touch screen
- demo-nearcity.html: find big cities around the mouse click
- demo-locateme.html: display own location
Functions
- hm:PDEManager(opt)
Manage PDE requests
- hm:PDEManager(opt)
Manage PDE requests
- hm:bb2Poly(bb) ⇒
array
convert a bounding box into a list of five [lat,lng], last is same as first
- hm:bb2Poly(bb) ⇒
array
convert a bounding box into a list of five [lat,lng], last is same as first
- hm:bubbleUnique(coord, txt)
Display a unique bubble. Associated CSS style is .H_ib_body
- hm:bubbleUnique(coord, txt)
Display a unique bubble. Associated CSS style is .H_ib_body
- hm:bubbleUniqueHide()
hide a unique bubble
- hm:bubbleUniqueHide()
hide a unique bubble
- hm:buildIcon(opt) ⇒
promise
create an icon, to be used for a marker
- hm:buildIcon(opt) ⇒
promise
create an icon, to be used for a marker
- hm:circle(opt)
draw a circle
- hm:circle(opt)
draw a circle
- hm:cluster(coords, opt, cb) ⇒
H.map.layer.ObjectLayer
Creates a cluster of points
- hm:clusterHide()
Hide cluster layer
- hm:clusterShow()
Show cluster layer
- hm:config(opt)
To configure app_id, app_code and optionally use CIT and http
- hm:config(opt)
To configure app_id, app_code and optionally use CIT and http
- hm:coord2Point(coord) ⇒
object
Convert [lat,lng] to {lat,lng}
- hm:coord2Point(coord) ⇒
object
Convert [lat,lng] to {lat,lng}
- hm:coordA2O(arr) ⇒
array
Convert an array [lat,lng] to {lat,lng}
- hm:coordA2O(arr) ⇒
array
Convert an array [lat,lng] to {lat,lng}
- hm:coordO2A(obj) ⇒
array
Convert an object {lat,lng} to [lat,lng]
- hm:coordO2A(obj) ⇒
array
Convert an object {lat,lng} to [lat,lng]
- hm:coords2XY(coords) ⇒
array
Convert array of [lat,lng] to array of {x,y}
- hm:coords2XY(coords) ⇒
array
Convert array of [lat,lng] to array of {x,y}
- hm:coords2bb(coords) ⇒
Object
compute the bounding box of an array of corrds
- hm:coords2bb(coords) ⇒
Object
compute the bounding box of an array of corrds
- hm:coordsPDE2Array(lats, lng) ⇒
array
Convert coords of format PDE: lat or lng initial/100000, delta / 100000
- hm:coordsPDE2Array(lats, lng) ⇒
array
Convert coords of format PDE: lat or lng initial/100000, delta / 100000
- hm:countTiles(bbox, level) ⇒
int
count the number of tiles for a given bounding box and zoom level
- hm:countTiles(bbox, level) ⇒
int
count the number of tiles for a given bounding box and zoom level
- hm:detour(start, stop, waypoints) ⇒
Promise
Compute the detour for each waypoint provided, compared to normal route from A to B
- hm:detour(start, stop, waypoints) ⇒
Promise
Compute the detour for each waypoint provided, compared to normal route from A to B
- hm:geocode(address, opt) ⇒
Promise
geocode an address
- hm:geocode(address, opt) ⇒
Promise
geocode an address
- hm:geocoderAutocomplete(opt) ⇒
Promise
reverse geocode a coordinate. Can centered on a location or within a bounding box
- hm:geocoderAutocomplete(opt) ⇒
Promise
reverse geocode a coordinate. Can centered on a location or within a bounding box
- hm:getAvailableMapStyle() ⇒
json
list of all available map styles normal.day, night....
- hm:getAvailableMapStyle() ⇒
json
list of all available map styles normal.day, night....
- hm:getCenter() ⇒
coord
return coordinate of the center of the map
- hm:getCenter() ⇒
coord
return coordinate of the center of the map
- hm:getDefaultLayers() ⇒
object
return default layers, created by _platform.createDefaultLayers();
- hm:getDefaultLayers() ⇒
object
return default layers, created by _platform.createDefaultLayers();
- hm:getPlatform() ⇒
object
return platorm;
- hm:getPlatform() ⇒
object
return platorm;
- hm:getThrottleLimits() ⇒
string
get Throttle limts for various modules
- hm:getThrottleLimits() ⇒
string
get Throttle limts for various modules
- hm:getViewBB() ⇒
Object
return bounding box of visible part of map
- hm:getViewBB() ⇒
Object
return bounding box of visible part of map
- hm:getZoom() ⇒
number
return zoom value
- hm:getZoom() ⇒
number
return zoom value
- hm:htmlBounding() ⇒
object
provide bounding box of element hosting map, relative to window
- hm:htmlBounding() ⇒
object
provide bounding box of element hosting map, relative to window
- hm:isoline(opt) ⇒
Promise
compute an isoline. See more info on optional parameters
- hm:isoline(opt) ⇒
Promise
compute an isoline. See more info on optional parameters
- hm:layerCreate(name, visible)
create a layer
- hm:layerCreate(name, visible)
create a layer
- hm:layerDelete(name)
delete a layer
- hm:layerDelete(name)
delete a layer
- hm:layerEmpty(layer)
Empty a layer, or create it if not existing
- hm:layerEmpty(layer)
Empty a layer, or create it if not existing
- hm:layerFind(name)
find layer by its name or return null
- hm:layerFind(name)
find layer by its name or return null
- hm:layerSetVisibility(name, visible)
create a layer
- hm:layerSetVisibility(name, visible)
create a layer
- hm:linkid(linkid) ⇒
Promise
get linkid Information, based on routing
- hm:linkid(linkid) ⇒
Promise
get linkid Information, based on routing
- hm:locateMe(callback, opt)
watch position on HTML5 position. This requires HTTPS. Creates layer "_gps". To deactivate, call with null callback
- hm:locateMe(callback, opt)
watch position on HTML5 position. This requires HTTPS. Creates layer "_gps". To deactivate, call with null callback
- hm:map(htmlItem, opt)
create a map area within the specified item
- hm:map(htmlItem, opt)
create a map area within the specified item
- hm:marker(opt) ⇒
H.map.Marker
add a marker in a layer. SVG files can be created with https://editor.method.ac/
- hm:marker(opt) ⇒
H.map.Marker
add a marker in a layer. SVG files can be created with https://editor.method.ac/
- hm:matrix(source, dest, opt) ⇒
Promise
compute a matrix. See more info on optional parameters
Matrix size is limited to 1x100, 100x1 or 15xN
- hm:matrix(source, dest, opt) ⇒
Promise
compute a matrix. See more info on optional parameters
Matrix size is limited to 1x100, 100x1 or 15xN
- hm:placeAutoSuggest(opt) ⇒
Promise
Autocomplete of Places (POI). Can be centered on a locaiton or within a bounding box
- hm:placeAutoSuggest(opt) ⇒
Promise
Autocomplete of Places (POI). Can be centered on a locaiton or within a bounding box
- hm:placeExplore(opt, categories) ⇒
array
Discover places (POI) around a coordnate belonging to a list of categories
- hm:placeExplore(opt, categories) ⇒
array
Discover places (POI) around a coordnate belonging to a list of categories
- hm:placeGetCategory(center) ⇒
promise
Get Categories of Places (POI)
- hm:placeGetCategory(center) ⇒
promise
Get Categories of Places (POI)
- hm:placeSearch(opt, categories) ⇒
promise
Search for a Place (POI) around a coordinate matching a name
- hm:placeSearch(opt, categories) ⇒
promise
Search for a Place (POI) around a coordinate matching a name
- hm:point2Coord({lat,lng}) ⇒
array
Convert {lat,lng} to [lat,lng]
- hm:point2Coord({lat,lng}) ⇒
array
Convert {lat,lng} to [lat,lng]
- hm:polygon(opt)
Draw a polygon
- hm:polygon(opt)
Draw a polygon
- hm:polyline(opt)
Draw a polyline.
- hm:polyline(opt)
Draw a polyline.
- hm:reverseGeocode(coord) ⇒
Promise
reverse geocode a coordinate
- hm:reverseGeocode(coord) ⇒
Promise
reverse geocode a coordinate
- hm:route(source, dest, opt) ⇒
Promise
compute a route with optional waypooints. See more info on optional parameters
- hm:route(source, dest, opt) ⇒
Promise
compute a route with optional waypooints. See more info on optional parameters
- hm:screenshot(opt, opt) ⇒
data
perform a screenshot of the map and returns a promise with the data
- hm:screenshot(opt, opt) ⇒
data
perform a screenshot of the map and returns a promise with the data
- hm:setCenter(coord)
set center of the map
- hm:setCenter(coord)
set center of the map
- hm:setScheme(scheme)
define the scheme. List of scheme can be obtained from hm.getAvailableMapStyle()
- hm:setScheme(scheme)
define the scheme. List of scheme can be obtained from hm.getAvailableMapStyle()
- hm:setViewBB(opt)
sets bouding box to be displayed
- hm:setViewBB(opt)
sets bouding box to be displayed
- hm:setZoom(zoom)
set zoom level
- hm:setZoom(zoom)
set zoom level
- hm:simplify(coords, tolerance) ⇒
array
Simplify a polyline by using the Ramer-Douglas-Peucker algorithm
- hm:simplify(coords, tolerance) ⇒
array
Simplify a polyline by using the Ramer-Douglas-Peucker algorithm
- hm:tile2BB(tileX, tileY, level) ⇒
Object
compute the bounding box of a Tile
- hm:tile2BB(tileX, tileY, level) ⇒
Object
compute the bounding box of a Tile
- hm:touch(onoff, options)
activate touch, allowing hand drawing, with embedded simplification of the line
- hm:touch(onoff, options)
activate touch, allowing hand drawing, with embedded simplification of the line
- hm:xy2Coords(coords) ⇒
array
Convert array of {x,y} to array of [lat,lng]
- hm:xy2Coords(coords) ⇒
array
Convert array of {x,y} to array of [lat,lng]
- lineIntersects(A, B, C, D)
- marker:getCoord() ⇒
coord
get coordinates of a marker
- marker:getCoord() ⇒
coord
get coordinates of a marker
- stringify()
Stringifies a GeoJSON object into WKT
hm:PDEManager(opt)
Manage PDE requests
Kind: global function
Params
- opt
Object
- optional object {rps,concurrent}- [.rps]
int
- requests per second. Default = 10 - [.concurrent]
int
- max concurrent requests. Default = 5
- [.rps]
Example
const hm = windowheremap;const pde = rps:10; const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; let bb = hm; pde; pde; pde;
- hm:PDEManager(opt)
- .getQueue() ⇒
object
- .getQueue() ⇒
object
- .getTilesInfo() ⇒
array
- .getTilesInfo() ⇒
array
- .run() ⇒
Promise
- .run() ⇒
Promise
- .setBoundingBox(bb)
- .setBoundingBox(bb)
- .setBoundingCoords(coords, add)
- .setBoundingCoords(coords, add)
- .setBoundingPolys(polygons, add)
- .setBoundingPolys(polygons, add)
- .setLayers(layers)
- .setLayers(layers)
- .setQueue(queue)
- .setQueue(queue)
- .getQueue() ⇒
object
hm:PDEManager.getQueue() ⇒ returns the current queue to be processed
Kind: static method of hm:PDEManager
Returns: object
- - {key:callback,key:callback,....} where key = "x/y/z/layername"
object
hm:PDEManager.getQueue() ⇒ returns the current queue to be processed
Kind: static method of hm:PDEManager
Returns: object
- - {key:callback,key:callback,....} where key = "x/y/z/layername"
array
hm:PDEManager.getTilesInfo() ⇒ provides array of rectangle showing various info for each tile downloaded
Kind: static method of hm:PDEManager
Returns: array
- of {bb,tileX,tileY,level} for each tiles downloaded
array
hm:PDEManager.getTilesInfo() ⇒ provides array of rectangle showing various info for each tile downloaded
Kind: static method of hm:PDEManager
Returns: array
- of {bb,tileX,tileY,level} for each tiles downloaded
Promise
hm:PDEManager.run() ⇒ run the queries in the queue, with throttle in place
Kind: static method of hm:PDEManager
Returns: Promise
- - returns promise with count of tiles as parameter
Promise
hm:PDEManager.run() ⇒ run the queries in the queue, with throttle in place
Kind: static method of hm:PDEManager
Returns: Promise
- - returns promise with count of tiles as parameter
hm:PDEManager.setBoundingBox(bb)
sets a bounding box to retrieve all the tiles in it
Kind: static method of hm:PDEManager
Params
- bb
Object
- bounding box {latm,latM,lngm,lngM}
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingBox(bb)
sets a bounding box to retrieve all the tiles in it
Kind: static method of hm:PDEManager
Params
- bb
Object
- bounding box {latm,latM,lngm,lngM}
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingCoords(coords, add)
retrieve all tiles needed for a list of coords
Kind: static method of hm:PDEManager
Params
- coords
array
- array of [lat,lng] - add
boolean
- false by default. set to true to add to existing queue
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingCoords(coords, add)
retrieve all tiles needed for a list of coords
Kind: static method of hm:PDEManager
Params
- coords
array
- array of [lat,lng] - add
boolean
- false by default. set to true to add to existing queue
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingPolys(polygons, add)
sets a list of polygons to contain the tiles. A Til is IN if one of the corner is in one of the polygons
Kind: static method of hm:PDEManager
Params
- polygons
array
- array of [[lat,lng],[lat,lng]..] - add
boolean
- false by default. set to true to add to existing queue
const poly= 4332843352344337238 4880448810456488204334883045;pde;
hm:PDEManager.setBoundingPolys(polygons, add)
sets a list of polygons to contain the tiles. A Til is IN if one of the corner is in one of the polygons
Kind: static method of hm:PDEManager
Params
- polygons
array
- array of [[lat,lng],[lat,lng]..] - add
boolean
- false by default. set to true to add to existing queue
const poly= 4332843352344337238 4880448810456488204334883045;pde;
hm:PDEManager.setLayers(layers)
define the layers to be fetched
Kind: static method of hm:PDEManager
Params
- layers
object
- {layerName:{level,callback,fcLayers},.....}- [.layerName]
string
- name of layer - [.callback]
function
- function to be called for each PDE request. parameters for call: (content,x,y,z,layerName) - [.level]
integer
- level for tile associated to specific layer. if not specified, layer.fcLayers is used - [.fcLayers]
array
- array of FC level, from 1 to 5
- [.layerName]
const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; pde;
hm:PDEManager.setLayers(layers)
define the layers to be fetched
Kind: static method of hm:PDEManager
Params
- layers
object
- {layerName:{level,callback,fcLayers},.....}- [.layerName]
string
- name of layer - [.callback]
function
- function to be called for each PDE request. parameters for call: (content,x,y,z,layerName) - [.level]
integer
- level for tile associated to specific layer. if not specified, layer.fcLayers is used - [.fcLayers]
array
- array of FC level, from 1 to 5
- [.layerName]
const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; pde;
hm:PDEManager.setQueue(queue)
set the queue to run, form a list of tiles
Kind: static method of hm:PDEManager
Params
- queue
object
- {key:callback,key:callback,....} where key = "x/y/z/layername"
hm:PDEManager.setQueue(queue)
set the queue to run, form a list of tiles
Kind: static method of hm:PDEManager
Params
- queue
object
- {key:callback,key:callback,....} where key = "x/y/z/layername"
hm:PDEManager(opt)
Manage PDE requests
Kind: global function
Params
- opt
Object
- optional object {rps,concurrent}- [.rps]
int
- requests per second. Default = 10 - [.concurrent]
int
- max concurrent requests. Default = 5
- [.rps]
Example
const hm = windowheremap;const pde = rps:10; const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; let bb = hm; pde; pde; pde;
- hm:PDEManager(opt)
- .getQueue() ⇒
object
- .getQueue() ⇒
object
- .getTilesInfo() ⇒
array
- .getTilesInfo() ⇒
array
- .run() ⇒
Promise
- .run() ⇒
Promise
- .setBoundingBox(bb)
- .setBoundingBox(bb)
- .setBoundingCoords(coords, add)
- .setBoundingCoords(coords, add)
- .setBoundingPolys(polygons, add)
- .setBoundingPolys(polygons, add)
- .setLayers(layers)
- .setLayers(layers)
- .setQueue(queue)
- .setQueue(queue)
- .getQueue() ⇒
object
hm:PDEManager.getQueue() ⇒ returns the current queue to be processed
Kind: static method of hm:PDEManager
Returns: object
- - {key:callback,key:callback,....} where key = "x/y/z/layername"
object
hm:PDEManager.getQueue() ⇒ returns the current queue to be processed
Kind: static method of hm:PDEManager
Returns: object
- - {key:callback,key:callback,....} where key = "x/y/z/layername"
array
hm:PDEManager.getTilesInfo() ⇒ provides array of rectangle showing various info for each tile downloaded
Kind: static method of hm:PDEManager
Returns: array
- of {bb,tileX,tileY,level} for each tiles downloaded
array
hm:PDEManager.getTilesInfo() ⇒ provides array of rectangle showing various info for each tile downloaded
Kind: static method of hm:PDEManager
Returns: array
- of {bb,tileX,tileY,level} for each tiles downloaded
Promise
hm:PDEManager.run() ⇒ run the queries in the queue, with throttle in place
Kind: static method of hm:PDEManager
Returns: Promise
- - returns promise with count of tiles as parameter
Promise
hm:PDEManager.run() ⇒ run the queries in the queue, with throttle in place
Kind: static method of hm:PDEManager
Returns: Promise
- - returns promise with count of tiles as parameter
hm:PDEManager.setBoundingBox(bb)
sets a bounding box to retrieve all the tiles in it
Kind: static method of hm:PDEManager
Params
- bb
Object
- bounding box {latm,latM,lngm,lngM}
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingBox(bb)
sets a bounding box to retrieve all the tiles in it
Kind: static method of hm:PDEManager
Params
- bb
Object
- bounding box {latm,latM,lngm,lngM}
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingCoords(coords, add)
retrieve all tiles needed for a list of coords
Kind: static method of hm:PDEManager
Params
- coords
array
- array of [lat,lng] - add
boolean
- false by default. set to true to add to existing queue
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingCoords(coords, add)
retrieve all tiles needed for a list of coords
Kind: static method of hm:PDEManager
Params
- coords
array
- array of [lat,lng] - add
boolean
- false by default. set to true to add to existing queue
const bb= latm: 433494 latM: 438325 lngm: 22221 lngM: 25685;pde;
hm:PDEManager.setBoundingPolys(polygons, add)
sets a list of polygons to contain the tiles. A Til is IN if one of the corner is in one of the polygons
Kind: static method of hm:PDEManager
Params
- polygons
array
- array of [[lat,lng],[lat,lng]..] - add
boolean
- false by default. set to true to add to existing queue
const poly= 4332843352344337238 4880448810456488204334883045;pde;
hm:PDEManager.setBoundingPolys(polygons, add)
sets a list of polygons to contain the tiles. A Til is IN if one of the corner is in one of the polygons
Kind: static method of hm:PDEManager
Params
- polygons
array
- array of [[lat,lng],[lat,lng]..] - add
boolean
- false by default. set to true to add to existing queue
const poly= 4332843352344337238 4880448810456488204334883045;pde;
hm:PDEManager.setLayers(layers)
define the layers to be fetched
Kind: static method of hm:PDEManager
Params
- layers
object
- {layerName:{level,callback,fcLayers},.....}- [.layerName]
string
- name of layer - [.callback]
function
- function to be called for each PDE request. parameters for call: (content,x,y,z,layerName) - [.level]
integer
- level for tile associated to specific layer. if not specified, layer.fcLayers is used - [.fcLayers]
array
- array of FC level, from 1 to 5
- [.layerName]
const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; pde;
hm:PDEManager.setLayers(layers)
define the layers to be fetched
Kind: static method of hm:PDEManager
Params
- layers
object
- {layerName:{level,callback,fcLayers},.....}- [.layerName]
string
- name of layer - [.callback]
function
- function to be called for each PDE request. parameters for call: (content,x,y,z,layerName) - [.level]
integer
- level for tile associated to specific layer. if not specified, layer.fcLayers is used - [.fcLayers]
array
- array of FC level, from 1 to 5
- [.layerName]
const layers = ROAD_GEOM_FC: callback: pdeGotRoadGeomFC fcLayers: 12 POI_BIGGER: callback: pdeGotPOI level: 6 ; pde;
hm:PDEManager.setQueue(queue)
set the queue to run, form a list of tiles
Kind: static method of hm:PDEManager
Params
- queue
object
- {key:callback,key:callback,....} where key = "x/y/z/layername"
hm:PDEManager.setQueue(queue)
set the queue to run, form a list of tiles
Kind: static method of hm:PDEManager
Params
- queue
object
- {key:callback,key:callback,....} where key = "x/y/z/layername"
array
hm:bb2Poly(bb) ⇒ convert a bounding box into a list of five [lat,lng], last is same as first
Kind: global function
Returns: array
- - [[latm,lngm],[latM,lngm],[latM,lngM],[latm,lngM],[latm,lngm]]
Params
- bb
Object
- {latm,latM,lngm,lngM}
array
hm:bb2Poly(bb) ⇒ convert a bounding box into a list of five [lat,lng], last is same as first
Kind: global function
Returns: array
- - [[latm,lngm],[latM,lngm],[latM,lngM],[latm,lngM],[latm,lngm]]
Params
- bb
Object
- {latm,latM,lngm,lngM}
hm:bubbleUnique(coord, txt)
Display a unique bubble. Associated CSS style is .H_ib_body
Kind: global function
Params
- coord
Array
- of the bubble - txt
String
- html text to display
hm:bubbleUnique(coord, txt)
Display a unique bubble. Associated CSS style is .H_ib_body
Kind: global function
Params
- coord
Array
- of the bubble - txt
String
- html text to display
hm:bubbleUniqueHide()
hide a unique bubble
hm:bubbleUniqueHide()
hide a unique bubble
promise
hm:buildIcon(opt) ⇒ create an icon, to be used for a marker
Kind: global function
Returns: promise
- the promise of created icon of type H.map.Icon
Params
- opt
object
- options to specify the icon- [.img]
string
- use a png/jpg image. Specify the url - [.svg]
string
- url a svg. This can be an inline svg, a url, or a svg from heremap - [.opt]
object
- style object- [.size]
number
|string
- size of icon, as 24 or 24x32 - [.ratio]
number
- for svg files, ratio of size. 0.5 = half - [.anchor]
number
|string
- anchor of icon, as 24 or "24x32" or "center". By default, bottom-center - [.tag]
string
- for svg, any tag like {tag} within the svg file will be replaced by its associated value
- [.size]
- [.img]
Example
hm; hm; hm; const svg = `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"> <ellipse stroke="null" ry="8" rx="7.618896" id="svg_1" cy="8" cx="7.837427" fill="{color}" fill-opacity="0.9"/></svg>`;hm;
promise
hm:buildIcon(opt) ⇒ create an icon, to be used for a marker
Kind: global function
Returns: promise
- the promise of created icon of type H.map.Icon
Params
- opt
object
- options to specify the icon- [.img]
string
- use a png/jpg image. Specify the url - [.svg]
string
- url a svg. This can be an inline svg, a url, or a svg from heremap - [.opt]
object
- style object- [.size]
number
|string
- size of icon, as 24 or 24x32 - [.ratio]
number
- for svg files, ratio of size. 0.5 = half - [.anchor]
number
|string
- anchor of icon, as 24 or "24x32" or "center". By default, bottom-center - [.tag]
string
- for svg, any tag like {tag} within the svg file will be replaced by its associated value
- [.size]
- [.img]
Example
hm; hm; hm; const svg = `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"> <ellipse stroke="null" ry="8" rx="7.618896" id="svg_1" cy="8" cx="7.837427" fill="{color}" fill-opacity="0.9"/></svg>`;hm;
hm:circle(opt)
draw a circle
Kind: global function
Params
- opt
*
- option for circle- [.layer]
String
- optional layer to use - [.coord]
array
- center of the circle, as [48.8,2.3] - [.radius]
number
- radius in meter - [.style]
object
- optional graphic style- [.strokeColor]
string
- color of perimeter - [.lineWidth]
number
- line width - [.fillColor]
string
- fill color
- [.strokeColor]
- [.layer]
hm:circle(opt)
draw a circle
Kind: global function
Params
- opt
*
- option for circle- [.layer]
String
- optional layer to use - [.coord]
array
- center of the circle, as [48.8,2.3] - [.radius]
number
- radius in meter - [.style]
object
- optional graphic style- [.strokeColor]
string
- color of perimeter - [.lineWidth]
number
- line width - [.fillColor]
string
- fill color
- [.strokeColor]
- [.layer]
H.map.layer.ObjectLayer
hm:cluster(coords, opt, cb) ⇒ Creates a cluster of points
Kind: global function
Returns: H.map.layer.ObjectLayer
- layer created
Params
- coords
Array
- array of [lat,lng,payload] - opt
object
- options for cluster- [.minZoom]
number
- min zoom for cluster to be visible - [.maxZoom]
number
- max zoom for cluster to be visible - [.noise]
object
- graphic to represent stand-alone point. {icon,size}- [.icon]
string
- png/jpg/svg file. @ as first character indicates a file from this package. Anchor will be bottom-center - [.size]
number
- optional size of icon
- [.icon]
- [.cluster]
object
- { weight:{icon,size}, weight:{icon,size},... }- [.icon]
string
- png/jpg/svg file to represent group of pois. @ as first character indicates a file from this package. Anchor will be middle of icon - [.size]
number
- size of icon
- [.icon]
- [.minZoom]
- cb
function
- callback to be called if click on item. Format cb(event, coord, payload, weigth).coord
is coord of iconpayload
is payload associated to point.weight
is number of points aggregated, when clicking on a cluster icon, 1 if single point
Example
let pois = 48823"Hello world"48524"How are you"452293"Very well"; hm; // with more graphic options and callback defined let opt = noise: icon: "mcdo.png" size: 12 cluster: 200: icon: "@svg/cluster_red.svg" size: 64 75: icon: "@svg/cluster_orange.svg" size: 52 2: icon: "@svg/cluster_green.svg" size: 40 ; hm;
hm:clusterHide()
Hide cluster layer
hm:clusterShow()
Show cluster layer
hm:config(opt)
To configure app_id, app_code and optionally use CIT and http
Kind: global function
Params
- opt
Object
-opt
with parameters.- [.app_id]
string
- the app_id from developer.here.com (REST) - [.app_code]
string
- the app_code from developer.here.com (REST) - [.api_key]
string
- the api_key from developer.here.com (JS) - [.useCIT]
boolean
= false
- true to use CIT environment. - [.useHTTP]
string
= false
- true to use HTTP. - [.useHTTPS]
string
= true
- true to use HTTPS. - [.rps]
object
- set rps limit {routing:1,gc:2,rgc:10,pde:10}
- [.app_id]
Example
hm;
hm:config(opt)
To configure app_id, app_code and optionally use CIT and http
Kind: global function
Params
- opt
Object
-opt
with parameters.- [.app_id]
string
- the app_id from developer.here.com (REST) - [.app_code]
string
- the app_code from developer.here.com (REST) - [.api_key]
string
- the api_key from developer.here.com (JS) - [.useCIT]
boolean
= false
- true to use CIT environment. - [.useHTTP]
string
= false
- true to use HTTP. - [.useHTTPS]
string
= true
- true to use HTTPS. - [.rps]
object
- set rps limit {routing:1,gc:2,rgc:10,pde:10}
- [.app_id]
Example
hm;
object
hm:coord2Point(coord) ⇒ Convert [lat,lng] to {lat,lng}
Kind: global function
Returns: object
- - {lat,lng}
Params
- coord
array
- [lat,lng]
object
hm:coord2Point(coord) ⇒ Convert [lat,lng] to {lat,lng}
Kind: global function
Returns: object
- - {lat,lng}
Params
- coord
array
- [lat,lng]
array
hm:coordA2O(arr) ⇒ Convert an array [lat,lng] to {lat,lng}
Kind: global function
Returns: array
- {lat,lng}
Params
- arr
object
- [lat,lng]
array
hm:coordA2O(arr) ⇒ Convert an array [lat,lng] to {lat,lng}
Kind: global function
Returns: array
- {lat,lng}
Params
- arr
object
- [lat,lng]
array
hm:coordO2A(obj) ⇒ Convert an object {lat,lng} to [lat,lng]
Kind: global function
Returns: array
- [lat,lng]
Params
- obj
object
- {lat,lng}
array
hm:coordO2A(obj) ⇒ Convert an object {lat,lng} to [lat,lng]
Kind: global function
Returns: array
- [lat,lng]
Params
- obj
object
- {lat,lng}
array
hm:coords2XY(coords) ⇒ Convert array of [lat,lng] to array of {x,y}
Kind: global function
Returns: array
- array of {x,y}
Params
- coords
array
- array of [lat,lng]
array
hm:coords2XY(coords) ⇒ Convert array of [lat,lng] to array of {x,y}
Kind: global function
Returns: array
- array of {x,y}
Params
- coords
array
- array of [lat,lng]
Object
hm:coords2bb(coords) ⇒ compute the bounding box of an array of corrds
Kind: global function
Returns: Object
- - {latm,latM,lngm,lngM}
Params
- coords
array
- [[lat,lng],[lat,lng]]
Object
hm:coords2bb(coords) ⇒ compute the bounding box of an array of corrds
Kind: global function
Returns: Object
- - {latm,latM,lngm,lngM}
Params
- coords
array
- [[lat,lng],[lat,lng]]
array
hm:coordsPDE2Array(lats, lng) ⇒ Convert coords of format PDE: lat or lng initial/100000, delta / 100000
Kind: global function
Returns: array
- [lat,lng]
Params
- lats
array
- lng
array
array
hm:coordsPDE2Array(lats, lng) ⇒ Convert coords of format PDE: lat or lng initial/100000, delta / 100000
Kind: global function
Returns: array
- [lat,lng]
Params
- lats
array
- lng
array
int
hm:countTiles(bbox, level) ⇒ count the number of tiles for a given bounding box and zoom level
Kind: global function
Returns: int
- count of tiles
Params
- bbox
array
- bounding box, as {latm,latM,lngm,lngM}; - level
int
- zoom level
int
hm:countTiles(bbox, level) ⇒ count the number of tiles for a given bounding box and zoom level
Kind: global function
Returns: int
- count of tiles
Params
- bbox
array
- bounding box, as {latm,latM,lngm,lngM}; - level
int
- zoom level
Promise
hm:detour(start, stop, waypoints) ⇒ Compute the detour for each waypoint provided, compared to normal route from A to B
Kind: global function
Returns: Promise
- returns {reference: {start, stop, distance, distance2, time, time2} ,waypoints:[ {coord, distA, timeA, distB, timeB}]}
Params
- start
coord
- starting point for route - stop
coord
- destination point of route - waypoints
array
- list of watypoints to test
Promise
hm:detour(start, stop, waypoints) ⇒ Compute the detour for each waypoint provided, compared to normal route from A to B
Kind: global function
Returns: Promise
- returns {reference: {start, stop, distance, distance2, time, time2} ,waypoints:[ {coord, distA, timeA, distB, timeB}]}
Params
- start
coord
- starting point for route - stop
coord
- destination point of route - waypoints
array
- list of watypoints to test
Promise
hm:geocode(address, opt) ⇒ geocode an address
Kind: global function
Returns: Promise
- {coord,body}. coord is geocode as [lat,lng]. body is full json answer
Params
- address
string
- address as string - opt
object
- optional additional parameter, for instance {additionaldata:"IncludeShapeLevel,city"}
Example
const res = await hm;console;
Promise
hm:geocode(address, opt) ⇒ geocode an address
Kind: global function
Returns: Promise
- {coord,body}. coord is geocode as [lat,lng]. body is full json answer
Params
- address
string
- address as string - opt
object
- optional additional parameter, for instance {additionaldata:"IncludeShapeLevel,city"}
Example
const res = await hm;console;
Promise
hm:geocoderAutocomplete(opt) ⇒ reverse geocode a coordinate. Can centered on a location or within a bounding box
Kind: global function
Returns: Promise
- returns [{},{}]
Params
- opt
Object
- {query, bb or center}- .search
String
- text to search - .center
array
- [lat,lng] - .bb
object
- {latm,latM,lngm,lngM}
- .search
Promise
hm:geocoderAutocomplete(opt) ⇒ reverse geocode a coordinate. Can centered on a location or within a bounding box
Kind: global function
Returns: Promise
- returns [{},{}]
Params
- opt
Object
- {query, bb or center}- .search
String
- text to search - .center
array
- [lat,lng] - .bb
object
- {latm,latM,lngm,lngM}
- .search
json
hm:getAvailableMapStyle() ⇒ list of all available map styles normal.day, night....
Kind: global function
Returns: json
- list of map styles as json
json
hm:getAvailableMapStyle() ⇒ list of all available map styles normal.day, night....
Kind: global function
Returns: json
- list of map styles as json
coord
hm:getCenter() ⇒ return coordinate of the center of the map
Kind: global function
Returns: coord
- coord of the center as [lat,lng]
coord
hm:getCenter() ⇒ return coordinate of the center of the map
Kind: global function
Returns: coord
- coord of the center as [lat,lng]
object
hm:getDefaultLayers() ⇒ return default layers, created by _platform.createDefaultLayers();
Kind: global function
Returns: object
- defaultlayer
object
hm:getDefaultLayers() ⇒ return default layers, created by _platform.createDefaultLayers();
Kind: global function
Returns: object
- defaultlayer
object
hm:getPlatform() ⇒ return platorm;
Kind: global function
Returns: object
- platform
object
hm:getPlatform() ⇒ return platorm;
Kind: global function
Returns: object
- platform
string
hm:getThrottleLimits() ⇒ get Throttle limts for various modules
Kind: global function
Returns: string
- object with various limitsl
string
hm:getThrottleLimits() ⇒ get Throttle limts for various modules
Kind: global function
Returns: string
- object with various limitsl
Object
hm:getViewBB() ⇒ return bounding box of visible part of map
Kind: global function
Returns: Object
- bouding box of visible part of the map, as [latm,latM,longm,lngM]
Object
hm:getViewBB() ⇒ return bounding box of visible part of map
Kind: global function
Returns: Object
- bouding box of visible part of the map, as [latm,latM,longm,lngM]
number
hm:getZoom() ⇒ return zoom value
Kind: global function
Returns: number
- zoom level
number
hm:getZoom() ⇒ return zoom value
Kind: global function
Returns: number
- zoom level
object
hm:htmlBounding() ⇒ provide bounding box of element hosting map, relative to window
Kind: global function
Returns: object
- {top,left,width, height} relative to window
object
hm:htmlBounding() ⇒ provide bounding box of element hosting map, relative to window
Kind: global function
Returns: object
- {top,left,width, height} relative to window
Promise
hm:isoline(opt) ⇒ compute an isoline. See more info on optional parameters
Kind: global function
Returns: Promise
- returns { poly:array, body:object }. Poly is array of coords, body is full answer
Params
- opt
object
- option for isoline- [.start]
coord
- coord for starting point of isoline - [.destination]
coord
- coord for destination point of isoline - [.rangeType]
string
= ""time""
- time or distance - [.range]
number
- range in seconds or in meters - [.mode]
String
= "fastest;car;traffic:disabled"
- routing mode - [.linkattributes]
String
= sh
- attributes to be returned
- [.start]
Promise
hm:isoline(opt) ⇒ compute an isoline. See more info on optional parameters
Kind: global function
Returns: Promise
- returns { poly:array, body:object }. Poly is array of coords, body is full answer
Params
- opt
object
- option for isoline- [.start]
coord
- coord for starting point of isoline - [.destination]
coord
- coord for destination point of isoline - [.rangeType]
string
= ""time""
- time or distance - [.range]
number
- range in seconds or in meters - [.mode]
String
= "fastest;car;traffic:disabled"
- routing mode - [.linkattributes]
String
= sh
- attributes to be returned
- [.start]
hm:layerCreate(name, visible)
create a layer
Kind: global function
Params
- name
string
- name of layer - visible
boolean
- initial status
Example
hm;
hm:layerCreate(name, visible)
create a layer
Kind: global function
Params
- name
string
- name of layer - visible
boolean
- initial status
Example
hm;
hm:layerDelete(name)
delete a layer
Kind: global function
Params
- name
String
- name of layer
hm:layerDelete(name)
delete a layer
Kind: global function
Params
- name
String
- name of layer
hm:layerEmpty(layer)
Empty a layer, or create it if not existing
Kind: global function
Params
- layer
string
hm:layerEmpty(layer)
Empty a layer, or create it if not existing
Kind: global function
Params
- layer
string
hm:layerFind(name)
find layer by its name or return null
Kind: global function
Params
- name
string
hm:layerFind(name)
find layer by its name or return null
Kind: global function
Params
- name
string
hm:layerSetVisibility(name, visible)
create a layer
Kind: global function
Params
- name
string
- name of layer - visible
boolean
- visible or not
Example
hm;
hm:layerSetVisibility(name, visible)
create a layer
Kind: global function
Params
- name
string
- name of layer - visible
boolean
- visible or not
Example
hm;
Promise
hm:linkid(linkid) ⇒ get linkid Information, based on routing
Kind: global function
Returns: Promise
- - promise with {summary, coords, route ,body}
Params
- linkid
int
- linkid for which information is needed
Promise
hm:linkid(linkid) ⇒ get linkid Information, based on routing
Kind: global function
Returns: Promise
- - promise with {summary, coords, route ,body}
Params
- linkid
int
- linkid for which information is needed
hm:locateMe(callback, opt)
watch position on HTML5 position. This requires HTTPS. Creates layer "_gps". To deactivate, call with null callback
Kind: global function
Params
- callback
function
- callback when coord changes. Format: callback(coord,accuracy) - opt
Object
- optional graphic options- [.position]
object
- graphic options for center. See buildIcon- [.svg]
string
- svg file - [.color]
string
- color for {color} tag - [.size]
number
- size of icon - [.anchor]
number
- anchor of icon
- [.svg]
- [.accuracy]
object
- graphic options for accuracy representation- [.strokeColor]
String
- color of circle line representing accuracy area - [.lineWidth]
number
- width of line of circle - [.fillColor]
String
- fill color of circle representing accuracy area
- [.strokeColor]
- [.position]
hm:locateMe(callback, opt)
watch position on HTML5 position. This requires HTTPS. Creates layer "_gps". To deactivate, call with null callback
Kind: global function
Params
- callback
function
- callback when coord changes. Format: callback(coord,accuracy) - opt
Object
- optional graphic options- [.position]
object
- graphic options for center. See buildIcon- [.svg]
string
- svg file - [.color]
string
- color for {color} tag - [.size]
number
- size of icon - [.anchor]
number
- anchor of icon
- [.svg]
- [.accuracy]
object
- graphic options for accuracy representation- [.strokeColor]
String
- color of circle line representing accuracy area - [.lineWidth]
number
- width of line of circle - [.fillColor]
String
- fill color of circle representing accuracy area
- [.strokeColor]
- [.position]
hm:map(htmlItem, opt)
create a map area within the specified item
Kind: global function
Params
- htmlItem
string
- identifier of html div item on which to insert map - opt
object
- options- [.zoom]
number
= 10
- zoom factor - [.center]
Coord
= [48.86, 2.3]
- Coord of the center - [.scheme]
string
= "normal.day.grey"
- any scheme defined by HERE, plus "satellite", "japan", "korea", "black", "white", "transparent". For japan/korea, one needs special credentials as APP_ID_JAPAN APP_KOREA APP_CODE_JAPAN APP_CODE_KOREA - [.click]
function
- callback on mouse click: callback(coord,button,key) - [.dbClick]
function
- callback on mouse double click: callback(coord,button,key) - [.clickLeft]
function
- callback on mouse click left: callback(coord,button,key) - [.clickRight]
function
- callback on mouse click right.: callback(coord,button,key) - [.keyDown]
function
- callback on key down : callback(key) - [.viewChange]
function
- callback if map is panned or zoomed : callback(zoom,coordCenter) - [.loadTile]
function
- callback when a tile is loaded : callback(z,x,y,url) - [.rendered]
function
- callback when render is completed : callback(event)
- [.zoom]
Example
const hm = windowheremap; hm; hm;
hm:map(htmlItem, opt)
create a map area within the specified item
Kind: global function
Params
- htmlItem
string
- identifier of html div item on which to insert map - opt
object
- options- [.zoom]
number
= 10
- zoom factor - [.center]
Coord
= [48.86, 2.3]
- Coord of the center - [.scheme]
string
= "normal.day.grey"
- any scheme defined by HERE, plus "satellite", "japan", "korea", "black", "white", "transparent". For japan/korea, one needs special credentials as APP_ID_JAPAN APP_KOREA APP_CODE_JAPAN APP_CODE_KOREA - [.click]
function
- callback on mouse click: callback(coord,button,key) - [.dbClick]
function
- callback on mouse double click: callback(coord,button,key) - [.clickLeft]
function
- callback on mouse click left: callback(coord,button,key) - [.clickRight]
function
- callback on mouse click right.: callback(coord,button,key) - [.keyDown]
function
- callback on key down : callback(key) - [.viewChange]
function
- callback if map is panned or zoomed : callback(zoom,coordCenter) - [.loadTile]
function
- callback when a tile is loaded : callback(z,x,y,url) - [.rendered]
function
- callback when render is completed : callback(event)
- [.zoom]
Example
const hm = windowheremap; hm; hm;
H.map.Marker
hm:marker(opt) ⇒ add a marker in a layer. SVG files can be created with https://editor.method.ac/
Kind: global function
Returns: H.map.Marker
- marker created
Params
- opt
object
- options to create the marker, can be a coord directly- [.layer]
string
- layer name - [.coord]
coord
- coord of the marker as [lat,lng] - [.icon]
string
- created from hm.buildIcon - [.svg]
string
- see hm.buildIcon - [.opt]
Object
- see hm.buildIcon - .pointerenter
function
- if enter, callback(target,coord,ev) - .pointerClick
function
- if click, callback(target,coord,ev) - .data
string
- optional data - .bubble
boolean
- if true, show buble on click with data - .draggable
boolean
- draggable marker - .dragged
function
- if dragged, callback(target,coord)
- [.layer]
Example
hm; hm; hm; hm; hm; hm;
H.map.Marker
hm:marker(opt) ⇒ add a marker in a layer. SVG files can be created with https://editor.method.ac/
Kind: global function
Returns: H.map.Marker
- marker created
Params
- opt
object
- options to create the marker, can be a coord directly- [.layer]
string
- layer name - [.coord]
coord
- coord of the marker as [lat,lng] - [.icon]
string
- created from hm.buildIcon - [.svg]
string
- see hm.buildIcon - [.opt]
Object
- see hm.buildIcon - .pointerenter
function
- if enter, callback(target,coord,ev) - .pointerClick
function
- if click, callback(target,coord,ev) - .data
string
- optional data - .bubble
boolean
- if true, show buble on click with data - .draggable
boolean
- draggable marker - .dragged
function
- if dragged, callback(target,coord)
- [.layer]
Example
hm; hm; hm; hm; hm; hm;
Promise
hm:matrix(source, dest, opt) ⇒ compute a matrix. See more info on optional parameters
Matrix size is limited to 1x100, 100x1 or 15xN
Kind: global function
Returns: Promise
- { entries: object, body:object }. entries is the array of {start,stop} information. body is full json answer
Params
- source
object
- source as [lat,lng]. Can be array of [lat,lng] - dest
object
- dest as [lat,lng]. Can be array of [lat,lng] - opt
object
- additional optional parameters like mode, summaryAttributes- [.mode]
string
= ""fastest;car;traffic:enabled""
- routing mode to compute matrix - [.summaryAttributes]
string
= ""tt,di""
- attributes in the answer
- [.mode]
Example
const res = await hm;console;
Promise
hm:matrix(source, dest, opt) ⇒ compute a matrix. See more info on optional parameters
Matrix size is limited to 1x100, 100x1 or 15xN
Kind: global function
Returns: Promise
- { entries: object, body:object }. entries is the array of {start,stop} information. body is full json answer
Params
- source
object
- source as [lat,lng]. Can be array of [lat,lng] - dest
object
- dest as [lat,lng]. Can be array of [lat,lng] - opt
object
- additional optional parameters like mode, summaryAttributes- [.mode]
string
= ""fastest;car;traffic:enabled""
- routing mode to compute matrix - [.summaryAttributes]
string
= ""tt,di""
- attributes in the answer
- [.mode]
Example
const res = await hm;console;
Promise
hm:placeAutoSuggest(opt) ⇒ Autocomplete of Places (POI). Can be centered on a locaiton or within a bounding box
Kind: global function
Returns: Promise
- Array of {res,title,value,coord}
Params
- opt
Object
- options of autosuggest- .search
String
- search string - .center
Coord
- center search around this coord - .bb
object
- {latm,latM,lngm,lngM}
- .search
Promise
hm:placeAutoSuggest(opt) ⇒ Autocomplete of Places (POI). Can be centered on a locaiton or within a bounding box
Kind: global function
Returns: Promise
- Array of {res,title,value,coord}
Params
- opt
Object
- options of autosuggest- .search
String
- search string - .center
Coord
- center search around this coord - .bb
object
- {latm,latM,lngm,lngM}
- .search
array
hm:placeExplore(opt, categories) ⇒ Discover places (POI) around a coordnate belonging to a list of categories
Kind: global function
Returns: array
- array of {id,title,icon}
Params
- opt
object
- option for search- .at
array
- center of search - .size
int
- number of result to return
- .at
- categories
text
- list of comma separated categories for post-filtering
array
hm:placeExplore(opt, categories) ⇒ Discover places (POI) around a coordnate belonging to a list of categories
Kind: global function
Returns: array
- array of {id,title,icon}
Params
- opt
object
- option for search- .at
array
- center of search - .size
int
- number of result to return
- .at
- categories
text
- list of comma separated categories for post-filtering
promise
hm:placeGetCategory(center) ⇒ Get Categories of Places (POI)
Kind: global function
Returns: promise
- array of {id,title,icon}
Params
- center
array
- where to search for available categories
promise
hm:placeGetCategory(center) ⇒ Get Categories of Places (POI)
Kind: global function
Returns: promise
- array of {id,title,icon}
Params
- center
array
- where to search for available categories
promise
hm:placeSearch(opt, categories) ⇒ Search for a Place (POI) around a coordinate matching a name
Kind: global function
Returns: promise
- array of {id,title,icon}
Params
- opt
object
- option for search- .at
array
- center of search - .q
text
- name to search - .size
int
- number of result to return
- .at
- categories
text
- list of comma separated categories for post-filtering
promise
hm:placeSearch(opt, categories) ⇒ Search for a Place (POI) around a coordinate matching a name
Kind: global function
Returns: promise
- array of {id,title,icon}
Params
- opt
object
- option for search- .at
array
- center of search - .q
text
- name to search - .size
int
- number of result to return
- .at
- categories
text
- list of comma separated categories for post-filtering
array
hm:point2Coord({lat,lng}) ⇒ Convert {lat,lng} to [lat,lng]
Kind: global function
Returns: array
- [lat,lng] - array converted
Params
- {lat,lng}
object
- object to convert
array
hm:point2Coord({lat,lng}) ⇒ Convert {lat,lng} to [lat,lng]
Kind: global function
Returns: array
- [lat,lng] - array converted
Params
- {lat,lng}
object
- object to convert
hm:polygon(opt)
Draw a polygon
Kind: global function
Params
- opt
Object
- options to draw a polygon. Same options as hm.polyline
hm:polygon(opt)
Draw a polygon
Kind: global function
Params
- opt
Object
- options to draw a polygon. Same options as hm.polyline
hm:polyline(opt)
Draw a polyline.
Kind: global function
Params
- opt
object
- options to draw polyline- [.layer]
String
- optional layer to use - [.coords]
array
- array of coords, as [[48.8,2.3],[48.85,2.4],... ] - [.style]
object
- optional graphic style - [.lineWidth]
number
= 4
- line width- [.strokeColor]
string
= "rgba(0, 128, 255, 0.7)"
- line color
- [.strokeColor]
- [.arrows]
object
- optional arrow - [.data]
String
- optional user data - [.pointerClick]
function
- optional callback if click on line. format callback(target,coord,event) - [.pointerenter]
function
- optional callback if mouse enters on line. format callback(target,coord,event) - [.pointerLeave]
function
- optional callback if mouse leaves the line. format callback(target,coord,event) - [.z]
number
- optional z level
- [.layer]
hm; hm; hm;
hm:polyline(opt)
Draw a polyline.
Kind: global function
Params
- opt
object
- options to draw polyline- [.layer]
String
- optional layer to use - [.coords]
array
- array of coords, as [[48.8,2.3],[48.85,2.4],... ] - [.style]
object
- optional graphic style - [.lineWidth]
number
= 4
- line width- [.strokeColor]
string
= "rgba(0, 128, 255, 0.7)"
- line color
- [.strokeColor]
- [.arrows]
object
- optional arrow - [.data]
String
- optional user data - [.pointerClick]
function
- optional callback if click on line. format callback(target,coord,event) - [.pointerenter]
function
- optional callback if mouse enters on line. format callback(target,coord,event) - [.pointerLeave]
function
- optional callback if mouse leaves the line. format callback(target,coord,event) - [.z]
number
- optional z level
- [.layer]
hm; hm; hm;
Promise
hm:reverseGeocode(coord) ⇒ reverse geocode a coordinate
Kind: global function
Returns: Promise
- returns { location:object, address:object, body:object}.
Params
- coord
Coord
- coord [lat,lng] to reverse-geocode
Promise
hm:reverseGeocode(coord) ⇒ reverse geocode a coordinate
Kind: global function
Returns: Promise
- returns { location:object, address:object, body:object}.
Params
- coord
Coord
- coord [lat,lng] to reverse-geocode
Promise
hm:route(source, dest, opt) ⇒ compute a route with optional waypooints. See more info on optional parameters
Kind: global function
Returns: Promise
- returns { summary: object, coords:array,route: object, body:object}. coords is array of coord, to be used with hm.polyline.
Params
- source
object
- source as [lat,lng]. Can be array of [lat,lng] to define waypoints - dest
object
- dest as [lat,lng]. Can be array of [lat,lng] to define waypoints - opt
object
- route options- [.mode]
string
= "fastest;car;traffic:disabled"
- routing mode - [.routeattributes]
string
= "waypoints,summary,shape"
- route attributes - [.maneuverattributes]
string
= "direction,action"
- manoeuver attributes
- [.mode]
Example
const res = await hm;console; const res = await hm;console; const res = await hm;console;
Promise
hm:route(source, dest, opt) ⇒ compute a route with optional waypooints. See more info on optional parameters
Kind: global function
Returns: Promise
- returns { summary: object, coords:array,route: object, body:object}. coords is array of coord, to be used with hm.polyline.
Params
- source
object
- source as [lat,lng]. Can be array of [lat,lng] to define waypoints - dest
object
- dest as [lat,lng]. Can be array of [lat,lng] to define waypoints - opt
object
- route options- [.mode]
string
= "fastest;car;traffic:disabled"
- routing mode - [.routeattributes]
string
= "waypoints,summary,shape"
- route attributes - [.maneuverattributes]
string
= "direction,action"
- manoeuver attributes
- [.mode]
Example
const res = await hm;console; const res = await hm;console; const res = await hm;console;
data
hm:screenshot(opt, opt) ⇒ perform a screenshot of the map and returns a promise with the data
Kind: global function
Returns: data
- binary data of image
Params
- opt
object
- options for screenshot- [.name]
string
- filename for download - [.ui]
boolean
- true to ui (scale, etc..) in screenshot
- [.name]
- opt
object
- options for screenshot
data
hm:screenshot(opt, opt) ⇒ perform a screenshot of the map and returns a promise with the data
Kind: global function
Returns: data
- binary data of image
Params
- opt
object
- options for screenshot- [.name]
string
- filename for download - [.ui]
boolean
- true to ui (scale, etc..) in screenshot
- [.name]
- opt
object
- options for screenshot
hm:setCenter(coord)
set center of the map
Kind: global function
Params
- coord
Array
- coord as [lat,lng]
- @example
hm;
hm:setCenter(coord)
set center of the map
Kind: global function
Params
- coord
Array
- coord as [lat,lng]
- @example
hm;
hm:setScheme(scheme)
define the scheme. List of scheme can be obtained from hm.getAvailableMapStyle()
Kind: global function
Params
- scheme
string
- scheme name
hm:setScheme(scheme)
define the scheme. List of scheme can be obtained from hm.getAvailableMapStyle()
Kind: global function
Params
- scheme
string
- scheme name
hm:setViewBB(opt)
sets bouding box to be displayed
Kind: global function
Params
- opt
Object
|string
- either an object specifying how to set bounding box, or a String being the name of a layer- [.layer]
string
- bouding box aroud all objects of the layer - [.pois]
array
- bouding box aroud all coords defined as [coord,coord...]
- [.layer]
Example
hm; hm;
hm:setViewBB(opt)
sets bouding box to be displayed
Kind: global function
Params
- opt
Object
|string
- either an object specifying how to set bounding box, or a String being the name of a layer- [.layer]
string
- bouding box aroud all objects of the layer - [.pois]
array
- bouding box aroud all coords defined as [coord,coord...]
- [.layer]
Example
hm; hm;
hm:setZoom(zoom)
set zoom level
Kind: global function
Params
- zoom
number
hm:setZoom(zoom)
set zoom level
Kind: global function
Params
- zoom
number
array
hm:simplify(coords, tolerance) ⇒ Simplify a polyline by using the Ramer-Douglas-Peucker algorithm
Kind: global function
Returns: array
- simplified polyline as array of [lat,lng]
Params
- coords
array
- array of [lat,lng] - tolerance
number
- tolerance for simplification
array
hm:simplify(coords, tolerance) ⇒ Simplify a polyline by using the Ramer-Douglas-Peucker algorithm
Kind: global function
Returns: array
- simplified polyline as array of [lat,lng]
Params
- coords
array
- array of [lat,lng] - tolerance
number
- tolerance for simplification
Object
hm:tile2BB(tileX, tileY, level) ⇒ compute the bounding box of a Tile
Kind: global function
Returns: Object
- - {latm,latM,lngm,lngM}
Params
- tileX
int
- X coord of the tile - tileY
int
- Y coord of the tile - level
int
- zoom level
Object
hm:tile2BB(tileX, tileY, level) ⇒ compute the bounding box of a Tile
Kind: global function
Returns: Object
- - {latm,latM,lngm,lngM}
Params
- tileX
int
- X coord of the tile - tileY
int
- Y coord of the tile - level
int
- zoom level
hm:touch(onoff, options)
activate touch, allowing hand drawing, with embedded simplification of the line
Kind: global function
Params
- onoff
boolean
- activate or deactivate - options
object
- options to control the touch behaviour- [.callback]
function
- calling callback(coords) when touch ends - [.layer]
string
- layer where to put the drawing - [.style]
object
- drawing style for the line - [.arrows]
object
- arrow style for the line - [.tolerance]
number
= 4
- tolerance for simplification - [.keep]
boolean
= false
- keep graphic or not when calling callback
- [.callback]
hm:touch(onoff, options)
activate touch, allowing hand drawing, with embedded simplification of the line
Kind: global function
Params
- onoff
boolean
- activate or deactivate - options
object
- options to control the touch behaviour- [.callback]
function
- calling callback(coords) when touch ends - [.layer]
string
- layer where to put the drawing - [.style]
object
- drawing style for the line - [.arrows]
object
- arrow style for the line - [.tolerance]
number
= 4
- tolerance for simplification - [.keep]
boolean
= false
- keep graphic or not when calling callback
- [.callback]
array
hm:xy2Coords(coords) ⇒ Convert array of {x,y} to array of [lat,lng]
Kind: global function
Returns: array
- array of [lat,lng]
Params
- coords
array
- array of {x,y}
array
hm:xy2Coords(coords) ⇒ Convert array of {x,y} to array of [lat,lng]
Kind: global function
Returns: array
- array of [lat,lng]
Params
- coords
array
- array of {x,y}
lineIntersects(A, B, C, D)
Kind: global function
Params
- A
*
- B
*
- C
*
- D
*
coord
marker:getCoord() ⇒ get coordinates of a marker
Kind: global function
Returns: coord
- [lat,lng]
Example
let m =hm; let coord = m; // returns [48.8,2.3]
coord
marker:getCoord() ⇒ get coordinates of a marker
Kind: global function
Returns: coord
- [lat,lng]
Example
let m =hm; let coord = m; // returns [48.8,2.3]
stringify()
Stringifies a GeoJSON object into WKT
Kind: global function
© 2018-2019 devbab