ZenphotoCMS 1.6.3

openStreetMap

The class for all OSM map related functionality

Table of Contents

Properties

$center  : array<string|int, mixed>
geodata array(lat,lng) Default created from an image or the images of an album.
$class  : string
Optional class name to attach to the map html
$cluster_showcoverage_on_hover  : bool
Show the bounds of a marker cluster on hover Default taken from plugin options
$clusterradius  : int
Radius when clusters should be created on more than one marker Default taken from plugin options
$defaultlayer  : array<string|int, mixed>
The tile providers to use. Select from the $tileproviders property like $this->maptiles = $this->tileproviders['<desired provider>'] Must be like array('<map provider url>','<attribution as requested>') Default taken from plugin options
$fitbounds  : array<string|int, mixed>
geodata array('min' => array(lat,lng), 'max => array(lat,lng)) Default created from an image or the images of an album.
$geodata  : array<string|int, mixed>
Contains the array of the image or images from albums geodata
$geodatajs  : array<string|int, mixed>
Contains a string presenting a Javascript array of geodata for leafletjs
$height  : string
Values like "100px" or "100em" Default taken from plugin options
$layer  : mixed
$layerscontrolpos  : string
Position of the layers controls: "topleft", "topright", "bottomleft", "bottomright" Default taken from plugin options
$layerslist  : mixed
$mapcenter  : array<string|int, mixed>
geodata array(lat,lng) Default created from the image marker or from the markers of the images of an album if in context
$mapnumber  : int
Unique number if using more than one map on a page
$markerpopup  : bool
If used on albums or several custom markers if you wish popups on the markers If using custom markers you need to provide the content for the popups withn the $geodata property Default taken from plugin options
$markerpopup_desc  : mixed
$markerpopup_thumb  : mixed
$markerpopup_title  : bool
Only if on an album page and if $imagepopups are enabled.
$maxzoom  : mixed
$minimap_height  : mixed
$minimap_width  : mixed
$minimap_zoom  : mixed
$minzoom  : mixed
$mode  : string
"single" (one marker) "cluster" (several markers always clustered) "single-cluster" (markers of the images of the current album) Default created by the $geodata property: "single "if array with one entry, "cluster" if more entries
$obj  : object
The current image or album object if not passing custom geodata
$showalbummarkers  : bool
Default false if set to true on single image maps the markers of all other images are shown as well.
$showcursorpos  : mixed
$showlayerscontrol  : bool
Show layers controls with selected layers Default taken from plugin options
$showmarkers  : mixed
$showminimap  : string
Mini map parameters
$showscale  : mixed
$tileproviders  : array<string|int, mixed>
The predefined array of all free map tile providers for Open Street Map
$width  : string
Default 100% for responsive map. Values like "100%", "100px" or "100em" Default taken from plugin options
$zoom  : int
Default zoom state Default taken from plugin options
$zoomcontrolpos  : string
Position of the map controls: "topleft", "topright", "bottomleft", "bottomright" Default taken from plugin options

Methods

__construct()  : mixed
If no $geodata array is passed the function gets geodata from the current image or the images of the current album if in appropiate context.
getAlbumGeodata()  : mixed
Gathers the map data for an album Adapted from the offical Zenphoto GoogleMap plugin by Stephen Billard (sbillard) & Vincent Bourganel (vincent3569)
getCenter()  : array<string|int, mixed>
Returns the center point of the map. On an single image it is the marker of the image itself.
getFitBounds()  : array<string|int, mixed>
Returns the bounds the map should fit based on the geodata of an image or images of an album
getGeoData()  : array<string|int, mixed>
Extracts the geodata from an image or the images of an album and creates the JS arrays for leaflet including title, description and thumb if set.
getGeoDataJS()  : string
Processes the geodata returned by getGeoData() and formats it to a string presenting a multidimensional Javascript array for use with leafletjs
getImageGeodata()  : mixed
$returns coordinate informations for an image Adapted from the offical Zenphoto GoogleMap plugin by Stephen Billard (sbillard) & Vincent Bourganel (vincent3569)
getLayersList()  : array<string|int, mixed>
It returns an array of layer option db name
getTileLayerJS()  : string
Return the map tile js definition for leaflet and its leaflet-providers plugin.
getTileProviders()  : array<string|int, mixed>
Returns an array of all defined tile provider names from and for use with leaflet-providers.js and the plugin options
printMap()  : mixed
Prints the required HTML and JS for the map
printOpenStreetMap()  : mixed
Template function wrapper for the openStreetMap class to show a map with geodata markers for the current image or collected the images of an album.
scripts()  : mixed
Assigns the needed JS and CSS
setMapTiles()  : string
It returns the provider chosen if it is valid or the default 'OpenStreetMap.Mapnik' tile

Properties

$center

geodata array(lat,lng) Default created from an image or the images of an album.

public array<string|int, mixed> $center = \NULL

$class

Optional class name to attach to the map html

public string $class = ''

$cluster_showcoverage_on_hover

Show the bounds of a marker cluster on hover Default taken from plugin options

public bool $cluster_showcoverage_on_hover = \NULL

$clusterradius

Radius when clusters should be created on more than one marker Default taken from plugin options

public int $clusterradius = \NULL

$defaultlayer

The tile providers to use. Select from the $tileproviders property like $this->maptiles = $this->tileproviders['<desired provider>'] Must be like array('<map provider url>','<attribution as requested>') Default taken from plugin options

public array<string|int, mixed> $defaultlayer = \NULL

$fitbounds

geodata array('min' => array(lat,lng), 'max => array(lat,lng)) Default created from an image or the images of an album.

public array<string|int, mixed> $fitbounds = \NULL

$geodata

Contains the array of the image or images from albums geodata

public array<string|int, mixed> $geodata = \NULL

$geodatajs

Contains a string presenting a Javascript array of geodata for leafletjs

public array<string|int, mixed> $geodatajs = \NULL

$height

Values like "100px" or "100em" Default taken from plugin options

public string $height = \NULL

$layerscontrolpos

Position of the layers controls: "topleft", "topright", "bottomleft", "bottomright" Default taken from plugin options

public string $layerscontrolpos = \NULL

$mapcenter

geodata array(lat,lng) Default created from the image marker or from the markers of the images of an album if in context

public array<string|int, mixed> $mapcenter = \NULL

$mapnumber

Unique number if using more than one map on a page

public int $mapnumber = ''

$markerpopup

If used on albums or several custom markers if you wish popups on the markers If using custom markers you need to provide the content for the popups withn the $geodata property Default taken from plugin options

public bool $markerpopup = \false

$markerpopup_thumb

public mixed $markerpopup_thumb = \false

$markerpopup_title

Only if on an album page and if $imagepopups are enabled.

public bool $markerpopup_title = \false

If the imagepopus should contain thumbs of the images Default taken from plugin options

$mode

"single" (one marker) "cluster" (several markers always clustered) "single-cluster" (markers of the images of the current album) Default created by the $geodata property: "single "if array with one entry, "cluster" if more entries

public string $mode = \NULL

$obj

The current image or album object if not passing custom geodata

public object $obj = \NULL

$showalbummarkers

Default false if set to true on single image maps the markers of all other images are shown as well.

public bool $showalbummarkers = \false

The current image's position will be highlighted.

$showlayerscontrol

Show layers controls with selected layers Default taken from plugin options

public bool $showlayerscontrol = \NULL

$showminimap

Mini map parameters

public string $showminimap = \false

$tileproviders

The predefined array of all free map tile providers for Open Street Map

public array<string|int, mixed> $tileproviders = \NULL

$width

Default 100% for responsive map. Values like "100%", "100px" or "100em" Default taken from plugin options

public string $width = \NULL

$zoom

Default zoom state Default taken from plugin options

public int $zoom = \NULL

$zoomcontrolpos

Position of the map controls: "topleft", "topright", "bottomleft", "bottomright" Default taken from plugin options

public string $zoomcontrolpos = \NULL

Methods

__construct()

If no $geodata array is passed the function gets geodata from the current image or the images of the current album if in appropiate context.

public __construct([array<string|int, mixed> $geodata = NULL ][, mixed $obj = NULL ]) : mixed

Alternatively you can pass an image or album object directly. This ignores the $geodata parameter then.

The $geodata array requires this structure: Single marker:

array( array( 'lat' => , 'long' => , 'title' => 'some title', 'desc' => 'some description', 'thumb' => 'some html' // an call or else. ) );

If you use html for title, desc or thumb be sure to use double quotes for attributes to avoid JS conflicts. For several markers add more arrays to the array.

If you neither pass $geodata, an object or there is no current image/album you can still display a map. But in this case you need to set the $center and $fitbounds properties manually before printing a map.

Parameters
$geodata : array<string|int, mixed> = NULL

Array as noted above if no current image or album should be used

$obj : mixed = NULL
Tags
global

string $_zp_gallery_page

getAlbumGeodata()

Gathers the map data for an album Adapted from the offical Zenphoto GoogleMap plugin by Stephen Billard (sbillard) & Vincent Bourganel (vincent3569)

public getAlbumGeodata( $album) : mixed
Parameters
$album :

album object

getCenter()

Returns the center point of the map. On an single image it is the marker of the image itself.

public getCenter() : array<string|int, mixed>

On images from an album it is calculated from their geodata

Return values
array<string|int, mixed>

getFitBounds()

Returns the bounds the map should fit based on the geodata of an image or images of an album

public getFitBounds() : array<string|int, mixed>
Return values
array<string|int, mixed>

getGeoData()

Extracts the geodata from an image or the images of an album and creates the JS arrays for leaflet including title, description and thumb if set.

public getGeoData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getGeoDataJS()

Processes the geodata returned by getGeoData() and formats it to a string presenting a multidimensional Javascript array for use with leafletjs

public getGeoDataJS() : string
Return values
string

getImageGeodata()

$returns coordinate informations for an image Adapted from the offical Zenphoto GoogleMap plugin by Stephen Billard (sbillard) & Vincent Bourganel (vincent3569)

public getImageGeodata( $image) : mixed
Parameters
$image :

image object

getLayersList()

It returns an array of layer option db name

public static getLayersList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTileLayerJS()

Return the map tile js definition for leaflet and its leaflet-providers plugin.

public getTileLayerJS() : string

For certain map providers it include the access credentials.

Return values
string

getTileProviders()

Returns an array of all defined tile provider names from and for use with leaflet-providers.js and the plugin options

public static getTileProviders() : array<string|int, mixed>
Return values
array<string|int, mixed>

printMap()

Prints the required HTML and JS for the map

public printMap() : mixed

printOpenStreetMap()

Template function wrapper for the openStreetMap class to show a map with geodata markers for the current image or collected the images of an album.

public static printOpenStreetMap([array<string|int, mixed> $geodata = NULL ][, string $width = NULL ][, string $height = NULL ][, array<string|int, mixed> $mapcenter = NULL ][, int $zoom = NULL ][, array<string|int, mixed> $fitbounds = NULL ][, string $class = '' ][, int $mapnumber = NULL ][, obj $obj = NULL ][, bool $minimap = false ]) : mixed

For more flexibility use the class directly.

The map is not shown if there is no geodata available.

Parameters
$geodata : array<string|int, mixed> = NULL

Array of the geodata to create and display markers. See the constructor of the openStreetMap Class for the require structure

$width : string = NULL

Width with unit, e.g. 100%, 100px, 100em

$height : string = NULL

Height with unit, e.g. 100px, 100em

$mapcenter : array<string|int, mixed> = NULL

geodata array(lat,lng);

$zoom : int = NULL

Number of the zoom 0 -

$fitbounds : array<string|int, mixed> = NULL

geodata array('min' => array(lat,lng), 'max => array(lat,lng))

$class : string = ''

Class name to attach to the map element

$mapnumber : int = NULL

If calling more than one map per page an unique number is required

$obj : obj = NULL

Image or album object to skip current image or album and also $geodata

$minimap : bool = false

True to show the minimap in the lower right corner

Tags
global

obj $_zp_current_album

global

obj $_zp_current_image

global

string $_zp_gallery_page

scripts()

Assigns the needed JS and CSS

public static scripts() : mixed

setMapTiles()

It returns the provider chosen if it is valid or the default 'OpenStreetMap.Mapnik' tile

public setMapTiles([string $tileprovider = null ]) : string
Parameters
$tileprovider : string = null

The tile provider to validate

Return values
string

        
On this page

Search results