new cercalia.Map(options)
| Name | Type | Description |
|---|---|---|
options |
cercaliax.MapOptions |
Map options |
Members
-
overlayLoading
-
"Loading" overlay, blocks the map use
Methods
-
addControl(control)
-
Add a control in the map, by parameter
Name Type Description controlcercalia.Control -
addFeature(feature, layer)
-
Paint
cercalia.Featureon the map.Name Type Description featurecercalia.Feature layerol.Layer | undefined optional -
addFeatures(features, layer)
-
Paint several
cercalia.Featureon the map. Must send anArray.Name Type Description featuresArray.<cercalia.Feature> Array de
cercalia.Featurelayerol.layer -
addLayer(layer, position)
-
Adds a layer
ol.layer.Layerspecifying the position (optional). The layers are declarated in an array and the Z value works from less to more. The Layer basemap (map), is fixed in the first position 0.
If you need to change the baseLayer, change it to position 1 or remove the baseLayer.Name Type Description layerol.layer positionnumber -
addLinestring(linestring)
-
Paint
cercalia.Linestringon the mapName Type Description linestringcercalia.Linestring -
addLinestrings(linestrings)
-
Paint on the map the
cercalia.Linestringlist. In this function must send anArray.Name Type Description linestringsArray.<cercalia.Linestring> -
addMarker(marker)
-
Paint
cercalia.Markerlist on the map.Name Type Description markercercalia.Marker -
addMarkers(markers)
-
Paint on the map the
cercalia.Markerlist. In this function must send anArray.Name Type Description markersArray.<cercalia.Marker> -
addWMSLayer(wmsLayer, position)
-
Adds a WMS layer
cercalia.WMSto the mapName Type Description wmsLayercercalia.WMS positionnumber WMSLayer position. If not declared, it's included just one level over the basemap.
-
boundsInsidePolygon_(bounds, polygon){boolean}
-
Check if bounds are inside a WKT polygon
Name Type Description boundscercalia.Bounds Map bounds
polygonstring WKT Polygon
Returns:
True if inside
-
centerToFeatures(features, changeZoom, animation)
-
Center the map
Name Type Description featuresArray.<cercalia.Feature> | cercalia.Feature Features list or object.
changeZoomnumber Change zoom on features center. Default: true
animationboolean Animation. Default: true
-
centerToMarkers(markers, changeZoom, animation)
-
Centers the map with animation (or not) to the markers list. Optionally it's possible to change the zoom for including all the markers. If markers array is not specified, by default centers to all markers
Name Type Description markersArray.<cercalia.Marker> | undefined optional changeZoomboolean Default: true
animationboolean Default: true
-
clearCercaliaServices()
-
Resets services
-
closePopups()
-
Close all popups opened
-
coordToPixel(lonLat){ol.Pixel}
-
Returns the pixel value from a coordinate
Name Type Description lonLatcercalia.LonLat -
createContextMenuOption(buttonName, clickFunction, id)
-
Add a new option in context menu, adding a function on click to this option.
Name Type Description buttonNamestring Text to show in the neu context menu option
clickFunctionfunction Function to call linked to new button
idstring Option's identifier.
-
createTopBar(){Element}
-
Create topbar
-
createWMSPOIs(categories)
-
Create a WMS POIs layer, specifying the categories to be painted.
Contact with Nexus Geografics for additional information and use.Name Type Description categoriesArray.<string> | string -
deactivateControls()
-
Disable the active controls
-
destroy()
-
Destroy function
-
disableClustering()
-
Disable markers clustering. Every marker will be painted singly, with its icon.
-
disableDrawInteraction()
-
Disable the painting status
-
enableClustering(distance, clickFunction, mouseOverFunction, doubleClickFunction, mouseOutFunction)
-
Enable markers clustering. Note: When clustering is enabled drag markers won't work.
Name Type Default Description distancenumber | undefined 40 optional Distance, in pixels, to group markers with clusters. Default value: 40.
clickFunctionfunction | undefined optional Call function on cluster click.
Parameters avaliable (clusterFeature, features).
First parameter it's an objectol.Featurevisible on map as a cluster,
Second parameter it's acercalia.Markerarray objects with the features contained in a cluster.mouseOverFunctionfunction | undefined optional Call function on cluster mouseover. Same parameters used in 'clickFunction' event
doubleClickFunctionfunction | undefined optional Call function on double click on cluster.
Parameters avaliable (clusterFeature, features).mouseOutFunctionfunction | undefined optional Call function on cluster mouseout. Same parameters used in 'clickFunction' event
-
enableDrawInteraction(type, dragFeatures, styles, drawEndFunction)
-
Enable the painting status. The features can be draggables, changing the features styles.
Name Type Description typestring Type
[Point|LineString|Polygon|Circle]dragFeaturesboolean | undefined optional Boolean.
trueorfalse.stylesObject | undefined optional JS object with the style values:
[strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity, radius]. For example:{strokeColor:'#ff0000',fillColor:'#00ff00',radius:5,fillOpacity:0.5}drawEndFunctionfunction | undefined optional Call function when user finish drawing the feature. Send the same feature painted
-
enableFeatureEditable(enable)
-
Set the features as editables if it isn't, or change to not editable if it's editable.
Name Type Description enableboolean Set on/off the editable mode.
-
exportPNG(filename)
-
Export PNG image
Name Type Description filenamestring | undefined optional -
fitBounds(bounds, animation)
-
Fit the bounds: change the current map bounds to new bounds. By default applies animation effect
Name Type Description boundscercalia.Bounds New bounds
animationboolean True/False, if want to apply animation or not. Default: true
-
geolocation(callbackFn)
-
Obtains the geocode at the API access point It is possible to declare a callback function, to be executed when obtains the geocode. When callback function is not avaliable, the map is centered to API access point.
Name Type Description callbackFnfunction -
getBaseLayer(){ol.layer.Tile}
-
Returns the layer (ol.layer.Tile) used as basemap
-
getBounds(){cercalia.Bounds}
-
Returns the current bounds
Returns:
Current bounds, according to the zoom level, position and widht-height
-
getCenter(){cercalia.LonLat}
-
Returns the map center.
Returns:
Coordinates.
-
getClass(){string}
-
Returns:
Object ClassName. Value:cercaila.Map.
-
getClosestFeature(position){cercalia.Feature}
-
Name Type Description positioncercalia.LonLat Returns:
Nearest feature to coordinate
-
getClosestMarker(position){cercalia.Marker}
-
Name Type Description positioncercalia.LonLat Returns:
Nearest marker to coordinate
-
getContextMenuOverlay(){ol.Overlay}
-
-
getControlsByName(controlName){ol.Control}
-
Obtains the map control from its name. Complete controls list (if are created):
cercalia.MapControls.CleanControlcercalia.MapControls.DragControlcercalia.MapControls.DrawControlcercalia.MapControls.FullScreencercalia.MapControls.LayerSwitchercercalia.MapControls.Logisticscercalia.MapControls.MeasureControlcercalia.MapControls.MeteoControlcercalia.MapControls.RotateNorthcercalia.MapControls.ScaleLinecercalia.MapControls.StreetViewcercalia.MapControls.Trafficcercalia.MapControls.Zoomcercalia.MapControls.ZoomSlider
Name Type Description controlNamestring -
getDragInteraction(){ol.interaction.DragInteraction}
-
Returns the drag interaction.
-
getDrawInteraction(){ol.interaction.DrawInteraction}
-
Returns the draw interaction.
-
getDrawLayer(){ol.layer.Vector}
-
Returns the layer (
ol.layer.Vector) used for painting on the map.Returns:
layer
-
getEventCoordinate(evt){cercalia.LonLat}
-
Name Type Description evtevent -
getEventPixel(evt){Pixel}
-
Obtains pixel
Name Type Description evtevent -
getFeatures(){Array.<cercalia.Linestring>|null}
-
Obtain all the
cercalia.Featurepainted on the mapReturns:
Linestring list painted on the map
-
getId(){string}
-
Returns the map internal ID.
Returns:
map internal ID.
-
getInteractionDrag(){cercalia.Interaction.DragFeatures}
-
Returns:
dragInteraction
-
getLayerByName(layerName){ol.layer}
-
Name Type Description layerNamestring Returns:
Layer objeto ol3
-
getLayerIndexByName(layerName){number}
-
Obtains the layer position (Z value). The layers are painted respecting Z position: 0 is the base map.
Name Type Description layerNamestring Returns:
Layer position
-
getLinestrings(){Array.<cercalia.Linestring>|null}
-
Obtain all the
cercalia.Linestringpainted on the mapReturns:
Linestrings list painted on the map
-
getMainMenu(){cercalia.widget.MainMenu}
-
Returns:
Returns the reference tocercalia.widget.MainMenu
-
getMap(){ol.Map}
-
Returns the OpenLayers3 object
ol.MapReturns:
Map
-
getMarkerById(){cercalia.Marker}
-
Returns:
marker
-
getMarkers(){Array.<cercalia.Marker>|null}
-
Obtain all the
cercalia.Markerpainted on the mapReturns:
Marker list painted on the map
-
getOverlappedMarkers(currentExtentView, tolerance){Array.<Array.<cercalia.Marker>>}
-
Get Overlapped markers
Name Type Description currentExtentViewboolean | undefined optional If
truereturns only visible markers at the moment, if notnullorfalseit returns all markerstoleranceboolean | undefined optional Tolerance in meters.
-
getProjectionCode(){string}
-
Obtains the map projection code
Returns:
EPSG code. For example:EPSG:3857.
-
getRightClickMenuOptions(){array.<string>}
-
Returns:
return rightClick menu options.
-
getRouteMap(){cercalia.RouteMap}
-
Returns:
routeMap
-
getScaleUnits()
-
Returns:
scale units. Valuesmetricorimperial
-
getViewOptions(){Object}
-
Returns:
View options from cercalia map.
-
getZoom(){number}
-
Returns:
Current zoom level of map.
-
hideAllControls()
-
Hide all controls
-
hideLabels()
-
Hide all labels
cercalia.Labelfrom markers painted on the map -
hideLoading()
-
Hide "Loading..."
-
openContextMenu(lonLat)
-
Open the context menu at the coordinates specified by parameters. If not specified, opens the context menu in the map center according to the current position.
Name Type Description lonLatcercalia.LonLat | undefined optional Coordinate
-
openPopups()
-
Show all markers popups. Only for markers with popup created
-
overlapMarkers()
-
Separate overlapped markers when its have same position.
-
panTo(lonLat, animation, duration)
-
Moves the map to the new center. Optional: animation effect-
Name Type Description lonLatcercalia.LonLat Coordinate
animationstring Boolean animation effect. Values
trueorfalse, specifying the type of animation:cercalia.MapAnimation.ROTATE_LEFT,cercalia.MapAnimation.ROTATE_RIGHT,cercalia.MapAnimation.PAN,cercalia.MapAnimation.ELASTIC,cercalia.MapAnimation.BOUNCE,cercalia.MapAnimation.FLY,cercalia.MapAnimation.SPIRALdurationnumber Animation duration (in miliseconds). Defaulf
2000. -
panToBounds(bounds, animation, duration)
-
Map center maintaining the zoom level
Name Type Description boundscercalia.Bounds Mapbounds.
animationboolean Boolean for apply or not animation effect. Values:
trueorfalse.durationnumber Animation duration (in miliseconds). Default
2000. -
pixelsToMeters(pixels){number}
-
Calculate the real distance in meters, from pixels values.
Name Type Description pixelsnumber Returns:
meters
-
pixelToCoord(pixel){cercalia.LonLat}
-
Returns the coordinate from a pixel value
Name Type Description pixelol.Pixel Returns:
Coordinate
-
removeAllFeatures()
-
Clean all features
-
removeAllLinestrings()
-
Clean all linestrings
-
removeAllMarkers()
-
Clean all markers and popups
-
removeAllOverlays()
-
Clean all overlays painted on the map
-
removeApiMarkers(markers)
-
Remove API markers list from map
Name Type Description markerscercalia.Marker | Array.<cercalia.Marker> -
removeApiRoute()
-
- Deprecated
- deprecated function, equivalent: map.getRouteMap().removeRoute();
-
removeDrawFeatures()
-
Clean all the features painted on the map with draw tool. Layer 'DrawLayer'
-
removeFeatures(features, layer)
-
Remove features list from map
Name Type Description featurescercalia.Feature | Array.<cercalia.Feature> layerol.Layer | undefined optional If not defined it will remove features in internal Cercalia layer.
-
removeLayer(layer)
-
Clean the layer specified by parameter
Name Type Description layerol.layer -
removeLinestrings(linestrings)
-
Remove linestring list from map
Name Type Description linestringscercalia.Linestring | Array.<cercalia.Linestring> -
removeMarkers(markers)
-
Remove markers list from map
Name Type Description markerscercalia.Marker | Array.cercalia.Marker -
removeWMSLayer(wmsLayer)
-
Remove a WMS layer
cercalia.WMSfrom the mapName Type Description wmsLayercercalia.WMS -
removeWMSPOIs()
-
Clean POIs layers, if painted
-
rotate(angle)
-
Rotates the map
degrees, by parameter Name Type Description anglenumber Angle (degrees).
-
setBaseLayer(mapType)
-
Name Type Description mapTypestring | cercalia.WMS | ol.layer.Layer | ol.layer.Group Change base map.
Maps avaliable by default. String:cercalia.MapTypes.CERCALIACercaliacercalia.MapTypes.OSMCercaliacercalia.MapTypes.SATELLITEcercalia.MapTypes.HYBRID
Also can use a WMS layer (object cercalia.WMS), that will be set as base Layer. Also can add layers using OpenLayers classesol.layer.Layeryol.layer.Group.
-
setCenter(lonLat, zoom, animation)
-
Set the map center
Name Type Description lonLatcercalia.LonLat Coordinates
zoomnumber Zoom
animationboolean | undefined optional Animation, activated by default
-
setDefaultClick(func)
-
Name Type Description funcfunction | undefined optional Function
-
setFeatureEditable(feature, edit)
-
Set feature editable.
Name Type Description featurecercalia.Feature Feature to be edited.
editboolean Set the feature as editable or not.
-
setProjection(projection)
-
Changes the projection to basemap and all the layers painted over it (markers, features, WMS, etc).
Name Type Description projectionol.Projection Projection.
-
setRestrictedView(minZoom, maxZoom, bounds)
-
Fixes the minimum and maximum zoom level
Name Type Description minZoomnumber | boolean Min zoom, false if don't want this limit
maxZoomnumber | boolean Max zoom, false if don't want this limit
boundscercalia.Bounds Map bounds limits
-
setRightClickMenuOptions(Set)
-
Name Type Description Setarray.<string> rightClick menu options.
-
setRotation(angle)
-
Sets the map rotation
Name Type Description anglenumber -
setRouteMap(routeMap)
-
Name Type Description routeMapcercalia.RouteMap -
setZoom(zoom, animation)
-
Set the zoom level of map. If second parameter is specified (boolean, optional), can apply animation effect
Name Type Description zoomnumber Zoom level to adjust
animationboolean True/False if want to apply animation effect. Defaulf: true
-
showAllControls()
-
Show all controls
-
showingLabels(){Boolean}
-
Returns boolean showing if all labels are showing or hidden.
-
showLabels()
-
Show all labels
cercalia.Labelfrom markers painted on the map -
showLoading()
-
Shows "Loading..."
-
showMarkers(markers, show)
-
Show the markers painted on the map. This function is usefull when some or all markers are hidden.
Name Type Description markerscercalia.Marker | Array.<cercalia.Marker> showboolean