Galigeo API
    Preparing search index...

    Class Map

    Map is the root object of the API. To get started, you need to create a instance of Map then call map.load() to link it with the map viewer.

    Index

    Constructors

    • Creates the main Map and define its parameters.

      Parameters

      • element: string | HTMLElement

        ID of the div that will contain the map

      • options: MapParameters

        See MapParameters for the map parameters

      Returns Map

    Properties

    refreshId: string

    The refresh ID is used to update the map data.

    Methods

    • Parameters

      • url: string
      • name: string

      Returns void

    • Parameters

      • event: string
      • listener: Function

      Returns void

    • Create new marker in the position x,y with custom svg image or style

      Parameters

      • coordinates: number[]

        [x,y]

      • style: any
      • iconSvgOptions: any

        ex: {iconSize: [40, 40]}

      • urlSvg: any

      Returns Promise<Layer>

      layerLeaflet the marker object leaflet in the map

      var coordinates = [ event.lat, event.lng ];
      var iconSvgOptions = { iconSize : [ 40, 40 ] };
      var svgXml = `<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="map-marker" class="svg-inline--fa fa-map-marker fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="${color}" d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z"></path></svg>`;
      var url = encodeURI("data:image/svg+xml," + svgXml).replace('#', '%23');
      markerLayer = mapGaligeo.addMarker(coordinates, undefined, iconSvgOptions, svgXml);
    • Add a array of geojson features to the map. This function adds a new layer on the map.

      Parameters

      • features: any[]

        ex: lines [{ "type": "Feature", "properties": { "party": "abc", "popupContent": "popupContent !!!!!!!" }, "geometry": { "type": "LineString", "coordinates": [[-105, 40], [-110, 45], [-115, 55]] } }, { "type": "Feature", "properties": { "party": "abc", "popupContent": "popupContent !!!!!!!" }, "geometry": { "type": "LineString", "coordinates": [[-100, 40], [-105, 45], [-110, 55]] } }]

        • ex: polygons { "type": "Feature", "properties": { "party": "Republican", "popupContent": "popupContent !!!!!!!" }, "geometry": { "type": "Polygon", "coordinates": [[ [-104.05, 48.99], [-97.22, 48.98], [-96.58, 45.94], [-104.03, 45.94], [-104.05, 48.99] ]] } }, { "type": "Feature", "properties": { "party": "Democrat", "popupContent": "popupContent !!!!!!!" }, "geometry": { "type": "Polygon", "coordinates": [[ [-109.05, 41.00], [-102.06, 40.99], [-102.03, 36.99], [-109.04, 36.99], [-109.05, 41.00] ]] } }]
      • style: Style

        a style of features

      Returns Promise<Layer>

      layerId of the object in the map

    • disable navigation like zoom & pan ... when it's enabled

      Returns Promise<any>

    • enable navigation like zoom & pan ... when it's disabled

      Returns Promise<any>

    • Parameters

      • event: string
      • Optionalvalue: any

      Returns void

    • Zoom to a specific location using fly method

      Parameters

      • x: number
      • y: number
      • zoom: number

        level used in the zoom

      Returns Promise<any>

    • Get the URL for the auto print (without any user interaction)

      Parameters

      • template: string = 'Format A4 Landscape'

        name of the template to use (default=A4 LANDSCAPE)

      Returns string

      the URL to open in a new tab or in a popup

    • Get the list of layers

      Returns Promise<Layer[]>

      Promise<Layer[]>

    • Get the list of views available in the map

      Returns Promise<any[]>

    • Returns boolean

      true if the map is ready to use

    • Link the map with an instance of the map viewer. The map cannot be used until the load is not terminated.

      Returns Promise<Map>

      a promise when the map is loaded

    • Returns void

    • Take a screenshot of the map

      Parameters

      • withLegend: boolean

        add legend to print

      • savePng: boolean

        save the png in your disc

      • title: string

        of screen saved

      Returns Promise<any>

    • Refresh the map. This function is useful to see data updated on the map.

      Returns Promise<any>

    • Parameters

      • event: string
      • listener: Function

      Returns boolean

    • Remove a layer on the map. This method works on marker/geojson layers created with the API, as well with standard Galigeo layers created from the map itself.

      Parameters

      Returns Promise<string>

    • Returns void

    • Set the extent of the map

      Parameters

      • extent: Extent

        The extent to set

      Returns Promise<any>

    • Define the visibility for the buttons at the bottom rights on the map. Note that the zoom in/out buttons and the 3D button are always visible.

      Parameters

      • visible: boolean

        Set to true to show all controls (default false)

      Returns Promise<any>

    • Inject the result of the openMap/encoded API into the map. In most cases, this method is called by load() automatically.

      Parameters

      • json: any

        Result of the openMap/encoded API

      Returns Promise<Map>

    • Define the visibility of the vertical menu (top left of the viewer). This option is useful to display a "minimal" embeded map.

      Parameters

      • visible: boolean

        Set to false to hide the menu (default true)

      Returns Promise<any>

    • Define the visibility of the open in new tab button at the bottom right.

      Parameters

      • visible: boolean

        Set to true to display the control

      Returns Promise<any>

    • Toggle the specified view on the map.

      Parameters

      • viewId: number

        the id of the view to set

      Returns Promise<void>

    • Update the current map without having to reload it. When this method is used to update the map data, the layers are updated without having to reload the map.

      Parameters

      Returns Promise<unknown>

    • Zoom to a specific location without animations

      Parameters

      • x: number
      • y: number
      • zoom: number

        level used in the zoom

      Returns Promise<any>