From 6fd02898ce37832f2cb9cd0e4f50054c33ac2ea2 Mon Sep 17 00:00:00 2001 From: Jim Bacon Date: Tue, 14 Mar 2017 10:54:21 +0000 Subject: [PATCH 1/6] Add terms and conditions popup When an OS Layer is added, creates a hidden div containing terms and conditions. Adds an event handler to the terms and conditions link to show the div when the link is clicked. --- OSOpenSpace.css | 40 +++++++++++ OSOpenSpace.js | 187 +++++++++++++++++++++++++++++++++++++++++++++++- demo/index.html | 2 +- 3 files changed, 226 insertions(+), 3 deletions(-) create mode 100644 OSOpenSpace.css diff --git a/OSOpenSpace.css b/OSOpenSpace.css new file mode 100644 index 0000000..8ad4a9d --- /dev/null +++ b/OSOpenSpace.css @@ -0,0 +1,40 @@ +.leaflet-container .os-leaflet-terms-container { + display: none; + position: relative; + margin: 16px; + background: white; + color: #333; + box-shadow: 0 3px 14px rgba(0,0,0,0.4); + z-index: 1200; + overflow: hidden +} + +.leaflet-container a.os-leaflet-terms-close-button { + position: absolute; + top: 0; + right: 0; + padding: 4px 4px 0 0; + border: none; + text-align: center; + width: 18px; + height: 14px; + font: 16px/14px Tahoma, Verdana, sans-serif; + color: #c3c3c3; + text-decoration: none; + font-weight: bold; + background: transparent; +} + +.leaflet-container a.os-leaflet-terms-close-button:hover { + color: #999; + } + +.leaflet-container .os-leaflet-terms { + overflow: auto; +/* margin: 13px 19px; */ + line-height: 1.4; + padding: 0 10px; + margin: 19px 6px 11px; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; +} \ No newline at end of file diff --git a/OSOpenSpace.js b/OSOpenSpace.js index 310fe36..b0506d2 100644 --- a/OSOpenSpace.js +++ b/OSOpenSpace.js @@ -90,8 +90,8 @@ return '© Crown copyright and database rights ' + new Date().getFullYear() + ' Ordnance Survey. ' + - '' + 'Terms of Use.'; }, @@ -101,6 +101,15 @@ map.addControl(new L.OSOpenSpace.LogoControl()); } L.TileLayer.prototype.onAdd.call(this, map); + + // Add a click handler to a Terms of Use link. + // This has be done when adding of layer has finished. + L.OSOpenSpace.addTerms(map); + map.on('layeradd', function(e) { + if (e.layer == this) { + L.OSOpenSpace._termsClickHandler(map); + } + }, this); }, /** @@ -121,6 +130,71 @@ } }); + /** + * Add a div to contain OS terms and conditions. + */ + L.OSOpenSpace.addTerms = function(map) { + var mapDiv = map.getContainer(); + var termsContainerDiv = L.DomUtil.create('div', 'os-leaflet-terms-container', mapDiv); + var termsClose = L.DomUtil.create('a', 'os-leaflet-terms-close-button', termsContainerDiv); + var termsDiv = L.DomUtil.create('div', 'os-leaflet-terms', termsContainerDiv); + termsClose.innerHTML = 'x'; + termsClose.setAttribute('href', "#"); + termsClose.setAttribute('title', "Close"); + termsDiv.innerHTML = L.OSOpenSpace.terms; + + termsClose.addEventListener('click', function(e) { + termsContainerDiv.style.display = "none"; + e.stopPropagation(); + L.OSOpenSpace.mapEnable(map); + }); + }; + + /** + * Add a click handler to the Terms and Conditions link to pop up the terms. + */ + L.OSOpenSpace._termsClickHandler = function(map) { + var mapDiv = map.getContainer(); + var termLink = mapDiv.getElementsByClassName("os-leaflet-terms-link")[0]; + var termsContainerDiv = mapDiv.getElementsByClassName("os-leaflet-terms-container")[0]; + var termsDiv = mapDiv.getElementsByClassName("os-leaflet-terms")[0]; + termLink.addEventListener('click', function(e) { + var size = map.getSize(); + // 16px margin on container div and 19px + 11px margin on inner div = 62 + termsDiv.style.height = (size.y - 62) + 'px'; + termsContainerDiv.style.display = "block"; + L.OSOpenSpace.mapDisable(map); + }); + }; + + /** + * Disable standard map interactions. + */ + L.OSOpenSpace.mapDisable = function(map) { + map.dragging.disable(); + map.touchZoom.disable(); + map.doubleClickZoom.disable(); + map.scrollWheelZoom.disable(); + map.boxZoom.disable(); + map.keyboard.disable(); + if (map.tap) map.tap.disable(); + map.getContainer().style.cursor='default'; + }; + + /** + * Enable standard map interactions. + */ + L.OSOpenSpace.mapEnable = function(map) { + map.dragging.enable(); + map.touchZoom.enable(); + map.doubleClickZoom.enable(); + map.scrollWheelZoom.enable(); + map.boxZoom.enable(); + map.keyboard.enable(); + if (map.tap) map.tap.enable(); + map.getContainer().style.cursor='grab'; + }; + /* * Factory method to create a new OSOpenSpace tilelayer. * @@ -134,5 +208,114 @@ return new L.OSOpenSpace.TileLayer(apiKey, apiUrl, options); }; + + /** + * End User Terms of Use copied from Schedule 2 of the OS OpendSpace Developer Agreement. 13th March 2017. + * https://www.ordnancesurvey.co.uk/business-and-government/licensing/licences/os-openspace-developer-agreement.html + */ + L.OSOpenSpace.terms = " \ +

End User Terms of Use (Terms of Use)

\ + \ +

Your use of the Application is governed by this agreement between ‘you’ and the Developer (the ‘End User Terms of Use (Terms of Use)’) Please read these Terms of Use and ensure that you have understood them. If you do not agree to these Terms of Use, please immediately stop using the Application, including the Ordnance Survey Data.

\ + \ +

Background

\ + \ +

A The Developer has created an Application using the OpenSpace API and/or an OpenSpace SDK. The Application consists of, and allows you to access and use, a feed of Ordnance Survey mapping data via the use of a unique API key embedded in the Application.

\ +

B These Terms of Use govern your use of the Ordnance Survey Data and related services provided by Ordnance Survey through the delivery of the Application. These Terms of Use do not cover the Application itself or any content/data of the Developer or third parties, which shall be governed by the Developer’s own terms.

\ + \ +

1 Definitions

\ + \ +

‘Application’ means an application(s) developed by the Developer using the OpenSpace API which is designed to access and use the Ordnance Survey Data via the internet which must be publicly accessible on the internet and must not be restricted, in whole or part, by firewall or otherwise, nor operate only on an internal network;

\ +

‘Caching’ means the automatic, immediate download and temporary storage of data, where such download and storage is an integral and essential part of a technological process, such storage to be no longer than 24 hours;

\ +

‘Data’ means any text, graphics, audio, visual (including still visual images) and/or audio visual material, software, applications, data, database content or other multimedia content, information and material;

\ +

‘Derived Data’ means any and all Data that is created by you through your use of the Application(s) which substantially reproduces and/or which is adapted, extracted, reutilized or derived directly or indirectly from Ordnance Survey Data. By way of example, but without limitation, Derived Data would include any Data created by you identifying the location or other attribute of any new feature directly using Ordnance Survey Data or a feature already present in Ordnance Survey Data and shall include Waypoints and User Generated Routes;

\ +

‘Developer’ means the person or entity issuing the Application to the general public;

\ +

‘End Users’ means the persons using the Application including you; and ‘End User’ shall be construed accordingly;

\ +

‘End User’s Data’ means any Data that you display or otherwise provide to the Application which you own, or which you are licensed by a third party to use (under terms which are consistent with the terms of these Terms of Use). However, End User’s Data does not include Derived Data that you own pursuant to Clause 2.3(a). By way of example, but without limitation, End User’s Data would include any independently sourced GPS trace plotted by you on the Application;

\ +

‘Financial Gain’ means any payment, revenue, credit, or money’s worth received by, or accruing to the Developer, you (or any third party used by or connected to Developer or you) (directly or indirectly) for: (i) accessing and using the Application; and/or (ii) viewing, downloading, using or exploiting any Ordnance Survey Data (or Derived Data owned by Ordnance Survey);

\ +

‘Intellectual Property Rights or IPR’ means copyright, patent, trade mark, design right, database rights, trade secrets, know how, rights of confidence, broadcast rights and all other similar rights anywhere in the world whether or not registered and including applications for registration of any of them;

\ +

‘OpenSpace API’ means the JavaScript application programming interface created by Ordnance Survey to allow developers to build applications using Ordnance Survey mapping data (which consists of the OpenSpace JavaScript Libraries and various open source software), as such may be amended from time to time;

\ +

‘OpenSpace SDK’ means one of the mapping data software development kits created and made available by Ordnance Survey and licensed under an open source licence, the terms of which are located at the following url: https://github.com/OrdnanceSurvey;

\ +

‘Open Space JavaScript Library (Libraries)’ means a proprietary JavaScript library created by Ordnance Survey and supplied to the Developer as part of the OpenSpace API, which Ordnance Survey licenses pursuant to the BSD open source licence, as such may be amended from time to time;

\ +

‘Ordnance Survey Data’ means Data owned by or licensed to Ordnance Survey (including as applicable Derived Data), a feed of which is made available by OS OpenSpace, which may be accessed and processed by the Application;

\ +

‘OS OpenSpace or OS OpenSpace Service’ means the services provided by Ordnance Survey through which the Developer and/or End Users, can access a feed of Ordnance Survey Data through the OpenSpace API;

\ +

‘Screen Shot’ means a screen shot, capture or grab of a complete page from the Application which includes a visible map image of Ordnance Survey Data. For the avoidance of doubt, the map image must not be provided as a download.

\ +

‘User Generated Route’ means a course between a start location and a destination that is manually created by End User selecting and identifying a series of Waypoints on the Application, each of which Waypoints is joined by a straight line to the next Waypoint in the series and in the order that an End User would wish to travel; and

\ +

‘Waypoint’ means a point of reference selected by an End User using the Application, which consists merely of a set of co-ordinates that identify the point in physical space.

\ + \ +

2 Proprietary Rights, Licence and Restrictions

\ + \ +
2.1 Ownership of Intellectual Property
\ +

The Crown (or where applicable Ordnance Survey’s suppliers) owns the Intellectual Property Rights in the Ordnance Survey Data which is made available to End Users through and/or as part of the Application. The End User acknowledges and agrees that these Terms of Use conveys a limited right to use the Ordnance Survey Data and does not convey title or ownership to the Ordnance Survey Data to the End User.

\ + \ +
2.2 Licence Grant
\ +

The Developer grants to End Users a personal, non-exclusive, non-transferable, licence solely for the End User’s own personal, non commercial use (terminable at will and without any right to sublicense) to:

\ +

a) request from Ordnance Survey’s server the Ordnance Survey Data and view, use, and display the same through and as part of the Application on/from a single computer (including hand held), or mobile or GPS device;

\ +

b) create Waypoints and/or User Generated Routes through and as part of the Application and view and download Waypoints and/or User Generated Routes on and to a single computer (including hand-held) or GPS device;

\ +

c) print:

\ +

i) a maximum of ten (10) paper copies no greater than A4 (625 cm2) in size of any Screen Shot for the End-User’s personal or non-commercial use.

\ +

ii) more than ten (10) paper copies, no greater than A4 (625cm2) in size of any Screen Shot for use in presentations given by the End User where the purpose is to provide a single copy of the Screen Shot to each participant of a presentation given by the End User.

\ +

provided that:

\ +

i) The OS OpenSpace logo and copyright acknowledgement form part of the map image; and

\ +

ii) The Screen Shot includes content emanating from the Application and is not solely a map image.

\ +

For the avoidance of doubt, for all other publications of Screen Shots, an appropriate licence is required.

\ + \ +
2.3 Derived Data
\ +

a) In the event that any End User creates Derived Data, End User acknowledges and agrees that such Derived Data shall automatically be assigned immediately on creation to Ordnance Survey, save that if any Derived Data is created by any End User which is a severable improvement (as defined by Commission Regulation (EC) No 772/2004, known as the Technology Transfer Block Exemption) of the Ordnance Survey Data then such Derived Data shall be owned by the End User.

\ +

b) In respect of any Derived Data Ordnance Survey owns pursuant to Clause 2.3(a) above, then subject to all of these Terms of Use, but without prejudice to Clause 2.2(b), the Developer hereby grants End User a perpetual, non exclusive, royalty-free, paid up, personal licence to use and display such Derived Data as part of the Application used to create the same.

\ +

c) In respect of any Derived Data an End User owns pursuant to Clause 2.3(a) above, then for the period during which End User submits, posts, or displays such Derived Data on the Application, End User, or Developer (as the case may be), grants to Ordnance Survey a revocable, world-wide, royalty-free, and non-exclusive licence to use, display and distribute such Derived Data solely for the purpose of allowing: (i) Ordnance Survey to deliver the OS OpenSpace service to the Developer and End Users; and (ii) Developer to deliver the Application to End Users. Such licence will terminate immediately the End User and/or the Developer (as the case may be) ceases to use the Application to submit, post or display such Derived Data, and/or the Developer ceases to deliver the Application.

\ + \ +
2.4 End User’s Data
\ +

In the event that End User submits, posts and displays End User’s Data in or to the Application:

\ +

a)Ordnance Survey does not claim any ownership in such End User’s Data. However, for the period during which End User submits, posts, or displays such End User’s Data on the Application, End User, or Developer (as the case may be), grants to Ordnance Survey a revocable, world-wide, royalty-free, and non-exclusive licence to use, display and distribute such End User’s Data solely for the purpose of allowing (i) Ordnance Survey to deliver the OS OpenSpace service to the Developer and End Users; and (ii) Developer to deliver the Application to End Users. Such licence will terminate immediately the End User and/or Developer ceases to use the Application to submit, post or display such End User’s Data, and/or the Developer ceases to deliver the Application;

\ +

b)End User hereby warrants to Ordnance Survey that End User has all the necessary permissions and authorisations from the owners of any Intellectual Property Rights subsisting in the End User’s Data to use and grant licenses to use such Intellectual Property Rights under these Terms of Use.

\ +

2.5 Restrictions

\ +

Except as expressly permitted under these Terms of Use, the licences granted in Clauses 2.2 – 2.3 above are subject to End User complying with the following conditions.

\ +

a) End User shall not submit, post or display any advertising that, in the reasonable opinion of Ordnance Survey, may be (i) illegal, deceptive, misleading, unethical or otherwise inappropriate, or (ii) may be associated with any of the foregoing or otherwise inappropriate goods or services on or to the Application;

\ +

b) End User shall not use the Application for, or in connection with, any Financial Gain;

\ +

c) Subject to Clause 2.2(b) above and Sub-Clauses 2.5(d) below, End User shall not download, store, and/or archive the Ordnance Survey Data, in whole or in part on to a single computer (including hand held), or mobile or GPS device, save for Caching;

\ +

d) End User shall not tamper with or remove any copyright, trade mark, trade mark symbol or other proprietary notice of Ordnance Survey or its licensors affixed to, or contained in the Ordnance Survey Data.

\ +

All rights and permissions not expressly set out in this Clause 2 are expressly excluded.

\ + \ +

3 Limited Warranty; Disclaimer of Warranty

\ + \ +
3.1 Exclusions
\ +

No warranty is given that the Ordnance Survey Data shall meet End User’s particular requirements, whether operationally, functionally, accurately or otherwise, or that the Ordnance Survey Data shall be suitable for the End User’s intended purpose or that operation of the Ordnance Survey Data shall be uninterrupted or error free. Under no circumstances shall Ordnance Survey or its licensors be liable for any loss or corruption of End User’s data.

\ + \ +
3.2 Disclaimer of Warranties
\ +

Ordnance Survey and its licensors disclaim all warranties and conditions, either express or implied, with respect to the Ordnance Survey Data and further disclaim any warranty that the functions contained in the Ordnance Survey Data shall meet End User’s requirements or shall operate in combinations or in a manner selected for use by End User, or that the operation and/or provision of the Ordnance Survey Data shall be uninterrupted or error free.

\ + \ +

4 Limitation of Liability

\ + \ +
4.1 Limitation of Liability
\ +

Save in respect of death or personal injury to the extent it results from negligence or fraud, Ordnance Survey and its licensors disclaim all liability whether in contract, tort (including negligence) or otherwise for any loss or damage of whatsoever nature arising from any use of the Ordnance Survey Data or from any interruption or failure of any electronic transmission of Ordnance Survey Data.

\ \ \ + \ +
4.2 Exclusion of Consequential Damages
\ +

Under no circumstances shall Ordnance Survey and its licensors be liable (i) for costs of procurement of substitute products by End User; and (ii) in contract, tort (including negligence) or otherwise for any direct, indirect, special or consequential losses or damages, or any loss of profits, loss of business or loss of contracts.

\ + \ +
4.3 Remedies of Ordnance Survey
\ +

Ordnance Survey and/or its licensors may directly recover from the End User all amounts lawfully due in respect of any breaches of these Terms of Use by the End User (including but without limitation a breach of Clause 2.4) which cause Ordnance Survey to suffer loss or damage.

\ + \ +

5 Data Protection

\ + \ +
5.1 Data Protection
\ +

The Developer shall protect the End User’s personal data in accordance with all applicable legislation.

\ + \ +

6 Termination

\ + \ +
6.1 Termination
\ +

The Developer has the right to terminate End User’s use of the Application and/or the Ordnance Survey Data (but not the Derived Data owned by the End User pursuant to Clause 2.3(a)) immediately on notice to the End User. On termination of these Terms of Use, the licences granted to the End User herein shall terminate immediately and the End User shall take all steps reasonably possible to return or destroy the relevant Ordnance Survey Data.

\ + \ +

7 Other Terms

\ + \ +
7.1 Compliance with Laws
\ +

The End User shall comply with all applicable local and foreign laws and regulations which may govern the use of the Ordnance Survey Data and use the Ordnance Survey Data only for lawful purposes and in accordance with these Terms of Use. End User acknowledges that the Developer and its licensors exercise no control whatsoever over the Ordnance Survey Data and that it is the sole responsibility of End User to ensure that any content End User transmits and receives by means of the Application and/or the Ordnance Survey Data complies with all applicable laws.

\ + \ +
7.2 Survival
\ +

Clauses 1, 2.1, 2.3(a), 2.4(b), 3, 4, 7.2 and 7.3 inclusive shall survive termination of these Terms of Use for any reason.

\ + \ +
7.3 Governing Law and Jurisdiction
\ +

These Terms of Use shall be governed by and construed in accordance with English law and the parties submit to the exclusive jurisdiction of the English courts in respect of any proceedings issued by any party in connection with these Terms of Use

"; return L.OSOpenSpace; + return L.OSOpenSpace; })); diff --git a/demo/index.html b/demo/index.html index 4115d80..c2e5838 100644 --- a/demo/index.html +++ b/demo/index.html @@ -25,7 +25,7 @@

Leafletjs - Ordnance Survey OpenSpace Example

- +