GithubHelp home page GithubHelp logo

rob-murray / os-openspace-openlayers-wms Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 425 KB

A new Openlayers WMS Layer for using Ordnance Survey Openspace map tiles

License: Other

JavaScript 100.00%

os-openspace-openlayers-wms's Introduction

A new OpenLayers WMS Layer for using Ordnance Survey OpenSpace service

Haz Commitz Status

Description

This is a new OpenLayers WMS Layer which uses Ordnance Survey OpenSpace service. This can be used to access Ordnance Survey tiles without using the OS OpenSpace API which is tied to a certain version of OpenLayers and often behind the latest release.

!! This service requires an API KEY - @see http://www.ordnancesurvey.co.uk/oswebsite/web-services/os-openspace/

This layer uses the OS OpenSpace Free service and the mapstack is defined for this service.

ScreenShot

Contents

This repository contains the following sections:

  1. src - this contains the source.
  2. demo - this contains a simple demo to show the functionality

Getting started

How to use:

  1. Obtain an Ordnance Survey OpenSpace API Key for your domain. @see http://www.ordnancesurvey.co.uk/oswebsite/web-services/os-openspace/

  2. Copy this library to your project - grab the OSOpenspace.js file

  3. Import OpenLayers code - grab a production minified version or host this yourself

<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
  1. Import this library after the OpenLayers.js import
<script type="text/javascript" src="OSOpenspace.js"></script>
  1. Create new layer and add to map
<script type="text/javascript">

var map, layer;
var key = "YOUR_KEY";

var e = 437303;
var n = 115542;

var zoom = 5;

function init(){
    map = new OpenLayers.Map( 'map' );
    
    layer = new OpenLayers.Layer.OSOpenSpace("OS Openspace", key, {});
        
    map.addLayer(layer);

    map.setCenter(new OpenLayers.LonLat(e, n), zoom);
    map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
        
</script>

Please checkout the demo for full working example, with your API key of course.

Contributions

Please use the GitHub pull-request mechanism to submit contributions.

License

This project is available for use under the MIT software license. See LICENSE

os-openspace-openlayers-wms's People

Contributors

rob-murray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

os-openspace-openlayers-wms's Issues

How to convert LonLat to North-East points?

We have already used below transform method but nor getting conversion

var lonLat = new OpenLayers.LonLat(51.89507,-1.16028).transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());

Our map variable is
map = new OpenLayers.Map('map');

We are using "OSOpenSpace".
layer = new OpenLayers.Layer.OSOpenSpace("OS Openspace", key, url, {});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.