-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable tile map #2605
Closed
Closed
Configurable tile map #2605
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
04a77e2
Enable tile maps to be configured
jimmyjones2 b60005c
Move default tilemap options into the code
jimmyjones2 e6b0742
Make jshint happy
jimmyjones2 f368fe4
Add better descriptions with hyperlinks
jimmyjones2 7040887
Add link to leaflet provider demos
jimmyjones2 5add4a8
Use object instead of concatenated string, fix links to open in new w…
jimmyjones2 79e7e68
Allow passing JSON config defaults as objects
jimmyjones2 54093c2
Merge branch 'master' into configurable-tile-map
jimmyjones2 18b6cbb
Missed change in merge
jimmyjones2 5168670
Remove WMS support, almost everything seems to be TMS and no decent W…
jimmyjones2 97c9f60
Fix long lines
jimmyjones2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
define(function (require) { | ||
return function TileMapFactory(d3, Private) { | ||
return function TileMapFactory(d3, Private, config) { | ||
var _ = require('lodash'); | ||
var $ = require('jquery'); | ||
var L = require('leaflet'); | ||
|
@@ -71,12 +71,18 @@ define(function (require) { | |
} | ||
|
||
var featureLayer; | ||
var tileLayer = L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', { | ||
attribution: 'Tiles by <a href="http://www.mapquest.com/">MapQuest</a> — ' + | ||
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + | ||
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>', | ||
subdomains: '1234' | ||
}); | ||
var tileLayer; | ||
var tileOptions = config.get('visualization:tileMap:options', '{' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather see the 2nd argument of this be an object vs a concatenated string |
||
'"attribution": "Tiles by <a href=\\"http://www.mapquest.com/\\">MapQuest</a> — ' + | ||
'Map data © <a href=\\"http://openstreetmap.org\\">OpenStreetMap</a> contributors, ' + | ||
'<a href=\\"http://creativecommons.org/licenses/by-sa/2.0/\\">CC-BY-SA</a>\", ' + | ||
'"subdomains": "1234" }' | ||
); | ||
if (config.get('visualization:tileMap:wms')) { | ||
tileLayer = L.tileLayer.wms(config.get('visualization:tileMap:url'), tileOptions); | ||
} else { | ||
tileLayer = L.tileLayer(config.get('visualization:tileMap:url'), tileOptions); | ||
} | ||
|
||
var mapOptions = { | ||
minZoom: 2, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link here indicates this controls a function that takes an object, but the value is a boolean? I think I understand from the code what this is supposed todo, but I don't think other users will.
Also note that all links should target an empty window to avoid redirecting the user out of the application when they click them.