1.44.2 • Published 16 days ago

@mapsindoors/map-template v1.44.2

Weekly downloads
-
License
-
Repository
-
Last release
16 days ago

Map Template

Web Component: Installation and usage

Using NPM

Install the package:

npm install @mapsindoors/map-template@stable

In your script:

import MapsIndoorsMap from '@mapsindoors/map-template/dist/mapsindoors-webcomponent.es.js';
window.customElements.define('mapsindoors-map', MapsIndoorsMap);

In your styles make sure to give it a size. For example:

mapsindoors-map {
    display: block;
    width: 100vw;
    height: 100dvh;
}

Use the Web Component in your HTML:

<mapsindoors-map></mapsindoors-map>

Add attributes to the Web Component as needed (see supported properties below).

Note! The external-IDs and app-user-roles expect an array, which in a Web Component is handled differently (see example below). In your script, define the array of external IDs that you want to be shown on the Map Template. Then get a hold of the mapsIndoors map element using the document.querySelector() method. When you have the mapsIndoors map element, assign its prop externalIDs the array of external IDs that you defined at the beginning.

const externalIDsArray = ["externalID-1", "externalID-2"]
const mapsIndoorsMapElement = document.querySelector('mapsindoors-map')
mapsIndoorsMapElement.externalIDs = externalIDsArray;

Use query parameters to configure the Web Component by setting the supports-url-parameter attribute to true.

Using just the browser

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MapsIndoors Map Template</title>
    <script type="module">
        import MapsindoorsMap from 'https://www.unpkg.com/@mapsindoors/map-template@stable/dist/mapsindoors-webcomponent.es.js';
        window.customElements.define('mapsindoors-map', MapsindoorsMap)
    </script>
    <style>
        body {
            margin: 0;
        }
        mapsindoors-map {
            display: block;
            width: 100vw;
            height: 100dvh;
        }
    </style>
</head>
<body>
    <mapsindoors-map></mapsindoors-map>
</body>
</html>

Add attributes to the Web Component as needed (see supported properties below). Use query parameters to configure the Web Component by setting the supports-url-parameter attribute to true.

React component: Installation and usage

Using NPM

Install the package:

npm install @mapsindoors/map-template@stable

Use the MapsIndoorsMap component in a React component:

import MapsIndoorsMap from '@mapsindoors/map-template/dist/mapsindoors-react.es.js';

// Somewhere in your JSX:
<div style={{
      display: 'block',
      width: '100vw',
      height: '100dvh'
}}>
      <MapsIndoorsMap></MapsIndoorsMap>
</div>

Add properties to the MapsIndoorsMap component as needed (see list below). Use query parameters to configure the MapsIndoorsMap component by setting the supportsUrlParameters prop to true.

Supported attributes on the MapsIndoors Map components

Note that when using the React component, the properties should conform to JSX prop naming, eg. api-key becomes apiKey.

AttributeReact prop nameTypeDescription
api-keyapiKeystringThe MapsIndoors Solution you want to load. Takes both API key as string and "App alias".
gm-api-keygmApiKeystringYour Google Maps API key. Can also be set in the MapsIndoors App Config as "gmKey" under "appSettings".
mapbox-access-tokenmapboxAccessTokenstringYour Mapbox Access Token. Can also be set in the MapsIndoors App Config "mapboxAccessToken" under "appSettings". Setting it will load a Mapbox map. If you set both a Mapbox Access Token and Google Maps API key, the Mapbox Access Token takes precedence.
venuevenuestringThe Venue to load from your MapsIndoors Solution.
location-idlocationIdstringSet a MapsIndoors Location ID to show it on the map and its details in the sheet.
primary-colorprimaryColorstringThe primary color to use throughout the app.
logologostringThe logo to show during initial load.
app-user-rolesappUserRolesarrayA list of App User Roles to apply when loading data. Used like so: appUserRoles={["App User Role"]}
directions-fromdirectionsFromstringSet a MapsIndoors Location ID to be used as origin to instantly show directions.
directions-todirectionsTostringSet a MapsIndoors Location ID to be used as destination to instantly show directions.
external-IDsetxternalIDsarrayArray of external IDs which filters the map and shows a list of locations. Because of the way browsers work, you can not use External IDs with the ,, &, # and +, character in them, as they are interpreted by the browser in a particular way.
tile-styletileStylestringName of Tile Style to display on the map.
start-zoom-levelstartZoomLevelnumberThe initial zoom level of the map.
supports-url-parameterssupportsUrlParametersboolIndicates if the Map Template supports URL parameters.
gm-map-idgmMapIdstringThe Google Maps Map ID associated with a specific map style or feature.
pitchpitchnumberThe pitch (Mapbox) or tilt (Google) value of the map. The value of the pitch can be between 0-85 degrees on a Mapbox map.
bearingbearingnumberThe bearing (Mapbox) or heading (Google) value of the map. It accepts any value, and will modify it to fit into the range 0, 360.
use-map-provider-moduleuseMapProviderModuleSet to true if the Map Template should take MapsIndoors solution modules into consideration when determining what map type to use.
languagelanguagestringThe language to show textual content in. Supported values are "en" for English, "da" for Danish, "de" for German and "fr" for French. If the prop is not set, the language of the browser will be used (if it is one of the four supported languages - otherwise it will default to English).
kiosk-origin-location-idkioskOriginLocationIdstringIf running the Map Template as a Kiosk, provide the Location ID that represents the location of the Kiosk.
timeouttimeoutnumberIf you want the Map Template to reset the map position and the UI elements to the initial state after some time of inactivity, use this to specify the number of seconds of inactivity before resetting. This property is not dependent on the kioskOriginLocationId.
use-keyboarduseKeyboardboolIf running the Map Template as a Kiosk, set this prop to true and it will display a virtual keyboard. This property is dependent on the kioskOriginLocationId.
mi-transition-levelmiTransitionLevelnumberThe zoom level on which to transition from Mapbox to MapsIndoors data. Default value is 17. This feature is only available for Mapbox.
categorycategorystringIf you want to indicate an active category on the map. The value should be the Key (Administrative ID).
search-all-venuessearchAllVenuesboolIf you want to perform search across all venues in the solution.

Using Query Parameters

The Map Template supports using query parameters for all the properties provided by the MapsIndoorsMap component if the supportsUrlParameters property is set to true.

The supported query parameters are the following:

  1. apiKey - Used like this apiKey=yourApiKey. If no apiKey is provided, the app will default to mapspeople3d.
  2. venue - Used like this venue=yourVenueName - the Venue property is case sensitive. If no venue is provided, the app will select the first venue from the solution in alphabetical order.
  3. locationId - Used like this locationId=yourLocationId
  4. primaryColor - Used like this primaryColor=000000. Note! You need to provide a hex color value, without the #, due to the hashtag being a reserved symbol that has a predefined purpose in a query string. If no primary color is provided, the app will default to the MapsPeople brand color.
  5. logo - Used like this logo=https://images.g2crowd.com/uploads/product/image/social_landscape/social_landscape_7a75ff13f42605422950b411ab7e03b5/mapspeople.png. Use an image address to provide a different logo on the loading screen. If no logo is provided, the app will default to the MapsPeople icon.
  6. appUserRoles - Used like this appUserRoles=visitor,staff,security - the App User Roles are case sensitive. Note! You need to provide a list of comma separated values, without any spaces between the comma and the value. This will further be converted into an array of appUserRoles.
  7. directionsFrom - Used like this directionsFrom=yourOriginLocationId when having a location ID, or like this directionsFrom=USER_POSITION when having the user location. Using the directionsFrom property in the URL followed by the selection of a destination location in the search view results in the wayfinding having both the origin and the destination prefilled.
  8. directionsTo - Used like this directionsTo=yourDestinationLocationId when having a location ID, or like this directionsTo=USER_POSITION when having the user location.
  9. externalIDs - Used like this externalIDs=0.0.1,0.0.2,0.0.3. Note! You need to provide a list of comma separated values, without any spaces between the comma and the value. This will further be converted into an array of external IDs. Because of the way browsers work, you cannot use External IDs with the ,, &, # and +, character in them, as they are interpreted by the browser in a particular way.
  10. tileStyle - Used like this tileStyle=yourTileStyleName. If no tile style is provided, the app will show the default tile style.
  11. mapboxAccessToken - Used like this mapboxAccessToken=yourMapboxAccessToken. If both the mapboxAccessToken and the gmApiKey are present, the app will load a Mapbox map.
  12. gmApiKey - Used like this gmApiKey=yourGmApiKey. If both the mapboxAccessToken and the gmApiKey are present, the app will load a Mapbox map.
  13. startZoomLevel - Used like this startZoomLevel=22.
  14. gmMapId - Used like this gmMapId=yourGmMapId.
  15. pitch - Used like this pitch=30. Not compatible with MapsIndoors 2D models and MapsIndoors labels on Google Maps. The value of the pitch can be between 0-85 degrees on a Mapbox map.
  16. bearing - Used like this bearing=180. Not compatible with MapsIndoors 2D models and MapsIndoors labels on Google Maps. It accepts any value, and will modify it to fit into the range 0, 360.
  17. useMapProviderModule - Set to "true" if the Map Template should take MapsIndoors solution modules into consideration when determining what map type to use.
  18. language - The language to show textual content in. Supported values are "en" for English, "da" for Danish, "de" for German and "fr" for French. If the prop is not set, the language of the browser will be used (if it is one of the four supported languages - otherwise it will default to English).
  19. kioskOriginLocationId - If running the Map Template as a Kiosk, provide the Location ID that represents the location of the Kiosk.
  20. timeout - If you want the Map Template to reset the map position and the UI elements to the initial state after some time of inactivity, use this to specify the number of seconds of inactivity before resetting. This property is not dependent on the kioskOriginLocationId.
  21. useKeyboard - If running the Map Template as a Kiosk, set this prop to true and it will display a virtual keyboard. This property is dependent on the kioskOriginLocationId.
  22. miTransitionLevel - The zoom level on which to transition from Mapbox to MapsIndoors data. Default value is 17. This feature is only available for Mapbox.
  23. category - If you want to indicate an active category on the map. The value should be the Key (Administrative ID).
  24. searchAllVenues - If you want to perform search across all venues in the solution.

Note! All the query parameters need to be separated with the & symbol, without any spaces in between. Note! When using parameters such as directionsTo, directionsFrom, locationId, externalIDs, and tileStyle make sure you are using the correct apiKey parameter to which they belong. Note! When using the gmMapId property, you need to use it together with the gmApiKey that it is associated with.

Example of URL:

https://domain.com/?apiKey=yourApiKey&venue=yourVenueName&locationId=yourLocationId&primaryColor=000000&logo=https://images.g2crowd.com/uploads/product/image/social_landscape/social_landscape_7a75ff13f42605422950b411ab7e03b5/mapspeople.png&appUserRoles=visitor,staff,security

Important! Not all the query parameters can be used together, as they serve their own purpose which in some cases overlaps with other query parameters. Example of cases that DON’T work together:

locationId + startZoomLevel → the startZoomLevel has priority over the locationId

locationId + externalIDs → the locationId has priority over the externalIDs

directionsTo + directionsFrom + locationId → the directionsTo + directionsFrom have priority over the locationId

directionsTo + directionsFrom + externalIDs → the directionsTo + directionsFrom have priority over the externalIDs

1.44.2

16 days ago

1.44.1

18 days ago

1.44.0

25 days ago

1.43.1

1 month ago

1.42.0

2 months ago

1.43.0

2 months ago

1.41.0

2 months ago

1.40.0

2 months ago

1.39.1

2 months ago

1.39.0

2 months ago

1.38.0

2 months ago

1.38.1

2 months ago

1.37.1

2 months ago

1.37.0

3 months ago

1.36.4

3 months ago

1.36.3

3 months ago

1.36.1

3 months ago

1.36.2

3 months ago

1.36.0

3 months ago

1.35.1

3 months ago

1.33.3

3 months ago

1.33.4

3 months ago

1.35.0

3 months ago

1.33.2

3 months ago

1.34.0

3 months ago

1.34.1

3 months ago

1.33.1

3 months ago

1.33.0

3 months ago

1.31.3

4 months ago

1.32.0

4 months ago

1.29.1

4 months ago

1.30.0

4 months ago

1.31.1

4 months ago

1.31.2

4 months ago

1.31.0

4 months ago

1.29.0

4 months ago

1.28.1

4 months ago

1.28.0

4 months ago

1.27.0

4 months ago

1.26.0

5 months ago

1.25.0

5 months ago

1.24.1

5 months ago

1.24.0

5 months ago

1.23.0

5 months ago

1.22.0

5 months ago

1.14.1

8 months ago

1.12.3

8 months ago

1.14.0

8 months ago

1.12.2

8 months ago

1.12.1

8 months ago

1.12.0

9 months ago

1.18.0

6 months ago

1.16.0

7 months ago

1.14.2

7 months ago

1.8.2

9 months ago

1.8.1

9 months ago

1.8.0

10 months ago

1.4.3

10 months ago

1.6.0

10 months ago

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.21.0

5 months ago

1.9.4

9 months ago

1.9.3

9 months ago

1.9.2

9 months ago

1.11.0

9 months ago

1.15.0

7 months ago

1.13.0

8 months ago

1.11.2

9 months ago

1.11.1

9 months ago

1.19.0

6 months ago

1.17.1

6 months ago

1.17.0

6 months ago

1.15.1

7 months ago

1.9.1

9 months ago

1.9.0

9 months ago

1.7.2

10 months ago

1.7.1

10 months ago

1.7.0

10 months ago

1.5.1

10 months ago

1.5.0

10 months ago

1.20.1

6 months ago

1.20.2

5 months ago

1.12.0-rc.1

9 months ago

1.12.0-rc.2

9 months ago

1.20.0

6 months ago

1.12.0-rc.3

9 months ago

1.10.0

9 months ago

1.3.4

11 months ago

1.3.3

11 months ago

1.3.2

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.0

12 months ago

1.0.0-rc.2

12 months ago

1.0.0-rc.1

12 months ago