Skip to content
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

Map / Add ESRI ArcGIS Rest support #3914

Closed
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: 1 addition & 3 deletions schemas/iso19139/src/main/plugin/iso19139/loc/eng/labels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2267,9 +2267,7 @@
<label>Protocol</label>
<description>Connection protocol to be used</description>
<helper sort="true">
<option value="ESRI:AIMS--http--configuration">ArcIMS Map Service Configuration File (*.AXL)</option>
<option value="ESRI:AIMS--http-get-feature">ArcIMS Internet Feature Map Service</option>
<option value="ESRI:AIMS--http-get-image">ArcIMS Internet Image Map Service</option>
<option value="ESRI:REST">ArcGIS REST Services</option>
<option value="GLG:KML-2.0-http-get-map">Google Earth KML service (ver 2.0)</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
Expand Down
4 changes: 1 addition & 3 deletions schemas/iso19139/src/main/plugin/iso19139/loc/fre/labels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4350,9 +4350,7 @@ la non-évaluation</b>, dans le cadre de métadonnées INSPIRE
<help>Protocole de connexion utilisé, par exemple FTP.</help>
<condition/>
<helper sort="true">
<option value="ESRI:AIMS--http--configuration">Fichier configuration ArcIMS Map Service (*.AXL)</option>
<option value="ESRI:AIMS--http-get-feature">ArcIMS Internet Feature Map Service</option>
<option value="ESRI:AIMS--http-get-image">ArcIMS Internet Image Map Service</option>
<option value="ESRI:REST">ArcGIS REST Services</option>
<option value="GLG:KML-2.0-http-get-map">Google Earth KML service (ver 2.0)</option>
<option value="OGC:CSW">OGC-CSW Catalogue Service for the Web</option>
<option value="OGC:KML">OGC-KML Keyhole Markup Language</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,67 @@
return defer.promise;
},

addEsriRestFromScratch: function(map, url, name, createOnly, md) {
var defer = $q.defer();
var $this = this;

var serviceUrl = url.replace(/(.*\/MapServer).*/, '$1')
var layer = url.replace(/.*\/([^\/]*)\/MapServer\/?(.*)/, '$2');
name = url.replace(/.*\/([^\/]*)\/MapServer\/?(.*)/, '$1 $2');

if (!isLayerInMap(map, name, url)) {
gnWmsQueue.add(url, name);
var params = {};
if (layer != '') {
params.LAYERS = layer;
}
var layerOptions = {
url: url,
opacity: 1,
visible: true,
source: new ol.source.ImageArcGISRest({
// ratio: 1.01,
params: params,
url: serviceUrl
})
};

olL = new ol.layer.Image(layerOptions);

olL.set('name', name);
olL.set('label', name);
olL.displayInLayerManager = true;
// FIXME: Layer tree visibility toggle does not work
olL.visible = layerOptions.visible;

var finishCreation = function() {
$q.resolve(olL).
then(gnViewerSettings.getPreAddLayerPromise).
finally(
function() {
if (!createOnly) {
map.addLayer(olL);
}
gnWmsQueue.removeFromQueue(url, name);
defer.resolve(olL);
});
};

var feedMdPromise = md ?
$q.resolve(md).then(function(md) {
olL.set('md', md);
}) : $this.feedLayerMd(olL);

feedMdPromise.then(finishCreation);
} else {
var olL = getTheLayerFromMap(map, name, url);
if(olL && md) {
olL.set('md', md);
}
}
return defer.promise;
},

/**
* Call a WMS getCapabilities and create ol3 layers for all items.
* Add them to the map if `createOnly` is false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
};

var addWMSToMap = gnViewerSettings.resultviewFns.addMdLayerToMap;

var addEsriRestToMap = gnViewerSettings.resultviewFns.addMdLayerToMap;

var addWFSToMap = function(link, md) {
var url = $filter('gnLocalized')(link.url) || link.url;
Expand Down Expand Up @@ -209,6 +209,11 @@
label: 'addToMap',
action: addWFSToMap
},
'ESRI:REST' : {
iconClass: 'fa-globe',
label: 'addToMap',
action: addEsriRestToMap
},
'ATOM' : {
iconClass: 'fa-globe',
label: 'download'
Expand Down Expand Up @@ -350,6 +355,8 @@
} else {
return 'WMSSERVICE';
}
} else if (protocolOrType.match(/esri/i)) {
return 'ESRI:REST';
} else if (protocolOrType.match(/wmts/i)) {
return 'WMTS';
} else if (protocolOrType.match(/tms/i)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ <h2>{{::title}}</h2>
sosLinkDetails</span>
</div>

<div data-ng-switch-when="ESRI:REST">
<span data-translate=""
data-translate-values="{url:'{{r.url | gnLocalized: lang}}', layer:'{{r.title | gnLocalized: lang}}'}">
esriRestLinkDetails</span>
</div>

<div data-ng-switch-when="WCS">
<p class="text-muted">
<span data-translate=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
angular.extend(md, {
links: md.getLinksByType('LINK'),
downloads: md.getLinksByType('DOWNLOAD'),
layers: md.getLinksByType('OGC', 'kml'),
layers: md.getLinksByType('OGC', 'kml', 'ESRI:REST'),
contacts: md.getContacts(),
overviews: md.getThumbnails() ? md.getThumbnails().list : undefined
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@
};

function addLayerFromLocation(config) {
if (angular.isUndefined(config.name)) {
if (angular.isUndefined(config.name) && config.type !== 'esrirest') {
// This is a service without a layer name
// Display the add layer from service panel

gnViewerService.openTool('addLayers', 'services');
scope.activeTools.addLayers = true;
scope.addLayerTabs.services = true;
scope.addLayerUrl[config.type || 'wms'] = config.url;
} else if (config.name) {
} else if (config.name || config.type === 'esrirest') {
gnViewerService.openTool('layers');

var loadLayerPromise = gnMap[
config.type === 'wmts' ?
'addWmtsFromScratch' : 'addWmsFromScratch'
config.type === 'wmts' ? 'addWmtsFromScratch' :
(config.type === 'esrirest' ? 'addEsriRestFromScratch' : 'addWmsFromScratch')
](
scope.map, config.url,
config.name, undefined, config.md);
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/main/resources/catalog/js/CatController.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ goog.require('gn_alert');
'linkTypes': {
'links': ['LINK', 'kml'],
'downloads': ['DOWNLOAD'],
'layers': ['OGC'],
'layers': ['OGC', 'ESRI:REST'],
'maps': ['ows']
},
'isFilterTagsDisplayedInSearch': false,
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/main/resources/catalog/lib/ngeo/ngeo-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -77765,7 +77765,7 @@ ol.source.ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixe
params['BBOX'] = extent.join(',');
params['BBOXSR'] = srid;
params['IMAGESR'] = srid;
params['DPI'] = 90 * pixelRatio;
params['DPI'] = Math.round(90 * pixelRatio);

var url = this.url_;

Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/main/resources/catalog/lib/ngeo/ngeo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/locales/en-search.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"noRecordFoundWithResourceRegistered": "No record found with one or more WMS layers registered.",
"noRecordFoundWithResourceRegisteredmap": "No record found with one or more maps registered.",
"tmsLinkDetails":"This dataset is published in the view service (TMS) available at <a href='{{url}}' target='_blank'>{{url}}</a> with identifier <strong>{{layer}}</strong>.",
"esriRestLinkDetails": "ESRI REST service <a href='{{url}}' target='_blank'>{{url}}</a>.",
"wmsLinkDetails": "This dataset is published in the view service (WMS) available at <a href='{{url}}' target='_blank'>{{url}}</a> with layer name <strong>{{layer}}</strong>.",
"wmsServiceLinkDetails": "This dataset is published in the view service (WMS) available at <a href='{{url}}' target='_blank'>{{url}}</a>.",
"wmtsLinkDetails": "This dataset is published in the view service (WMTS) available at <a href='{{url}}' target='_blank'>{{url}}</a> with identifier <strong>{{layer}}</strong>.",
Expand Down
3 changes: 2 additions & 1 deletion web-ui/src/main/resources/catalog/views/default/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
'OGC:WMTS',
'OGC:WMS-1.1.1-http-get-map',
'OGC:WMS-1.3.0-http-get-map',
'OGC:WFS'
'OGC:WFS',
'ESRI:REST'
],
services: [
'OGC:WMS-1.3.0-http-get-capabilities',
Expand Down
4 changes: 3 additions & 1 deletion web-ui/src/main/resources/catalog/views/default/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@
addMdLayerToMap: function (link, md) {
var config = {
uuid: md ? md.getUuid() : null,
type: link.protocol.indexOf('WMTS') > -1 ? 'wmts' : 'wms',
type:
link.protocol.indexOf('WMTS') > -1 ? 'wmts' :
(link.protocol == 'ESRI:REST' ? 'esrirest' : 'wms'),
url: $filter('gnLocalized')(link.url) || link.url
};

Expand Down