GithubHelp home page GithubHelp logo

rob-murray / os-leaflet Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 8.0 1.78 MB

A Leafletjs TileLayer using Ordnance Survey OpenSpace web map service

Home Page: http://rob-murray.github.io/os-leaflet/

License: MIT License

JavaScript 100.00%
leafletjs os-leaflet os-openspace

os-leaflet's People

Contributors

jimbacon avatar rob-murray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

os-leaflet's Issues

Add host Url as parameter when creating tile layer

When applying for an OSOpenSpace API key it is associated with a project url. It appears from the example provided by OS that this should be included as the URL parameter in the WMS request as part of the authentication process. Currently this is hard-coded as URL: 'file:///' which is allowed for testing purposes. It would be good to allow this to be overriden by a user-supplied value.

Logo control not removed with layer

When switching between multiple layers, if the OS layer is removed, the logo control remains. If the OS layer is added back then another logo control is added. You end up with multiple logos.

https

Change the hardcoded OS tile url to '//openspace.ordnancesurvey.co.uk/osmapapi/ts', so it works with both http and https websites

Attribution

Update the Attribution displayed on each map view. Possibly a link to the OS product page? so long as they dont change it too often :)

TypeError: b is undefined with leaflet 1.0 Beta

When using leaflet 1.0 beta, the error "TypeError: b is undefined" is thrown from line 1516 in leaflet-src.js. This getProjectedBounds function expects to see a bounds object in (I think) the CRS.projection.

From the Leaflet 1.0 beta changelog for 'TileLayer API improvements':

"Improved tile wrapping and bounding logic in TileLayer to work transparently and completely depent [sic] on the CRS used; removed the need for TileLayer hacks when using custom projections."

If you need more info or testing etc, I'm happy to help, but this is likely slightly deeper than I've been able to understand so far...

minNativeZoom: 0 and minZoom: negative int results in Uncaught Error: Attempted to load an infinite number of tiles

When minNativeZoom: 0 and a negative minZoom value are set on the tile layer, zooming out results in Uncaught Error: Attempted to load an infinite number of tiles

To reproduce set options as follows in OSOpenSpace.js:

options = L.extend({
        crs: L.OSOpenSpace.CRS,
        tileSize: 200,
        minNativeZoom: 0,
        maxNativeZoom: 0,
        maxZoom: 0,
        minZoom: -2
}, options);`

Here are two minimal tests to show the issue.
os-leaflet
https://5amc.cf/test/os.html

open street maps with the same options passed scales the zoom level 0 tiles as expected.
https://5amc.cf/test/l.html

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
		  minNativeZoom: 0,
		  maxNativeZoom: 0,
		  maxZoom: 0,
		  minZoom: -2
	}).addTo(map);

Any ideas what might be the cause? I'm happy to investigate but would appreciate pointers if you have any.

Options parameter ignored

The options parameter of the the factory method L.OSOpenSpace.tilelayer is ignored. It is passed as the third argument to L.TileLayer.WMS.prototype.initialize() which only takes 2 parameters.

OSGB36 Projection not working

The OSGB36 Proj4Leaflet implementation is not transforming from EPSG3857 to projected units correctly.

So, creating a LatLng in EPSG3857 creates a x,y in the wrong position, markers and overlays are not usable.

Refactor; move CRS implementation out of client code

Developers should not have to paste in the CRS implementation into their code; messy and error prone - move it out.

pseudo code example

var osMap = L.OS.Map.getOSMap(); //map with osgb36 projection

osMap.setView([x,y], 3);

add support for https://osdatahub.os.uk/ (has free tier)

miracles can happen!

well, maybe

https://osdatahub.os.uk/ now has a free tier

it just doesn't give an example of what the tile sets look like,
and if they include the 1:25 & 1:50 mapping

it supports osgb and web-mercator projections ... but not for all tile sets

Road | EPSG:27700 | Road_27700 | EPSG:27700
Road | EPSG:3857 | Road_3857 | EPSG:3857
Outdoor | EPSG:27700 | Outdoor_27700 | EPSG:27700
Outdoor | EPSG:3857 | Outdoor_3857 | EPSG:3857
Light | EPSG:27700 | Light_27700 | EPSG:27700
Light | EPSG:3857 | Light_3857 | EPSG:3857
Leisure | EPSG:27700 | Leisure_27700 | EPSG:27700

I've checked 'outdoor'. No footpaths.

The 'leisure' tile set is in osgb only, so i cant check it

This might help for use with leaflet
'https://osdatahubapi.os.uk/OSMapsAPI/wmts/v1?key=API_KEY&service=WMTS&request=GetTile&outputformat=image/png'
+ 'style=default&layer=Outdoor_3857&tileMatrixSet=EPSG:3857&tileMatrix={z}&tileRow={y}&tileCol={x}'

please could you see if its worth supporting...

andrew

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.