Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce HEREv3 (using apiKey instead of app_id and app_code) #343

Merged
merged 6 commits into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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