Skip to content

Commit

Permalink
Merge pull request #579 from cmv/feature/replace-spatialreference.org
Browse files Browse the repository at this point in the history
Replace spatialreference.org with epsg.io to support https scheme.
  • Loading branch information
DavidSpriggs authored Aug 7, 2016
2 parents 17350d7 + 273dc54 commit b38cb8a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
28 changes: 14 additions & 14 deletions viewer/js/gis/dijit/MapInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ define([
scaleLabel: '1:',
zoomLabel: 'Z:',
minWidth: 0,
proj4BaseURL: 'https://epsg.io/',
proj4Catalog: null,
proj4Wkid: null,
proj4CustomURL: null,
Expand Down Expand Up @@ -99,27 +100,26 @@ define([
this._mode = 3;
} else {
this._mode = 4;
// spatialreference.org uses the old
// Proj4js style so we need an alias
// https://github.com/proj4js/proj4js/issues/23
window.Proj4js = proj4;
//load custom projection file or default to spatialreference.org
if (!this.proj4Catalog && !this.proj4Wkid && !this.proj4CustomURL) {
if (!window.proj4) {
window.proj4 = proj4;
}
if (this.proj4Wkid) {
wkid = this.proj4Wkid;
}
//load custom projection file or default to epsg.io
if (!this.proj4Catalog && !wkid && !this.proj4CustomURL) {
topic.publish('viewer/handleError', {
source: 'MapInfo',
error: 'MapInfo error::a proj4Catalog/proj4Wkid or custom URL must be defined'
});
return;
}
if (this.proj4CustomURL) {
require([this.proj4CustomURL], lang.hitch(this, function () {
this._projectionLoaded = true;
this._projection = this.proj4Catalog + ':' + this.proj4Wkid;
}));
} else {
require(['http://spatialreference.org/ref/' + this.proj4Catalog.toLowerCase() + '/' + this.proj4Wkid + '/proj4js/'], lang.hitch(this, function () {
var key = this.proj4Catalog + ':' + String(wkid);
this._projection = key;
if (!proj4.defs[key]) {
var url = this.proj4CustomURL || this.proj4BaseURL + String(wkid) + '.js';
require([url], lang.hitch(this, function () {
this._projectionLoaded = true;
this._projection = this.proj4Catalog + ':' + this.proj4Wkid;
}));
}
}
Expand Down
23 changes: 11 additions & 12 deletions viewer/js/gis/dijit/StreetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ define([
panoOptions: null,

// in case this changes some day
proj4BaseURL: 'http://spatialreference.org/',
proj4BaseURL: 'https://epsg.io/',

// options are ESRI, EPSG and SR-ORG
// See http://spatialreference.org/ for more information
// See http://sepsg.io/ for more information
proj4Catalog: 'EPSG',

// if desired, you can load a projection file from your server
// instead of using one from spatialreference.org
// instead of using one from epsg.io
// i.e., http://server/projections/102642.js
projCustomURL: null,
proj4CustomURL: null,

postCreate: function () {
this.inherited(arguments);
Expand Down Expand Up @@ -78,10 +78,9 @@ define([
this.own(topic.subscribe(this.parentWidget.id + '/resize/resize', lang.hitch(this, 'resize')));
}

// spatialreference.org uses the old
// Proj4js style so we need an alias
// https://github.com/proj4js/proj4js/issues/23
window.Proj4js = proj4;
if (!window.proj4) {
window.proj4 = proj4;
}

if (this.mapRightClickMenu) {
this.addRightClickMenu();
Expand Down Expand Up @@ -175,9 +174,9 @@ define([
if (wkid === 102100) {
wkid = 3857;
}
var key = this.proj4Catalog + ':' + wkid;
var key = this.proj4Catalog + ':' + String(wkid);
if (!proj4.defs[key]) {
var url = this.proj4CustomURL || this.proj4BaseURL + 'ref/' + this.proj4Catalog.toLowerCase() + '/' + wkid + '/proj4js/';
var url = this.proj4CustomURL || this.proj4BaseURL + String(wkid) + '.js';
require([url], lang.hitch(this, 'getStreetView', evt, true));
return;
}
Expand Down Expand Up @@ -261,9 +260,9 @@ define([
if (wkid === 102100) {
wkid = 3857;
}
var key = this.proj4Catalog + ':' + wkid;
var key = this.proj4Catalog + ':' + String(wkid);
if (!proj4.defs[key]) {
var url = this.proj4CustomURL || this.proj4BaseURL + 'ref/' + this.proj4Catalog.toLowerCase() + '/' + wkid + '/proj4js/';
var url = this.proj4CustomURL || this.proj4BaseURL + String(wkid) + '.js';
require([url], lang.hitch(this, 'setPlaceMarkerPosition'));
return;
}
Expand Down

0 comments on commit b38cb8a

Please sign in to comment.