GeoMOOSE

Parent namespace for all GeoMOOSE classes.

Summary
GeoMOOSEParent namespace for all GeoMOOSE classes.
Functions
splitPathsSplits paths in a GeoMOOSE path string (split by ‘:’)
errorDisplay an error to the user.
warningSimilar to error, but with less severity.
registerMapSourceTypeRegisters a Class to a GeoMOOSE class type Parameters: map_source_type - The map-source type from the Mapbook.
getMapSourceTypeGet the class for a given layer type Parameters: map_source_type - The map-source type from the Mapbook.
asArrayConverts parameter to an array.
configureMapSourceParses a map-source XML fragment and adds it to the map.
changeLayerVisibilityTurn a layer on or off.
turnLayerOn.Turns on some layers.
turnLayerOff.Turns off some layers.
refreshLayersForce some layers to redraw.
isEditableChecks to see if a MapSource is editable.
getLayerUrlGet the base URL for a given layer.
changeLayerUrlChange the base URL for a given layer.
updateLayerParametersChange the params for a given layer.
updateLayerFilterChange the filter for a given layer.
getLayerParametersGet the params for a given layer.
getLayerOpacityGet the client-side Opacity parameter setting.
setLayerOpacitySet the client-side Opacity parameter setting.
clearLayerParametersClears all the user set parameters from a MapSource.
getVisibleLayersGet the list of currently visible layer paths.
getExtentGet the map’s extent as an array.
getScaleReturn the map’s current scale.
inScaleCheck whether a given min/maxscale is within the current scale.
moveLayerUpMove’s a layer up on the visibility stack.
moveLayerDownMove’s a layer down on the visibility stack.
fadeLayerFade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.
unfadeLayerUn-Fade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.
startServiceStart a service with some given parameters
changeTabChange to a tab given by tabName
zoomToPointZoom to a point and a buffer
zoomToExtentZoom to an extent
addPopupAdd a popup to the map.
addPopupGroundAdd a popup to the map.
clearPopupsRemove all popups from the map.
processTemplateA low-cost, built-in template utility for GeoMOOSE.
getBookmarkUrlGet an URL for bookmarking.
getUrlParametersParses URL parameters and returns a hash.
bookmarkChange the URL to be something bookmarkable.
registerRegister an event with GM_Events.
idGenerates an unique ID
addTabAdd a new GeoMOOSE.Tab instance to the tab bar.
getTabRecall a tab that has been added with addTab.
closeTabClose a tab by the name.
removeTabRemoves a tab from the internal list, but not the user interface.
selectTabBring a tab to the forefront.
getLegendUrlsReturns an array of legend URLs for a given set of paths.
isDefinedCheck for the null condition in a variable.
activateMapSourceSet the active map source.
deactivateMapSourceSets the active map source to null and turns off the controls on any active map source.
getActiveMapSourceGets the active map source.
saveChanges
zoomToPointsListZooms to the bounding box of a points list.
convertLengthConvert a number from one denomination to another.
downloadOffers a download dialog for the php/download.php script.
zoomToLonLatZooms to a specified lon, lat.
deactivateToolsTurn off all current tools, including layer tools.
activateLayerToolActivates a layer tool
activateDefaultToolThis is a bit of a “pull the ‘chute” call.
parseBooleanInputs a string and outputs a boolean.
commifyNumberConvert a number into a string that is comma delimited.
stripCommasRemove the commas from a number.

Functions

splitPaths

splitPaths : function(layerPaths)

Splits paths in a GeoMOOSE path string (split by ‘:’)

Parameters

layerPathsString of GeoMOOSE paths delimited by “;”.

error

error: function()

Display an error to the user.  This is preferable over console.error or console.log as we can start to make browser neutral and increasingly user-friendly delivery.

Parameters

Takes in the entire argument list similiar to console.log

warning

warning: function()

Similar to error, but with less severity.

registerMapSourceType

registerMapSourceType: function(map_source_type,
js_class)

Registers a Class to a GeoMOOSE class type Parameters: map_source_type - The map-source type from the Mapbook. js_class - The class reference.

getMapSourceType

getMapSourceType: function(map_source_type)

Get the class for a given layer type Parameters: map_source_type - The map-source type from the Mapbook.

asArray

asArray: function(layer_list)

Converts parameter to an array.

Parameters

layer_listMisnomer, really, it’s “var” and then returns an array if it’s not one already.

configureMapSource

configureMapSource: function(map_source_xml)

Parses a map-source XML fragment and adds it to the map.  Important: this does not add anything to the catalog!

Parameters map_source_xml - The <map-source> xml node

changeLayerVisibility

changeLayerVisibility : function(layerPaths,
visibility)

Turn a layer on or off.  Parameters: layerPaths - The full GeoMOOSE layer path.  (ex. my_wms/my_layer)

turnLayerOn.

Turns on some layers.

Parameters

layerPathsThe list of layers.

turnLayerOff.

Turns off some layers.

Parameters

layerPathsThe list of layers.

refreshLayers

refreshLayers : function(layerNames)

Force some layers to redraw.

Parameters

layerNamesList of layers to redraw.

isEditable

isEditable: function(source)

Checks to see if a MapSource is editable.

Parameters

sourceThe map source.

getLayerUrl

getLayerUrl : function(layerName)

Get the base URL for a given layer.

Parameters

layerNameThe name of the layer to find.

changeLayerUrl

changeLayerUrl : function(layerName,
url)

Change the base URL for a given layer.

Parameters

layerNameThe name of the layer to find.
urlThe URL to change to.

updateLayerParameters

updateLayerParameters : function(layerName,
paramObject)

Change the params for a given layer.

Parameters

layerNameThe name of the layer to find.
paramObjectA hash of the parameters.

updateLayerFilter

updateLayerFilter: function(layerName,
filterText)

Change the filter for a given layer.

getLayerParameters

getLayerParameters : function(layerName)

Get the params for a given layer.

Parameters

layerNameThe name of the layer to find.

Returns

The parameters, in a hash.

getLayerOpacity

getLayerOpacity : function(layerName)

Get the client-side Opacity parameter setting.

Parameters

layerNameThe layername.

Returns

A floating point number represeting the opacity (0-100)

setLayerOpacity

setLayerOpacity: function(layerName,
opacity)

Set the client-side Opacity parameter setting.

Parameters

layerNameThe layername.
opacity0-100, percentage of visibility.

clearLayerParameters

clearLayerParameters: function(layerName)

Clears all the user set parameters from a MapSource.

Parameters

layerNameThe Layername.

getVisibleLayers

getVisibleLayers : function()

Get the list of currently visible layer paths.

Parameters

None

Returns

A list of layer names.

getExtent

getExtent: function()

Get the map’s extent as an array.

Returns

An array with [minx,miny,maxx,maxy]

getScale

getScale: function()

Return the map’s current scale.

Returns

Floating point of the map’s scale.

inScale

inScale: function(minscale,
maxscale)

Check whether a given min/maxscale is within the current scale.

moveLayerUp

moveLayerUp: function(path)

Move’s a layer up on the visibility stack.

Parameters

paththe layer path.

moveLayerDown

moveLayerDown: function(path)

Move’s a layer down on the visibility stack.

Parameters

paththe layer path.

fadeLayer

fadeLayer: function(path)

Fade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.

Parameters

paththe layer path.

unfadeLayer

unfadeLayer: function(path)

Un-Fade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.

Parameters

paththe layer path.

startService

startService : function(serviceName,
settingsObj,
forceStart)

Start a service with some given parameters

Parameters

serviceNameThe service to call.
settingsObjA hash of settings to pass to the service.  The keys in the hash should match the names of inputs in the service definition from the Mapbook.
forceStartWhen true, the service will start, ignoring any user input requirements.

changeTab

changeTab : function(tabName)

Change to a tab given by tabName

Parameters

tabNameA name of a tab.

zoomToPoint

zoomToPoint : function(x,
y,
buffer)

Zoom to a point and a buffer

Parameters

xX coordinate.
yY coordinate.
bufferBuffer in ground units.

zoomToExtent

zoomToExtent : function(minx,
miny,
maxx,
maxy,
projection)

Zoom to an extent

Parameters

minxMinimum X-bound.
minyMinimum Y-bound.
maxxMaximum X-bound.
maxxMaximum Y-bound.
projectionOptional projection.  When unspecified, assumes map coordinates.

addPopup

addPopup : function(x,
y,
w,
h,
html,
title)

Add a popup to the map.

Parameters

xX-coordinate to place the popup.
yY-coordinate to place the popup.
wDeprecated.  The width of the popup.
hDeprecated.  The height of the popup.
htmlThe contents of the popup.
titleThe title of the popup

addPopupGround

addPopupGround : function(easting,
northing,
html,
title)

Add a popup to the map.

Parameters

eastingeasting (or lon) coordinate to place the popup.
northingnorthing (or lat) coordinate to place the popup.
htmlThe contents of the popup.
titleThe title of the popup

clearPopups

clearPopups : function()

Remove all popups from the map.

processTemplate

processTemplate : function (template,
replace_dict)

A low-cost, built-in template utility for GeoMOOSE.  Takes in a string and replace all “%name%” instances with their appropriate values from replace_dict.  Example: GeoMOOSE.processTemplate(“Hello, %name%!”, {‘name’ : ‘World’}); will return the ubiquitous “Hello, World”.

Parameters

templateString containining “%...%”’s to be replaced.
replace_dictA hash/object containing the replacement values.

Returns

A string with the values substituted.

getBookmarkUrl

getBookmarkUrl: function()

Get an URL for bookmarking.

getUrlParameters

getUrlParameters: function()

Parses URL parameters and returns a hash.

bookmark

bookmark: function()

Change the URL to be something bookmarkable.  Warning!  Sets document.location!

register

register: function(event_type,
ref_obj,
func)

Register an event with GM_Events.

Parameters

event_typeName of the event.
ref_objA reference object.  Sets the scope for “func”.
funcThe function to call when the event is triggered.

id

id: function()

Generates an unique ID

addTab

addTab: function(tab_name,
tab)

Add a new GeoMOOSE.Tab instance to the tab bar.  Parameters: tab_name - Internal controllable name for the tab. tab - The dijit Object being added.

getTab

getTab: function(tab_name)

Recall a tab that has been added with addTab.

closeTab

closeTab: function(tab_name)

Close a tab by the name.

removeTab

removeTab: function(tab_name)

Removes a tab from the internal list, but not the user interface.

selectTab

selectTab: function(tab_name)

Bring a tab to the forefront.

Parameters

tab_nameName of the tab to bring to the front.

getLegendUrls

getLegendUrls: function(layer_paths)

Returns an array of legend URLs for a given set of paths.

Parameters

layer_pathsGeoMOOSE Paths

isDefined

isDefined: function(v)

Check for the null condition in a variable.

activateMapSource

activateMapSource: function(name)

Set the active map source.

Parameters

nameThe name of the mapsource to activate.

deactivateMapSource

Sets the active map source to null and turns off the controls on any active map source.

getActiveMapSource

getActiveMapSource: function()

Gets the active map source.

Returns

A GeoMOOSE.MapSource class representing the current active map class, or null if none is active.

saveChanges

saveChanges: function(name)

Parameters

nameMapSource name to save.

zoomToPointsList

zoomToPointsList: function(points_list,
projection)

Zooms to the bounding box of a points list.

Parameters

points_litsString formatted as “X Y, X Y, X Y”
projectionMapServer’s [shpxy proj=] is broken, this allows for client-side reprojection.

convertLength

convertLength: function(length,
src_units,
dest_units)

Convert a number from one denomination to another.

download

download: function(id,
extension)

Offers a download dialog for the php/download.php script.

zoomToLonLat

_latLongProj: null, zoomToLonLat: function(lon,
lat)

Zooms to a specified lon, lat.

deactivateTools

deactivateTools: function()

Turn off all current tools, including layer tools.

activateLayerTool

activateLayerTool: function(action,
kwargs)

Activates a layer tool

activateDefaultTool

activateDefaultTool: function()

This is a bit of a “pull the ‘chute” call.  Starts up the pan tool.  In the future this needs to be more configurable.

parseBoolean

function parseBoolean(bool,
def)

Inputs a string and outputs a boolean.

Parameters

boolThe bit to parse.
defThe default value in case of an undefined value.

commifyNumber

function commifyNumber(number)

Convert a number into a string that is comma delimited.  TODO: Replace this with an internationalized friendly function.

Parameters

numberThe number to commify

stripCommas

function stripCommas(v)

Remove the commas from a number.  TODO: Again, more international version of this.  (e.g. the Europeans use “,” as the decimal point)

Parameters

vThe string number with commas.
splitPaths : function(layerPaths)
Splits paths in a GeoMOOSE path string (split by ‘:’)
error: function()
Display an error to the user.
warning: function()
Similar to error, but with less severity.
registerMapSourceType: function(map_source_type,
js_class)
Registers a Class to a GeoMOOSE class type Parameters: map_source_type - The map-source type from the Mapbook.
getMapSourceType: function(map_source_type)
Get the class for a given layer type Parameters: map_source_type - The map-source type from the Mapbook.
asArray: function(layer_list)
Converts parameter to an array.
configureMapSource: function(map_source_xml)
Parses a map-source XML fragment and adds it to the map.
changeLayerVisibility : function(layerPaths,
visibility)
Turn a layer on or off.
refreshLayers : function(layerNames)
Force some layers to redraw.
isEditable: function(source)
Checks to see if a MapSource is editable.
getLayerUrl : function(layerName)
Get the base URL for a given layer.
changeLayerUrl : function(layerName,
url)
Change the base URL for a given layer.
updateLayerParameters : function(layerName,
paramObject)
Change the params for a given layer.
updateLayerFilter: function(layerName,
filterText)
Change the filter for a given layer.
getLayerParameters : function(layerName)
Get the params for a given layer.
getLayerOpacity : function(layerName)
Get the client-side Opacity parameter setting.
setLayerOpacity: function(layerName,
opacity)
Set the client-side Opacity parameter setting.
clearLayerParameters: function(layerName)
Clears all the user set parameters from a MapSource.
getVisibleLayers : function()
Get the list of currently visible layer paths.
getExtent: function()
Get the map’s extent as an array.
getScale: function()
Return the map’s current scale.
inScale: function(minscale,
maxscale)
Check whether a given min/maxscale is within the current scale.
moveLayerUp: function(path)
Move’s a layer up on the visibility stack.
moveLayerDown: function(path)
Move’s a layer down on the visibility stack.
fadeLayer: function(path)
Fade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.
unfadeLayer: function(path)
Un-Fade out the opacity by CONFIGURATION.layer_controls.fade.change_percent.
startService : function(serviceName,
settingsObj,
forceStart)
Start a service with some given parameters
changeTab : function(tabName)
Change to a tab given by tabName
zoomToPoint : function(x,
y,
buffer)
Zoom to a point and a buffer
zoomToExtent : function(minx,
miny,
maxx,
maxy,
projection)
Zoom to an extent
addPopup : function(x,
y,
w,
h,
html,
title)
Add a popup to the map.
addPopupGround : function(easting,
northing,
html,
title)
Add a popup to the map.
clearPopups : function()
Remove all popups from the map.
processTemplate : function (template,
replace_dict)
A low-cost, built-in template utility for GeoMOOSE.
getBookmarkUrl: function()
Get an URL for bookmarking.
getUrlParameters: function()
Parses URL parameters and returns a hash.
bookmark: function()
Change the URL to be something bookmarkable.
register: function(event_type,
ref_obj,
func)
Register an event with GM_Events.
id: function()
Generates an unique ID
addTab: function(tab_name,
tab)
Add a new GeoMOOSE.Tab instance to the tab bar.
getTab: function(tab_name)
Recall a tab that has been added with addTab.
closeTab: function(tab_name)
Close a tab by the name.
removeTab: function(tab_name)
Removes a tab from the internal list, but not the user interface.
selectTab: function(tab_name)
Bring a tab to the forefront.
getLegendUrls: function(layer_paths)
Returns an array of legend URLs for a given set of paths.
isDefined: function(v)
Check for the null condition in a variable.
activateMapSource: function(name)
Set the active map source.
getActiveMapSource: function()
Gets the active map source.
saveChanges: function(name)
zoomToPointsList: function(points_list,
projection)
Zooms to the bounding box of a points list.
convertLength: function(length,
src_units,
dest_units)
Convert a number from one denomination to another.
download: function(id,
extension)
Offers a download dialog for the php/download.php script.
_latLongProj: null, zoomToLonLat: function(lon,
lat)
Zooms to a specified lon, lat.
deactivateTools: function()
Turn off all current tools, including layer tools.
activateLayerTool: function(action,
kwargs)
Activates a layer tool
activateDefaultTool: function()
This is a bit of a “pull the ‘chute” call.
function parseBoolean(bool,
def)
Inputs a string and outputs a boolean.
function commifyNumber(number)
Convert a number into a string that is comma delimited.
function stripCommas(v)
Remove the commas from a number.
Close