Documentation

Map
in package

Represents a raster or vector map to be stored in a cache.

Tags
author

zozlak

Table of Contents

Constants

TIME_FORMAT  = 'Y-m-d H:i:s'

Properties

$checkDate  : string
$localDate  : string
$remoteDate  : string
$reqDate  : string
$size  : int
$storageDir  : string
$type  : string
$url  : string
$baseUrl  : string
$mimeTypes  : array<string, array<string|int, string>>
$remoteFileInfo  : RemoteFileInfo
$templates  : array<string, string>

Methods

__construct()  : mixed
fetch()  : void
Initialized the map object from a given ARCHE resource
getGeodata()  : object
Returns various geodata of an already cached map.
getLocalPath()  : string
Returns map path in the local cache
getName()  : string
Returns mapserver, WMS & WFS safe map name.
getUrl()  : string
Returns base mapserver URL for a given map (the URL ends with an &)
init()  : void
Initializes the class by setting up the templates.
refresh()  : bool
Checks if the local copy is up to date and if not, fetches the latest version.
touch()  : void
Sets the map last requested date to the current time.
copy()  : void
Copies remote map file to the local cache
getRasterGeodata()  : object
getRemoteFileInfo()  : RemoteFileInfo
Fetches remote map file metadata (modification time, type, exact location)
getVectorGeodata()  : object

Constants

TIME_FORMAT

public mixed TIME_FORMAT = 'Y-m-d H:i:s'

Properties

$checkDate

public string $checkDate = '1900-01-01 00:00:00'

$localDate

public string $localDate

$remoteDate

public string $remoteDate

$reqDate

public string $reqDate

$size

public int $size

$storageDir

public string $storageDir

$type

public string $type

$url

public string $url

$baseUrl

private static string $baseUrl

$mimeTypes

private static array<string, array<string|int, string>> $mimeTypes = ['raster' => ['image/tiff', 'image/jpeg', 'image/png', 'image/jp2'], 'vector' => ['application/vnd.geo+json', 'application/json', 'application/vnd.google-earth.kml+xml', 'application/gml+xml', 'application/geo+json']]

$templates

private static array<string, string> $templates

Methods

__construct()

public __construct(string $storageDir, string $url[, object|null $data = null ]) : mixed
Parameters
$storageDir : string

directory in which cached maps are stored

$url : string
$data : object|null = null

initial map object property values

fetch()

Initialized the map object from a given ARCHE resource

public fetch() : void

getGeodata()

Returns various geodata of an already cached map.

public getGeodata() : object
Return values
object

getLocalPath()

Returns map path in the local cache

public getLocalPath() : string
Return values
string

getName()

Returns mapserver, WMS & WFS safe map name.

public getName() : string

Strips all parts of the URI up to the last part of the path.

Makes sure the rest starts with a letter (if not, a "map_" prefix is added) and doesn't contain spaces (they are converted to underscores)

Return values
string

getUrl()

Returns base mapserver URL for a given map (the URL ends with an &)

public getUrl() : string
Return values
string

init()

Initializes the class by setting up the templates.

public static init(string $rasterTmplFile, string $vectorTmplFile, string $baseUrl) : void
Parameters
$rasterTmplFile : string

mapserver's map file template for raster maps

$vectorTmplFile : string

mapserver's map file template for vector maps

$baseUrl : string

mapserver's base URL (see https://mapserver.org/de/ogc/wms_server.html#setup-a-mapfile-for-your-wms

  • the wms_onlineresource config parameter description)

refresh()

Checks if the local copy is up to date and if not, fetches the latest version.

public refresh(int $keepAlive, LoggerInterface $log) : bool

Returns true if refresh was done and false if it wasn't needed.

Parameters
$keepAlive : int

maximum number of seconds beetween checking corresponding Fedora resources state

$log : LoggerInterface
Return values
bool

touch()

Sets the map last requested date to the current time.

public touch() : void

copy()

Copies remote map file to the local cache

private copy(string $from) : void
Parameters
$from : string

file to copy from (can be an URL)

getRasterGeodata()

private getRasterGeodata(object $d) : object
Parameters
$d : object
Return values
object

getRemoteFileInfo()

Fetches remote map file metadata (modification time, type, exact location)

private getRemoteFileInfo() : RemoteFileInfo
Return values
RemoteFileInfo

getVectorGeodata()

private getVectorGeodata(object $d) : object
Parameters
$d : object
Return values
object

        
On this page

Search results