Class: GoMap

GoMap

The map is the core component of Go-GIS. For a map to render, a view, one or more layers, and a target container for create one map we needed:

    const options = ' {
			"id": "main",
			"div": "olMap",
			"optionView": {
				"id": "vista1",
				"center": [-0.37739,39.46975],
				"zoom": 15,
				"projection": "4326"
			}
		}
		'
    const GoMap = new GoMap();
    GoMap.addMap(options)

The above snippet creates a map using a module:types~mapOptionsBasic to display a personal map

new GoMap(interactions)

Map/GoMap.ts, line 56
Name Type Description
interactions GoInteractions

Methods

addInteractions(interactions)

Map/GoMap.ts, line 111

This function add to the map all the interactions defined in json configuration

Name Type Description
interactions module:types~interactions

json configuration

addLayer(idMap, layerOptions){GOLayer}

Map/GoMap.ts, line 541

Add one layer to Map *Example:

    const options = ' {
  		"id": "manantial",
  		"alias": "Manantial",
  		"layerType": "GO_VECTOR_LAYER",
  		"isBaseLayer": false,
  		"opacity": 1,
  		"url": "ENV/geoserver/SACMEX",
  		"layerName": "SACMEX:manantial",
  		"urlFolder": "Geografía/",
  		"zIndex":1,
  		"defaultVisibility":false,
  		"sldStyle": {
  			"url": "ENV/geoserver/rest/styles/manantial.sld",
  			"mapUnits": true
  		}
  	}
  	'
    const GoMap = new GoMap();
    GoMap.addLayer(options)
Name Type Description
idMap string

Name of map to add layer

layerOptions module:types~layerOptions

Options from Layer to configurate all

Returns:
Type Description
GOLayer

addMap(options)

Map/GoMap.ts, line 76

This function creates a Map with a json configuration

Name Type Description
options module:types~mapOptionsBasic

json configuration

bindViews(refView, viewsToBind)

Map/GoMap.ts, line 744

This Method allows to bind views taking one of them as a reference of bind

Name Type Description
refView string

Name of reference map

viewsToBind Array.<string>

Array of map names

createMap(div, view){module:types~OlMap}

Map/GoMap.ts, line 176

This function allow to create a map passing the id of the div

Name Type Description
div string

The id of the div

view module:types~GoView

The view of the map

Returns:
Type Description
module:types~OlMap Return a new map

createPerspectiveMap(div, view){module:types~OlMap}

Map/GoMap.ts, line 193

This function allow to create a perspective map passing the id of the div

Name Type Description
div string

The id of the div

view module:types~GoView

The view of the map

Returns:
Type Description
module:types~OlMap Return a new map

createProjection(options)

Map/GoMap.ts, line 139
Name Type Description
options module:types~projOptions

This function creates a projection with a json configuration

createView(options, idMap){module:types~GoView}

Map/GoMap.ts, line 208

This function allow to create a view passing the id of the map.

Name Type Description
options module:types~optionsView

The options of the view

idMap string

The id of the map

Returns:
Type Description
module:types~GoView Return a new view

existLayer(idMap, idLayer){void}

Map/GoMap.ts, line 681

This function allow to determine if the layer exists

Name Type Description
idMap string

The id of the map

idLayer string

The id of the layer

Returns:
Type Description
void Return nothing

flyTo(map, centerTo, duration, zoom){void}

Map/GoMap.ts, line 779

This function allow to move the map to a new position

Name Type Description
map module:types~OlMap

The map to move

centerTo Array.<number>

The center to move

duration number

The duration of the move

zoom number

The zoom to move

Returns:
Type Description
void Return nothing

flyToCenter(idMap, centerTo, duration, zoom)

Map/GoMap.ts, line 356

This function add animation to translate from one position to another

Name Type Description
idMap string

Name of the map we want to change center

centerTo Array.<number>

Center to fly

duration number

Duration in secons the dynamic fly

zoom number optional

Value to final zoom

getAllStaging(){Map.<string, GOStagingMap>}

Map/GoMap.ts, line 389

Obtain all data from all maps: Map,Layers, interacctions etc....

Returns:
Type Description
Map.<string, GOStagingMap>

getCenter(idMap){Coordinate}

Map/GoMap.ts, line 269

This function get center from a Map with a json configuration

Name Type Description
idMap string

Name of the map we want to obtain center

Returns:
Type Description
Coordinate Return a Coordinates Center

getInteractions()

Map/GoMap.ts, line 164

This function return interactions for this map

getLanguage(){types.SupportedLangs}

Map/GoMap.ts, line 474

Get Actual language

Returns:
Type Description
types.SupportedLangs

getLayers(idMap){GOLayer}

Map/GoMap.ts, line 500

Get All layers from Map

Name Type Description
idMap string

Name of map to obtain layers

Returns:
Type Description
GOLayer

getMap(idMap){OlMap}

Map/GoMap.ts, line 372

Obtain OpenLayers Map

Name Type Description
idMap string

Name of the map we want obtain

Returns:
Type Description
OlMap

getProjection(idMap){string}

Map/GoMap.ts, line 230

This function allow to get the projection of the map

Name Type Description
idMap string

This function creates a Map with a json configuration

Returns:
Type Description
string EPSG Return a Code:EPSG projection map example: EPSG:4326

getStaging(idMap){GOStagingMap}

Map/GoMap.ts, line 400

Obtain all data from one map: Map,Layers, interacctions etc....

Name Type Description
idMap string

Name of map to obtain all data

Returns:
Type Description
GOStagingMap

getTheme(){themes}

Map/GoMap.ts, line 448

Gets actual theme for all maps, if you never used setThemeAllMaps, it returns themes.DARK

Returns:
Type Description
themes

getView(idMap){GoView}

Map/GoMap.ts, line 244

This function obtain a View from Map

Name Type Description
idMap string

Name of the map we want to obtain View

Returns:
Type Description
GoView Return a View from GoView

getZoom(idMap)

Map/GoMap.ts, line 304

This function obtain the zoom level from Map in that moment

Name Type Description
idMap string

Name of the map we want to change center

goToExtent(idMap, Extent)

Map/GoMap.ts, line 338

This function change location in the map from a especific Extent

Name Type Description
idMap string

Name of the map we want to change center

Extent Extent

Extent Value [xmin,ymin,xmax,ymax]

hasStagingMap(idMap){void}

Map/GoMap.ts, line 734

This function allow to determine if the map is a staging map

Name Type Description
idMap string

The id of the map

Returns:
Type Description
void Return nothing

injectDataGeoJson(idMap, idLayer, ClearData, Data)

Map/GoMap.ts, line 636

Inject data in a GeoJson layer

Name Type Description
idMap string

Name of map to obtain layers

idLayer string

Name of Layer

ClearData boolean

If Inject data Remove all Features from Layer

Data GeoJSON

Data to inject in Layer

onMap(idMap, type, callback){boolean}

Map/GoMap.ts, line 717

Do any interaction when the map .....

Name Type Description
idMap string

Name of map of launch method

type module:constants~typeOn

types to do in the method : change - Generic change event. Triggered when the revision counter is increased. change:layerGroup change:size change:target change:view click - A click with no dragging. A double click will fire two of this. dblclick - A true double click, with no dragging. error - Generic error event. Triggered when an error occurs. moveend - Triggered after the map is moved. movestart - Triggered when the map starts moving. pointerdrag - Triggered when a pointer is dragged. pointermove - Triggered when a pointer is moved. Note that on touch devices this is triggered when the map is panned, so is not the same as mousemove. postcompose - Triggered after all layers are rendered. The event object will not have a context set. postrender - Triggered after a map frame is rendered. precompose - Triggered before layers are rendered. The event object will not have a context set. propertychange - Triggered when a property is changed. rendercomplete- Triggered when rendering is complete, i.e. all sources and tiles have finished loading for the current viewport, and all tiles are faded in. The event object will not have a context set. singleclick

callback function

Function to do in this method

Returns:
Type Description
boolean

refreshLayer(idMap, idLayer)

Map/GoMap.ts, line 592

Refresh data from layer

Name Type Description
idMap string

Name of map to obtain layers

idLayer Array.<string>

Name of Layer

refreshMap(idMap)

Map/GoMap.ts, line 484

Refresh all content of map

Name Type Description
idMap string

Name of map to refresh

removeLayer(idMap, idLayer){GOStagingMap}

Map/GoMap.ts, line 556

Remove one Layer from Map

Name Type Description
idMap string

Name of map to obtain layers

idLayer string

Name of Layer

Returns:
Type Description
GOStagingMap

setCenter(idMap, center)

Map/GoMap.ts, line 288

This function change center from a Map

Name Type Description
idMap string

Name of the map we want to change center

center Coordinate

Coordinates Center

setLanguage(lang)

Map/GoMap.ts, line 408

Set language for all GOStagingMap instances.

Name Type Description
lang types.SupportedLangs

The language to set.

setLayer(idMap, layerOption){module:types~GOLayer|null}

Map/GoMap.ts, line 817

This function allow to set a new layer.

Name Type Description
idMap string

The id of the map

layerOption module:types~layerOptions

The layer options.

Returns:
Type Description
module:types~GOLayer | null Return promise Promise<GOLayer | null>

setThemeAllMaps(theme)

Map/GoMap.ts, line 462

Sets dark/light theme all maps.

Name Type Description
theme themes

The language to set.

setZoom(idMap, Zoom)

Map/GoMap.ts, line 322

This function set the zoom level from Map

Name Type Description
idMap string

Name of the map we want to change center

Zoom number

Number value to set Zoom in the Map Number from 0 to 20

unbindAllViews(option)

Map/GoMap.ts, line 763

This Method unbind all views of maps

Name Type Description
option any

The option to unbind