Skip to content

Commit

Permalink
Fixed Issue #11455 MapQuest discontinued their free services
Browse files Browse the repository at this point in the history
dev changed to OpenStreetmaps official added all OSM-layers
  • Loading branch information
Markus Flür committed Jul 18, 2016
1 parent 9fe0cf0 commit 50456e1
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions scripts/map.js
Expand Up @@ -43,38 +43,54 @@ function isvalidCoord(val){

// OSMap functions
function OSGeoInitialize(question,latLng){
var tileServerURL = {
OSM : "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}",
HUM : "http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}",
CYC : "http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}",
TRA : "http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}"
};
var name = question.substr(0,question.length - 2);
// tiles layers def
// If not latLng is set the Map will center to Hamburg
var MapOption=LSmaps[name];
if(isNaN(MapOption.latitude) || MapOption.latitude==""){
MapOption.latitude=0;
MapOption.latitude=53.582665;
}
if(isNaN(MapOption.longitude) || MapOption.longitude==""){
MapOption.longitude=0;
MapOption.longitude=10.018924;
}
var mapquestOSM = L.tileLayer("http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png", {
var mapOSM = L.tileLayer(tileServerURL.OSM+".png", {
maxZoom: 19,
subdomains: ["otile1", "otile2", "otile3", "otile4"],
attribution: 'Tiles courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>. Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA.'
subdomains: ["a", "b", "c"],
attribution: 'Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA.'
});
var mapquestOAM = L.tileLayer("http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg", {
maxZoom: 10,
subdomains: ["oatile1", "oatile2", "oatile3", "oatile4"],
attribution: 'Tiles courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
var mapCYC = L.tileLayer(tileServerURL.CYC+".png", {
maxZoom: 19,
subdomains: ["a", "b", "c"],
attribution: 'Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA.'
});
var mapquestHYB = L.layerGroup([L.tileLayer("http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg", {
maxZoom: 10,
subdomains: ["oatile1", "oatile2", "oatile3", "oatile4"]
}), L.tileLayer("http://{s}.mqcdn.com/tiles/1.0.0/hyb/{z}/{x}/{y}.png", {
var mapHOT = L.layerGroup([L.tileLayer(tileServerURL.HUM+".png", {
maxZoom: 20,
subdomains: ["a", "b", "c"],
}), L.tileLayer(tileServerURL+".png", {
maxZoom: 19,
subdomains: ["a", "b", "c"],
attribution: 'Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA.'
})]);
var mapTRA = L.layerGroup([L.tileLayer(tileServerURL.TRA+".png", {
maxZoom: 19,
subdomains: ["a", "b", "c"],
}), L.tileLayer(tileServerURL+".png", {
maxZoom: 19,
subdomains: ["oatile1", "oatile2", "oatile3", "oatile4"],
attribution: 'Labels courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>. Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
subdomains: ["a", "b", "c"],
attribution: 'Map data © <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA.'
})]);

var baseLayers = {
"Street Map": mapquestOSM,
"Aerial Imagery": mapquestOAM,
"Imagery with Streets": mapquestHYB
"Street Map": mapOSM,
"Humanitarian": mapHOT,
"Cyclemap": mapCYC,
"Traffic Map" : mapTRA
};
var overlays = {
};
Expand All @@ -83,7 +99,7 @@ function OSGeoInitialize(question,latLng){
minZoom:1,
center: [MapOption.latitude, MapOption.longitude] ,
maxBounds: ([[-90, -180],[90, 180]]),
layers: [mapquestOSM]
layers: [mapOSM]
});
//function zoomExtent(){ // todo: restrict to rect ?
// map.setView([15, 15],1);
Expand Down

2 comments on commit 50456e1

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS : tested : seems to be apply in lts too.

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Please sign in to comment.