This time I will share jQuery Plugin and tutorial about jHERE – jQuery Interactive Map Plugin, hope it will help you in programming stack.
jHERE is a simple (1.95KB Gzipped) jQuery plugin offering a powerful map API which can be used to easily add interactive HERE maps to your website.
With jHERE, you will get a powerful map API, highly customizable markers, event handling and info bubbles. Bonus features are KML support and data visualization via heatmaps.
jHERE is built on top of the awesome and very solid HERE Maps API. For advanced users, the native API is exposed by jHERE, thus offering unlimited possibilities of customization.
Basic Usage:
1. Include jQuery library and the jHERE.js script on the page.
1 |
< script src = "jquery.min.js" ></ script > |
2 |
< script src = "js/jhere.js" ></ script > |
2. Create a container element to hold the map.
3. Make sure the container element contain the map has the appropriate size via CSS, e.g. by setting width and height.
4. Make a map with the following options.
04 |
appId: '69Dgg78qt4obQKxVbRA8' , |
05 |
authToken: 'Nz7ilIB_v1CRwPXxgPdvuA' , |
12 |
center: [52.49, 13.37], |
26 |
enable: ['behavior ', ' zoombar ', ' scalebar ', ' typeselector '], |
29 |
' map ': the normal map type. This is the default. |
30 |
' smart ': a map with most of the colors grayed out. Useful for data visualization. |
31 |
' pt ': a smart map where the tiles also contain the public transport lines. |
32 |
' satellite ': satellite view. |
33 |
' terrain ': terrain view. |
34 |
' community ': HERE Maps community layer. |
35 |
' satcommunity ': HERE Maps community layer with satellite imagery. |
36 |
' traffic ': traffic layer. |
5. API methods available.
02 |
$( '#map' ).jHERE( 'center' , centerObject); |
05 |
$( '#map' ).jHERE( 'zoom' , zoomLevel); |
08 |
$( '#map' ).jHERE( 'type' , mapType); |
11 |
$( '#map' ).jHERE( 'marker' , positionObject, markerOptions); |
14 |
$( '#map' ).jHERE( 'nomarkers' ); |
17 |
$( '#map' ).jHERE( 'bubble' , positionObject, bubbleOptions); |
20 |
$( '#map' ).jHERE( 'kml' , KMLfile, zoomToKML, ondone); |
23 |
$( '#map' ).jHERE( 'heatmap' , data, type, options); |
26 |
$( '#map' ).jHERE( 'originalMap' , closure); |
6. It is possible to listen for events on the map in the usual jQuery way (on, off). All the event names start with map. The event passed to the callback function always has a geo (data.geo for Tire users) property that contains latitude and longitude of the point where the event originated. Supported events are: mapclick, mapmouseup, mapmousedown, mapmousemove, mapmouseover, mapmouseout, mapmouseenter, mapmouseleave, maplongpress, mapdragstart, mapdrag, mapdragend, mapresize, maptouchstart, maptouchend, maptouchmove.
1 |
$( '#map' ).on( 'mapclick' , function (e){ console.log (e.geo)}); |
7. In order to keep jHERE as small as possible, the plugin contains only a subset of all the functionalities that are available via the HERE Maps API. Checkout the ‘extensions’ folder for more details.
Changelog:
2018-07-16
v0.9.0 (2014-6-14)
v0.7.2 (2013-7-23)
This awesome jQuery plugin is developed by mmarcon. For more Advanced Usages, please check the demo page or visit the official website.