Getting a HERE Maps API key

The first thing you need before connecting to HERE Maps is a HERE API key. On the HERE developer portal, you can create a HERE account and one or more keys.

To create a key for HERE Maps:

  1. Go to https://developer.here.com/.

  2. Log in with your HERE account, or sign up for a new account.

    1. If you sign up for a new account, select a plan that fits your project.The default is the Freemium plan.
      Once you have logged on, you see a Projects page that lists all your projects and the corresponding HERE plan.For new accounts with a Freemium plan, the Projects page shows one project called Freemium and the project creation date.

  3. Select the project from the projects page.

  4. On the Project Details page, you can create keys.In the REST section, click Generate App.
    The portal generates an APP ID.

  5. Click Create API key.
    The portal generates a key. Click the Copy button to copy/paste it in your code.

Note that more terms may apply for deployment. For more information about HERE licensing, see the HERE terms and Conditions.

Visualizing HERE Maps data

Visualizing HERE Maps data requires two steps:

  1. Create a HereMapsTileSetModel with your API key and an optional set of map requirements.

  2. Use a RasterTileSetLayer to visualize the model.

Program: Creating a HERE Maps raster layer (from samples/dataformats/HereMapsDataLoader.js)
const options = {
  apiKey: apiKey,
  base: type === "aerial" ? "aerial" : type === "aerialWithLabels" ? "aerial" : type === "roads" ? "base"
                                                                                                 : "traffic",
  type: type === "roadsWithTraffic" ? "traffictile" : "maptile",
  scheme: type === "aerial" ? "satellite.day" : type === "aerialWithLabels" ? "hybrid.day" : "normal.day"
}
return createHereMapsTileSetModel(options)
    .then(model => {
      return new RasterTileSetLayer(model, {
        label: `${type} (HERE)`,
        layerType: LayerType.BASE,
        id: "HERE"
      });
    });

To comply with the terms of use for HERE Maps data, you must show the attribution information of the imagery.

The LuciadRIA sample code contains an Attribution overlay component to handle this.

Please refer to the sample samples/common/ui/Attribution.tsx for more details.

Program: Including HERE Maps attribution information using the sample component Attribution (from samples/common/ui/Attribution.tsx)
export const Attribution = ({map, separator = " • ", staticAttributions}: Props) => {

  const [layerAttributions, setLayerAttributions] = useState<LayerAttribution[]>([]);

  useEffect(() => {
    const attributionProvider = new TileSetAttributionProvider(map);

    const layerAttributionListener = attributionProvider.on("LayerAttributionsChanged", (layerAttributions) => {
      setLayerAttributions(layerAttributions);
    });

    setLayerAttributions(attributionProvider.getLayerAttributions())

    return () => {
      layerAttributionListener.remove();
    }
  }, [map]);

  // if multiple layers provide attribution, add the layer label to the line, so you know what attributions belong to what layer
  const showLayerLabel = layerAttributions.length > 1;

  return (
      <div className="attribution">
        <div className="attribution-strings">
          {layerAttributions.map(attr =>
              <div key={attr.layer.id}>
              {(showLayerLabel ? `[${attr.layer.label}]: ` : "")}
                {attr.attributionStrings.join(separator)}
                {(attr.attributionLogos as string[]).map(
                    logo => <img className="attributionLogo" alt={logo} key={logo} src={logo}/>)}
              </div>
          )}
          {staticAttributions}
        </div>
      </div>
  )
}