OrdnanceSurvey / OS-Places

OS Places repository for demos and code examples
Apache License 2.0
4 stars 3 forks source link

OS Places API - HTML Code example #3

Open shapley opened 3 years ago

shapley commented 3 years ago

The code example found here:-

https://labs.os.uk/public/os-data-hub-examples/os-places-api/capture-and-verify-example-find

The code does not display an 'OS map' when opened in a browser. The 'OS Places API' all work perfectly but there is no map displayed. The 'apiKey' must be changed below in order for the OS map (road_3857) to display (using the 'map' api) but if this is changed the 'OS Places API' it will not display an OS map.

var apiKey = 'oeDha1JVulFkpOA3VZQ7gq7a1UME5r8k';

In order for the 'html' file to work independently in any browser the above code requires both a 'Places' API and a 'OS Map API' both somewhere in the code. Is this intended to only to work correctly at the above url only?

shapley commented 3 years ago

Looks like I've found the solution to the code and amended it as now here:-

var basemap = L.tileLayer('https://api.os.uk/maps/raster/v1/zxy/Outdoor_3857/{z}/{x}/{y}.png?key=#####################', { maxZoom: 20 }).addTo(map);

Thanks,