Constructor
new GSSMap(accessToken, containerId, options, onLoadCallback)
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
String | API Key. |
containerId |
String | HTML element id of the container. |
options |
Object | Optional: Default options to be applied on map creation. |
onLoadCallback |
function | Optional: The method to be invoked on map load. Note: options is a JSON Object and following keys influence the map initialization. options keys: center, zoom, minZoom, maxZoom, zoomControl, mapStyle |
Examples
var gssMap = new gssmaps.GSSMap('12312dfadsfasdfadsf12asdf1', 'map');
var options = {center: [47.6101, -122.3421],
zoom: 6,
maxZoom:16,
minZoom:0,
zoomControl: true,
mapStyle:"default"}
var gssMap = new gssmaps.GSSMap('12312dfadsfasdfadsf12asdf1', 'map', options);
Methods
addBubbleIconMarker(gssMarker, popupContent) → {GSSMarker}
Adds the GSSIconBubble as a marker.
Parameters:
Name | Type | Description |
---|---|---|
gssMarker |
GSSMarker | |
popupContent |
String | Optional: Content to be displayed, when clicked on marker. |
Returns:
Returns the marker with an id, which acts as a unique identifier for the marker on the map..
- Type
- GSSMarker
addLayer(layer)
Adds a layer to the map.
Parameters:
Name | Type | Description |
---|---|---|
layer |
GSSTileLayer | The layer to be added to the map. |
addMarker(gssMarker, popupContent) → {GSSMarker}
Adds the marker on the map
Parameters:
Name | Type | Description |
---|---|---|
gssMarker |
GSSMarker | |
popupContent |
String | Optional: Content to be displayed when clicked on marker. |
Returns:
Returns the marker with an id, which acts as a unique identifier for the marker on the map.
- Type
- GSSMarker
addPolyline(gssPolyline)
Draws a line along the given lat lng points.
Parameters:
Name | Type | Description |
---|---|---|
gssPolyline |
GSSPolyline | An instance of GSSPolyline |
Returns:
Returns the polyline with an id, which acts as a unique identifier for the polyline on the map.
fitBounds(gssLatLngs)
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.
Parameters:
Name | Type | Description |
---|---|---|
gssLatLngs |
Array.<GSSLatLng> | An array of positions. |
getCenter() → {GSSLatLng}
Returns the center point of the map being set.
Returns:
default Center point of map.
- Type
- GSSLatLng
getMaxZoom() → {Number}
Returns the map's maximum allowable zoom level.
Returns:
maxZoom.
- Type
- Number
getMinZoom() → {Number}
Returns the map's minimum allowable zoom level.
Returns:
minZoom.
- Type
- Number
getZoom() → {Number}
Returns the current zoom level of map.
Returns:
Current zoom level.
- Type
- Number
on(eventName, method)
Registers an event on map and calls back the method, when the event occurs.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Event to be regisered. |
method |
Method | The routine/method to be invoked when registered event occurs. |
panTo(gssLatLng)
Pans the map to the specified point which is centered in the map.
Parameters:
Name | Type | Description |
---|---|---|
gssLatLng |
GSSLatLng |
remove()
Removes map from webpage that frees up space, also unregisters all the events if any.
removeAllMarkers()
Removes all the markers dropped on the map.
removeLayer(layer)
Removes the layer to the map.
Parameters:
Name | Type | Description |
---|---|---|
layer |
GSSTileLayer | The layer to be removed from the map. |
removeMarker(gssMarker)
Deletes the marker from the map.
Parameters:
Name | Type | Description |
---|---|---|
gssMarker |
GSSMarker | The marker need to be removed from map. |
removePolyline(gssPolyline)
Deletes the polyline from the map.
Parameters:
Name | Type | Description |
---|---|---|
gssPolyline |
GSSPolyline | The polyline need to be removed from map. |
setMaxZoom(zoomLevel)
Sets or clears the map's maximum zoom level. If the map's current zoom level is higher than the new maximum, the map will zoom to the new maximum.
Parameters:
Name | Type | Description |
---|---|---|
zoomLevel |
Number | The maximum zoom level to set (0-24). |
setMinZoom(zoomLevel)
Sets or clears the map's minimum zoom level. If the map's current zoom level is lower than the new minimum, the map will zoom to the new minimum.
Parameters:
Name | Type | Description |
---|---|---|
zoomLevel |
Number | The minimum zoom level to set (0-24). |
setView(gssLatLng, zoomLevel)
Sets the view of the map (geographical center and zoom) with the animation options.
Parameters:
Name | Type | Description |
---|---|---|
gssLatLng |
GSSLatLng | The position of the map to be centered. |
zoomLevel |
Number | Optional: Zoom level of the map. |
setZoom(zoomLevel)
Sets the map zoom level. Zooms out/zooms in to the zoom level.
Parameters:
Name | Type | Description |
---|---|---|
zoomLevel |
Number | The zoom level of map to be zoomed. |
zoomIn()
Increases the zoom level by default zoomDelta set. If no value is passed as a default, zoom level increases by 0.25.
zoomOut()
Deccreases the zoom level by default zoomDelta set. If no value is passed as a default, zoom level decreases by 0.25.