Skip to content

Commit

Permalink
Introduce HEREv3 (#343)
Browse files Browse the repository at this point in the history
* Add HERE API v3
 - Tile API URL changed 
 - Authorization by apiKey

* Update README (HEREv3)

* Readme: Remove link to Available HERE layers
  • Loading branch information
mcguffin authored Feb 1, 2020
1 parent 8627840 commit c2bc38a
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 5 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ Leaflet-providers provides tile layers from different providers, including *Open

In addition to the providers you are free<b id="what-is-free">1</b> to use, we support some layers which require registration.

### HERE (formerly Nokia).
### HERE and HEREv3 (formerly Nokia).

In order to use HERE layers, you must [register](http://developer.here.com/). Once registered, you can create an `app_id` and `app_code` which you have to pass to `L.tileLayer.provider` in the options:
In order to use HEREv3 layers, you must [register](http://developer.here.com/). Once registered, you can create an `apiKey` which you have to pass to `L.tileLayer.provider` in the options:

```Javascript
L.tileLayer.provider('HEREv3.terrainDay', {
apiKey: '<insert apiKey here>'
}).addTo(map);
```

You can still pass `app_id` and `app_code` in legacy projects:

```Javascript
L.tileLayer.provider('HERE.terrainDay', {
Expand All @@ -40,8 +48,6 @@ L.tileLayer.provider('HERE.terrainDay', {
}).addTo(map);
```

[Available HERE layers](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=HERE)

### Mapbox

In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). You can get map_ID (i.e mapbox.satellite) and ACCESS_TOKEN from [Mapbox projects](https://www.mapbox.com/projects):
Expand Down
110 changes: 109 additions & 1 deletion leaflet-providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
HERE: {
/*
* HERE maps, formerly Nokia maps.
* These basemaps are free, but you need an API key. Please sign up at
* These basemaps are free, but you need an api id and app key. Please sign up at
* https://developer.here.com/plans
*/
url:
Expand Down Expand Up @@ -610,6 +610,114 @@
}
}
},
HEREv3: {
/*
* HERE maps API Version 3.
* These basemaps are free, but you need an API key. Please sign up at
* https://developer.here.com/plans
* Version 3 deprecates the app_id and app_code access in favor of apiKey
*
* Supported access methods as of 2019/12/21:
* @see https://developer.here.com/faqs#access-control-1--how-do-you-control-access-to-here-location-services
*/
url:
'https://{s}.{base}.maps.ls.hereapi.com/maptile/2.1/' +
'{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
'apiKey={apiKey}&lg={language}',
options: {
attribution:
'Map &copy; 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
subdomains: '1234',
mapID: 'newest',
apiKey: '<insert your apiKey here>',
base: 'base',
variant: 'normal.day',
maxZoom: 20,
type: 'maptile',
language: 'eng',
format: 'png8',
size: '256'
},
variants: {
normalDay: 'normal.day',
normalDayCustom: 'normal.day.custom',
normalDayGrey: 'normal.day.grey',
normalDayMobile: 'normal.day.mobile',
normalDayGreyMobile: 'normal.day.grey.mobile',
normalDayTransit: 'normal.day.transit',
normalDayTransitMobile: 'normal.day.transit.mobile',
normalNight: 'normal.night',
normalNightMobile: 'normal.night.mobile',
normalNightGrey: 'normal.night.grey',
normalNightGreyMobile: 'normal.night.grey.mobile',
normalNightTransit: 'normal.night.transit',
normalNightTransitMobile: 'normal.night.transit.mobile',
reducedDay: 'reduced.day',
reducedNight: 'reduced.night',
basicMap: {
options: {
type: 'basetile'
}
},
mapLabels: {
options: {
type: 'labeltile',
format: 'png'
}
},
trafficFlow: {
options: {
base: 'traffic',
type: 'flowtile'
}
},
carnavDayGrey: 'carnav.day.grey',
hybridDay: {
options: {
base: 'aerial',
variant: 'hybrid.day'
}
},
hybridDayMobile: {
options: {
base: 'aerial',
variant: 'hybrid.day.mobile'
}
},
hybridDayTransit: {
options: {
base: 'aerial',
variant: 'hybrid.day.transit'
}
},
hybridDayGrey: {
options: {
base: 'aerial',
variant: 'hybrid.grey.day'
}
},
pedestrianDay: 'pedestrian.day',
pedestrianNight: 'pedestrian.night',
satelliteDay: {
options: {
base: 'aerial',
variant: 'satellite.day'
}
},
terrainDay: {
options: {
base: 'aerial',
variant: 'terrain.day'
}
},
terrainDayMobile: {
options: {
base: 'aerial',
variant: 'terrain.day.mobile'
}
}
}
},
FreeMapSK: {
url: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
options: {
Expand Down

0 comments on commit c2bc38a

Please sign in to comment.