Maps4HTML / HTML-Map-Element-UseCases-Requirements

Use cases and requirements for Maps on the Web
https://maps4html.org/HTML-Map-Element-UseCases-Requirements/
Other
22 stars 12 forks source link

Tool: Leaflet.js #29

Open AmeliaBR opened 5 years ago

AmeliaBR commented 5 years ago

This issue is for discussion of the reference tool "Leaflet.js API".


overview and docs

Placeholder for discussing issues about Leaflet as an example in the review. One issue with leaflet is that it is very open-ended. I'm planning to focus on the simplest examples / capabilities that you get out of the box.

prushforth commented 5 years ago

Open ended is good, right? That's progressive enhancement's goal, after all. But, I agree with your approach of taking the least common denominator. I believe this was central to the goal of Leaflet itself, and it's why I built my polyfill with it in the first place. Would be awesome if @IvanSanchez or @mourner could help us visualize a decent API for the eventual (proposed) <map> and <layer> DOM.

nchan0154 commented 5 years ago

Capabilities review for Leaflet is as follows. For several items, the actual Leaflet.js library does not support the capability on it's own, but there some popularopen source/plugins that can be used to perform that capability that are built specifically for Leaflet. What level of support do you think this constitutes as? @AmeliaBR

4.3.1.1 Generate a default map for a given area

Full support.

4.3.1.2 Display a map using a single custom image as a map layer

Supported, option to use WMS services as a tile layer, or a single large image.

4.3.1.3 Display a map using tile data from an author-specified web map service

Supported, this is the default behavior for Leaflet as it does not provide its own tiles.

4.3.1.4 Display a basic map without JavaScript

No support, as Leaflet is a JS library.

4.3.2.1 Show pinpoint locations or custom markers on the map

Full support for multiple markers.

4.3.2.2 Draw polygons or polylines as stylable, interactive vector graphics (separate from the image tiles)

Full support for both Polylines and Polygon vector layers.

4.3.2.3 Support hyperlinks from markers or vector features

Full support, markers or other vector featuers can have popups bound to them. These popups can contain custom HTML content, include hyperlinks.

4.3.2.4 Display map data attribution and links

Full support. Since map tiles do not come with the library, you need to pass this in as an option.

4.3.3.1 Select map view from latitude and longitude point

Full support, this is the default way to select a map view for Leaflet.

4.3.3.2 Select map view from street address or place name

No geocoders are within the actual library, but there are several plugins that offer this functionality.

4.3.3.3 Display map tiles defined in various common coordinate systems

Leaflet comes with three projections out of the box, Equirectangular, Elliptical Mercator and Spherical Mercator (AKA Web Mercator). Web Mercator is the default projection. The Proj4Leaflet library allows for other projections to be used.

4.3.3.4 Reproject map tile data into a new projection or globe view

Not supported at this moment, you can work around this by reinitializing the map in a different projection.

4.3.3.5 Save the location or export to other application

Supported with limitations? You could create your own control to do this, but it doesn't come as part of the default viewer.

4.3.4.1 Zoom the map independently from the rest of the page

Supported, buttons are keyboard accessible (but with wonky focus styles), you can also press the + and - keys to zoom when the map is focused, but again, no focus styles.

4.3.4.2 Pan the map display

Supported, pannable with arrow keys as well.

4.3.4.3 Load additional map tiles when they pan into view

Supported.

4.3.4.4 Wrap/duplicate data tiles when panning around the globe

Supported.

4.3.4.5 Maintain reasonable scale of labels and lines when zooming

This is going to depend on your tiles, but supported with OSM.

4.3.4.6 Dynamically load different resolution map tile on zoom

Supported.

4.3.4.7 Hide or show (and maybe dynamically load) vector features and labels on zoom

Supported, but depends on your tiles.

4.3.5.1 Apply custom styling to map markers and vector features

Full support, map features can be styled using syntax similar to SVG path attributes. Map markers can have custom icons.

4.3.5.2 Apply custom styling to map controls

Supported, you can edit some basic things such as positioning with JS, or you can customize the controls further with CSS.

4.3.5.3 Toggle whether default controls are displayed

Supported, you can hide controls as part of the initial configuration object.

nchan0154 commented 5 years ago

Sorry, just bumping this to get your eyes on this again! @AmeliaBR (and @prushforth if you'd like to weigh in), any opinions on what level of support Leaflet should be categorized as having if a capability is not supported the core Leaflet.js library, but there are open source plugins that provide support for that capability?

prushforth commented 5 years ago

I'm in the full support camp YMMV!

AmeliaBR commented 5 years ago

I'd consider that a "support, with limitations" if you need to install something extra. Either way, make sure the notes clearly state that a plugin is required.

AmeliaBR commented 5 years ago

Save the location or export to other application

Supported with limitations? You could create your own control to do this, but it doesn't come as part of the default viewer.

This is an end-user use case, so I wouldn't consider it supported unless it is supported by default.