Skip to content

Commit

Permalink
Satellite view added
Browse files Browse the repository at this point in the history
  • Loading branch information
grassick committed Aug 8, 2013
1 parent 0e97cd6 commit 516e71e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
14 changes: 10 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ module.exports = function(grunt) {
src: '*',
dest: 'dist/img/'
},
leafletimages: {
// leafletimages: { We don't use default marker
// expand: true,
// cwd: 'vendor/leaflet/images/',
// src: '*',
// dest: 'dist/img/leaflet/'
// },
leafletcssimages: {
expand: true,
cwd: 'vendor/leaflet/images/',
src: '*',
dest: 'dist/img/leaflet/'
src: 'layers*',
dest: 'dist/css/images/'
},
cordova_www: {
expand: true,
Expand Down Expand Up @@ -197,7 +203,7 @@ module.exports = function(grunt) {

grunt.registerTask('cordova', ['default', 'copy:cordova_www', 'copy:cordova_override_debug']);

grunt.registerTask('copy-app', ['copy:apphtml', 'copy:appimages', 'copy:libimages', 'copy:leafletimages']);
grunt.registerTask('copy-app', ['copy:apphtml', 'copy:appimages', 'copy:libimages', 'copy:leafletcssimages']);
grunt.registerTask('default', ['browserify', 'seeds', 'concat', 'copy-app', 'handlebars', 'manifest']);

grunt.registerTask('deploy_demo', ['default', 'shell:deploy_demo']);
Expand Down
13 changes: 13 additions & 0 deletions app/js/map/baseLayers.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


exports.createOSMLayer = ->
mapquestUrl = 'http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png'
subDomains = ['otile1','otile2','otile3','otile4']
mapquestAttrib = 'Data, imagery and map information provided by <a href="http://open.mapquest.co.uk" target="_blank">MapQuest</a>, <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> and contributors.'
return new L.TileLayer(mapquestUrl, {maxZoom: 18, attribution: mapquestAttrib, subdomains: subDomains})

exports.createSatelliteLayer = ->
mapquestUrl = 'http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png'
subDomains = ['otile1','otile2','otile3','otile4']
mapquestAttrib = 'Data, imagery and map information provided by <a href="http://open.mapquest.co.uk" target="_blank">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
return new L.TileLayer(mapquestUrl, {maxZoom: 18, attribution: mapquestAttrib, subdomains: subDomains})
14 changes: 12 additions & 2 deletions app/js/pages/SourceMapPage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Page = require "../Page"
SourceDisplay = require '../map/SourcesLayer' # TODO
LocationDisplay = require '../map/LocationDisplay'
ContextMenu = require '../map/ContextMenu'
baseLayers = require '../map/baseLayers'

# Map of water sources. Options include:
# initialGeo: Geometry to zoom to. Point only supported.
Expand All @@ -21,8 +22,17 @@ class SourceMapPage extends Page
# Recalculate on resize
$(window).on('resize', @resizeMap)

# Setup map tiles
setupMapTiles().addTo(@map)
# Setup base layers
osmLayer = baseLayers.createOSMLayer()
satelliteLayer = baseLayers.createSatelliteLayer()

osmLayer.addTo(@map)
baseLayers =
"OpenStreetMap": osmLayer
"Satellite": satelliteLayer

# Create layer control
L.control.layers(baseLayers).addTo(@map)

# Setup marker display when map is loaded
@map.whenReady =>
Expand Down

0 comments on commit 516e71e

Please sign in to comment.