Skip to content

fix relative protocol clientside for tile urls #526

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

Merged
merged 5 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ BREAKING CHANGES

BUG FIXES AND FEATURES

* Relative protocols are used where possible when adding tiles (#526). In RStudio 1.1.x on linux and windows, a known issue of 'https://' routes fail to load, but works within browsers (rstudio/rstudio#2661).

* Added more providers for `addProviderTiles()`: "OpenStreetMap.CH", "OpenInfraMap", "OpenInfraMap.Power", "OpenInfraMap.Telecom", "OpenInfraMap.Petroleum", "OpenInfraMap.Water", "OpenPtMap", "OpenRailwayMap", "OpenFireMap", "SafeCast". (4aea447)

* `L.multiPolyline` was absorbed into `L.polyline`, which accepts multiple an array of polyline information. http://leafletjs.com/reference-1.3.0.html#polyline. (#515)

* Fix bug where icons where anchored to the top-center, not center-center (2a60751)
Expand Down
2 changes: 1 addition & 1 deletion R/layers.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ groupOptions <- function(map, group, zoomLevels = NULL) {
#' @export
addTiles <- function(
map,
urlTemplate = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
urlTemplate = "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
attribution = NULL,
layerId = NULL,
group = NULL,
Expand Down
Binary file modified data/providers.details.rda
Binary file not shown.
Binary file modified data/providers.rda
Binary file not shown.
66 changes: 51 additions & 15 deletions inst/htmlwidgets/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var ClusterLayerStore = function () {
exports.default = ClusterLayerStore;


},{"./util":16}],2:[function(require,module,exports){
},{"./util":17}],2:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -194,7 +194,7 @@ function getCRS(crsOptions) {
}


},{"./global/leaflet":9,"./global/proj4leaflet":10}],4:[function(require,module,exports){
},{"./global/leaflet":10,"./global/proj4leaflet":11}],4:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -320,7 +320,7 @@ var DataFrame = function () {
exports.default = DataFrame;


},{"./util":16}],5:[function(require,module,exports){
},{"./util":17}],5:[function(require,module,exports){
"use strict";

var _leaflet = require("./global/leaflet");
Expand Down Expand Up @@ -352,7 +352,7 @@ if (typeof _leaflet2.default.Icon.Default.imagePath === "undefined") {
}


},{"./global/leaflet":9}],6:[function(require,module,exports){
},{"./global/leaflet":10}],6:[function(require,module,exports){
"use strict";

var _leaflet = require("./global/leaflet");
Expand Down Expand Up @@ -385,7 +385,41 @@ _leaflet2.default.Tooltip.prototype._initLayout = function () {
};


},{"./global/leaflet":9}],7:[function(require,module,exports){
},{"./global/leaflet":10}],7:[function(require,module,exports){
"use strict";

var _leaflet = require("./global/leaflet");

var _leaflet2 = _interopRequireDefault(_leaflet);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var protocolRegex = /^\/\//;
var upgrade_protocol = function upgrade_protocol(urlTemplate) {
if (protocolRegex.test(urlTemplate)) {
if (window.location.protocol === "file:") {
// if in a local file, support http
// http should auto upgrade if necessary
urlTemplate = "http:" + urlTemplate;
}
}
return urlTemplate;
};

var originalLTileLayerInitialize = _leaflet2.default.TileLayer.prototype.initialize;
_leaflet2.default.TileLayer.prototype.initialize = function (urlTemplate, options) {
urlTemplate = upgrade_protocol(urlTemplate);
originalLTileLayerInitialize.call(this, urlTemplate, options);
};

var originalLTileLayerWMSInitialize = _leaflet2.default.TileLayer.WMS.prototype.initialize;
_leaflet2.default.TileLayer.WMS.prototype.initialize = function (urlTemplate, options) {
urlTemplate = upgrade_protocol(urlTemplate);
originalLTileLayerWMSInitialize.call(this, urlTemplate, options);
};


},{"./global/leaflet":10}],8:[function(require,module,exports){
(function (global){
"use strict";

Expand All @@ -396,7 +430,7 @@ exports.default = global.HTMLWidgets;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],8:[function(require,module,exports){
},{}],9:[function(require,module,exports){
(function (global){
"use strict";

Expand All @@ -407,7 +441,7 @@ exports.default = global.jQuery;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],9:[function(require,module,exports){
},{}],10:[function(require,module,exports){
(function (global){
"use strict";

Expand All @@ -418,7 +452,7 @@ exports.default = global.L;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
(function (global){
"use strict";

Expand All @@ -429,7 +463,7 @@ exports.default = global.L.Proj;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],11:[function(require,module,exports){
},{}],12:[function(require,module,exports){
(function (global){
"use strict";

Expand All @@ -440,7 +474,7 @@ exports.default = global.Shiny;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],12:[function(require,module,exports){
},{}],13:[function(require,module,exports){
"use strict";

var _jquery = require("./global/jquery");
Expand Down Expand Up @@ -479,6 +513,8 @@ require("./fixup-default-icon");

require("./fixup-default-tooltip");

require("./fixup-url-protocol");

var _dataframe = require("./dataframe");

var _dataframe2 = _interopRequireDefault(_dataframe);
Expand Down Expand Up @@ -760,7 +796,7 @@ if (_htmlwidgets2.default.shinyMode) {
}


},{"./cluster-layer-store":1,"./control-store":2,"./crs_utils":3,"./dataframe":4,"./fixup-default-icon":5,"./fixup-default-tooltip":6,"./global/htmlwidgets":7,"./global/jquery":8,"./global/leaflet":9,"./global/shiny":11,"./layer-manager":13,"./methods":14,"./util":16}],13:[function(require,module,exports){
},{"./cluster-layer-store":1,"./control-store":2,"./crs_utils":3,"./dataframe":4,"./fixup-default-icon":5,"./fixup-default-tooltip":6,"./fixup-url-protocol":7,"./global/htmlwidgets":8,"./global/jquery":9,"./global/leaflet":10,"./global/shiny":12,"./layer-manager":14,"./methods":15,"./util":17}],14:[function(require,module,exports){
(function (global){
"use strict";

Expand Down Expand Up @@ -1185,7 +1221,7 @@ exports.default = LayerManager;


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./global/jquery":8,"./global/leaflet":9,"./util":16}],14:[function(require,module,exports){
},{"./global/jquery":9,"./global/leaflet":10,"./util":17}],15:[function(require,module,exports){
(function (global){
"use strict";

Expand Down Expand Up @@ -2467,7 +2503,7 @@ methods.removeSelect = function () {


}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./cluster-layer-store":1,"./crs_utils":3,"./dataframe":4,"./global/htmlwidgets":7,"./global/jquery":8,"./global/leaflet":9,"./global/shiny":11,"./mipmapper":15,"./util":16}],15:[function(require,module,exports){
},{"./cluster-layer-store":1,"./crs_utils":3,"./dataframe":4,"./global/htmlwidgets":8,"./global/jquery":9,"./global/leaflet":10,"./global/shiny":12,"./mipmapper":16,"./util":17}],16:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -2574,7 +2610,7 @@ var Mipmapper = function () {
exports.default = Mipmapper;


},{}],16:[function(require,module,exports){
},{}],17:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -2616,4 +2652,4 @@ function asArray(value) {
}


},{}]},{},[12]);
},{}]},{},[13]);
10 changes: 0 additions & 10 deletions inst/htmlwidgets/lib/leaflet-providers/CONTRIBUTING.md

This file was deleted.

63 changes: 0 additions & 63 deletions inst/htmlwidgets/lib/leaflet-providers/README.md

This file was deleted.

25 changes: 0 additions & 25 deletions inst/htmlwidgets/lib/leaflet-providers/bower.json

This file was deleted.

Loading