Map
class Map
Constants
GROW_BBOX |
Grow the width or height of the specified geo bbox to fill the map size. Default behaviour. |
GROW_CANVAS |
Grow the width or height of the map to accommodate the specified geo bbox. |
SHRINK_BBOX |
Shrink the width or height of the specified geo bounding box to fill the map size. |
SHRINK_CANVAS |
Shrink the width or height of the map to accommodate the specified geo bounding box. |
ADJUST_BBOX_WIDTH |
Adjust the width of the specified geo bounding box, leave height and map size unchanged. |
ADJUST_BBOX_HEIGHT |
Adjust the height of the specified geo bounding box, leave width and map size unchanged. |
ADJUST_CANVAS_WIDTH |
Adjust the width of the map, leave height and geo bounding box unchanged. |
ADJUST_CANVAS_HEIGHT |
Adjust the height of the map, leave width and geo bounding box unchanged. |
RESPECT |
Do nothing, leave map and geo bounding box unchanged. |
Methods
Map constructor.
Load map XML from string.
Load XML map file.
Zoom in or out by a given factor. Positive number zooms in, negative number zooms out.
Set the geographical extent of the map to the combined extents of all active layers.
Set the Map center to x,y location in the coordinates of the pixmap or map surface.
Set Map center to x,y location and zoom in or out.
Set path to search for fonts used in map.
Get base path used for loading map assets.
Set base path used for loading map assets.
Get canvas width.
Set canvas width.
Get canvas height.
Set canvas height.
Resize the canvas to given height and width.
Get spatial reference system.
Set spatial reference system.
Get path to background image.
Set path to background image.
Get background image opacity. 0 is transparent, 1 is opaque.
Set background image opacity. 0 is transparent, 1 is opaque.
Get maximum extent of projected map.
Reset maximum extent.
Get current extent of projected map.
Get map bounds buffer size.
Set map bounds buffer. Used by placement detector to help avoid cutting labels.
Get extent of map with buffer applied.
Get map scale.
Get scale denominator.
Count number of map layers.
Remove a style.
Remove all styles and layers.
Get aspect fix mode.
Set aspect fix mode. See Map constants for valid values.
Details
at line 82
__construct(int $width = 400, int $height = 400, string $srs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
Map constructor.
at line 96
loadXmlString(string $xml, bool $strict = null, string $basePath = null)
Load map XML from string.
at line 106
loadXmlFile(string $file, bool $strict = null, string $basePath = null)
Load XML map file.
at line 113
zoom(float $zoom)
Zoom in or out by a given factor. Positive number zooms in, negative number zooms out.
at line 118
zoomAll()
Set the geographical extent of the map to the combined extents of all active layers.
at line 126
pan(int $x, int $y)
Set the Map center to x,y location in the coordinates of the pixmap or map surface.
at line 135
panAndZoom(int $x, int $y, float $zoom)
Set Map center to x,y location and zoom in or out.
at line 143
zoomToBox(Box2D $box)
Set the geographical extent of the map to Mapnik Box2D envelope.
at line 150
registerFonts(string $path)
Set path to search for fonts used in map.
at line 157
string
getBasePath()
Get base path used for loading map assets.
at line 164
setBasePath(string $path)
Set base path used for loading map assets.
at line 171
int
getWidth()
Get canvas width.
at line 178
setWidth(int $width)
Set canvas width.
at line 185
int
getHeight()
Get canvas height.
at line 192
setHeight(int $height)
Set canvas height.
at line 200
resize(int $width, int $height)
Resize the canvas to given height and width.
at line 208
string
getSrs()
Get spatial reference system.
at line 217
setSrs(string $srs)
Set spatial reference system.
at line 224
string
getBackgroundImage()
Get path to background image.
at line 231
setBackgroundImage(string $file)
Set path to background image.
at line 238
float
getBackgroundImageOpacity()
Get background image opacity. 0 is transparent, 1 is opaque.
at line 245
setBackgroundImageOpacity(float $opacity)
Set background image opacity. 0 is transparent, 1 is opaque.
at line 253
Box2D
getMaximumExtent()
Get maximum extent of projected map.
at line 261
setMaximumExtent(Box2D $box)
Set maximum extent of projected map.
at line 266
resetMaximumExtent()
Reset maximum extent.
at line 273
Box2D
getCurrentExtent()
Get current extent of projected map.
at line 280
int
getBufferSize()
Get map bounds buffer size.
at line 287
setBufferSize(int $bufferSize)
Set map bounds buffer. Used by placement detector to help avoid cutting labels.
at line 294
Box2D
getBufferedExtent()
Get extent of map with buffer applied.
at line 302
float
getScale()
Get map scale.
at line 310
float
getScaleDenominator()
Get scale denominator.
at line 317
int
countLayers()
Count number of map layers.
at line 324
removeStyle(string $styleName)
Remove a style.
at line 329
removeAll()
Remove all styles and layers.
at line 337
int
getAspectFixMode()
Get aspect fix mode.
at line 354
setAspectFixMode(int $aspectFixMode)
Set aspect fix mode. See Map constants for valid values.