Shareloc - the free and open map API based on OpenLayers (Version 0.9.0)

Idea and development by
meggsimum

Shareloc

The Shareloc object provides a namespace for all elements of Shareloc

Shareloc.ApiCreatorApp

Application for the GUI based creation of Shareloc permalinks.

Shareloc.Layers

The class holding the layer configuration object. Also offers functions to access the layer objects of Shareloc.

Loads the JSON configuration stored at conf/layers.json

Shareloc.MapApi

This class represents the Shareloc map API.

It offers functions to create a customized OpenLayers map with a base layer by config as well as functions to add a marker and a popup to the map.

map(config)

Creates an OpenLayers map object by the given configuration object and renders it to a DIV with the ID 'map' in the DOM.

Configuration must be in the format:

  {
    X: 8.318049976895958,
    Y: 49.43451657605041,
    zoom: 14,
    bgLayer: "opentopomap",
    marker: "49.43707328904662,8.306307792663572",
    popupText: "foo-popup-text"
  }

parameter type description
config Object

the configuration object for the map

Returns

ol.Map :

the created OpenLayers map

marker(markerPosString)

Creates a marker feature on the map at the given position.

The position must be a comma separated String containing lat and lon, e. g. "49.43707328904662,8.306307792663572"

parameter type description
markerPosString String

the position where the marker is drawn

Returns

ol.Feature :

the created OpenLayers marker feature

markerPopup(markerFeat, popupText)

Creates a popup at the given feature's position

parameter type description
markerFeat ol.Feature

the marker feature to bin the popup to

popupText String

the text to be shown in the popup

VERSION

The current version of Shareloc