-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
OGC helper #2362
OGC helper #2362
Conversation
- SortRequired libraries (ant sortRequire) - modify OGCCapabilities and OGCHelper in order to be compliant with JSHint - add coverage tests for OGCCapabilities and OGCHelper
I made a sandCastle example but while I tested it, I had an issue with tiles using WebMercatorTilingScheme. I have no issue with tile using GeographicTilingScheme. The error stack is in attachment. The sandCastle code for my contribution is :
|
@kaktus40, with all of the holiday festivities I haven't have a chance to look at this yet; but I just wanted to say thanks! |
Hello, thanks for the congratulations. Maybe I should explain my code and detail some use cases of my contribution. I don't see any change on this pull and maybe it's difficult to apprehend? |
More explanation is welcomed. I suspect no one has reviewed this yet because everyone is quite busy and the review will be a good amount of work. 😄 |
Purposes:Parsing server resources:All the resources available from a server can be analysed. OGCHelper can parse the datas and provide exploitable functions to retrieve useful things from classical parameters for tiles (x, y, level). Following OGC standards:I made OGCHelper the most compliant to OGC standards and it can parse resource files from:
Proposing available services via an unique interface: OGCCapabilities
Being a low level componentOGCHelper can be used for an ImageryProvider (see code in previous comment where I adjust only requestImage function with an OGCCapabilities object) or a TerrainProvider (see my plugin GeoserverTerrainProvider) Designing to be generic and easily extended:Today, Cesium manages two different tilingScheme with their respective projection and ellipsoid (GeographicTilingScheme and WebMercatorTilingScheme), but maybe tomorrow there will be a new tilingScheme, a new projection and a new ellipsoid to use. In the other hand, server can propose their data following lots of datum and not only Coordinate Referential System 84 (or EPSG 4326). To make it easy to add a new tilingScheme, I regroup them in one array (see OGCHelper.CRS). The parameters of each element are used to parse the capabilities of a layer. The same reasoning was used for :
How toExplanationsFor a basic use, OGCHelper just needs 2 options:
OGCHelper.parser function returns a promise of array. Each element of the returned array has two attributes : layerName (name of the layer) and capabilities (object that follows OGCCapabilities contract interface). The most important attribute is ready. If it's true, it means that the capabilities object have a function that converts a tile identifier (x, y and level parameters) into an URL. This URL could be requested to have the data of the identified tile. Depending on the resources, the function(s) to convert a tile identifier into an URL can be:
formatFeatureInfo indicates eventually the format of feature info that could be used to have the most precise datas for a position. If this attribute is available, in combination with:
The most important function of OGCCapabilities is getTileDataAvailable that determines if datas are available for a tile. The availability of a tile is defining only from parsing a resource file. When dimensions and styles attributes are available (length of array greater than 0). Each URL conversion function will take in consideration a default behaviour. The default style that will be use in this case is the first of styles array. For each dimension available for the layer, a default parameter is defined. The default behaviour can be change via options when getURLXXX functions are called. Examplevar service='WMTS';
var url='http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/1.0.0/WMTSCapabilities.xml';
var formatImage={format : 'image/tiff',extension: 'tif'}; //defining an optional format image
var promise=Cesium.OGCHelper.parser({service:,url:url,formatImage:formatImage});
promise.then(function(capabilitiesTab){
//capabilitiesTab have a length of 1
capabilitiesTab.forEach(function(element){
console.log(element.layerName);//name of the layer
var capabilities=element.capabilities;
console.log(capabilities.rectangle);//the rectangle limiting the capabilities
console.log(capabilities.maxLevel);//the maximum level available for these capabilities
console.log(capabilities.getURLImage(0,1,0));// should return "http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/WorldTimeZones/default/default028mm/0/1/0.png"
// there is no getURLArray, formatImage or formatArray functions.
//if the resource had a dimension named 'elevation', an other named 'time', a style named 'blue' and a formatFeatureInfo available then:
/*
console.log(capabilities.getURLImage(0,1,0,{style:"blue",dimensions:[{name:"elevation",value:"300"}]}));// should return something like "http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/WorldTimeZones/blue/2011-10-04/300/default028mm/0/1/0.png"
console.log(capabilities.getURLFeatureInfoArray(0,1,0,{style:"blue",dimensions:[{name:"elevation",value:"300"}],i:30,j:15}));/should return something like "http://sampleserver6.arcgisonline.com/WMTS?service=WMTS&request=GetFeatureInfo&version=1.0.0&layer=WorldTimeZones&style=blue&format=image/blunt&TileMatrixSet=default028mm&TileMatrix=0&TileRow=1&TileCol=0&time=2011-10-04&elevation=300&i=30&j=15&infoFormat=info/blunt"
*/
});
}); Why to use OGCHelper
Sorry for this chapter which seems more an advertising... |
Thanks @kaktus40. Will this replace the WMS GetCapabilities work we did a while back but never finished? Sounds like this will be a great contribution to Cesium. I suspect we'll need to at least work on the code organization and naming. @kring are you up for reviewing this? |
Yes, but it will be a little bit before I get to it, sorry. |
Hello for information, I could retrieve 89 OGCCapabilities objects from nationalmap.nicta.com.au : var retour;Cesium.OGCHelper.parser({service:'WMS',url:'http://nationalmap.nicta.com.au/proxy/http://geoserver-nm.nicta.com.au/geotopo_250k/ows'}).then(function(tab){console.log(tab.length);retour=tab;}) |
Hello, |
Conflicts: Source/Renderer/Uniform.js Source/Renderer/UniformArray.js
Hello, I'd like to work on WFS / GML in the same process I used for OGC Helper but I don't have orientations on the code (do I follow the spirit of Cesium??) and I can't capitalize on your critics. Maybe should I create a new class for ISO 8601 validation? |
Hi @kaktus40. First, sorry for the long delay in reviewing this. There are two reasons I've been procrastinating merging this, or even giving it a full review:
Let me elaborate on the second point. Having some code to query OGC metadata services and provide useful information is, of course, really valuable for a lot of applications. But that doesn't mean it needs to be part of Cesium. Why not make this a separate library? Cesium could then have a simple
Is there a strong reason to tightly couple this functionality with Cesium? |
You mentioned above that one motivation for writing this was the incomplete or incorrect support for querying metadata in Leaflet, for example, does not include any WMS metadata querying capabilities, yet its It doesn't have built-in WMTS support, but the WMTS plugin takes the same approach: |
Hello, To follow your path, I should make a library or a plug in. Why not, there is no strong reason to be in Cesium, I thought this is a plus like in openLayer (see here and here). After all, I made OGCHelper to be extensible (see the arrays beetwen Line 50 and Line 171) and relatively independent of Cesium (save Ellipsoid and tilingScheme definitions). I don't work with ArcGisServer but from your code it seems the return of feature information request is a specific xml. Also OGCHelper can provide a way to request but can't give a way to compute the return. Is there a future evolution/contribution to give a way to compute any return of feature information in Cesium? From Cesium forums, it seems Cesium will implements WFS vectors layer. Does it means you will provide a way to compute GML? Maybe in a datasource? So to sum up the remaining work:
|
I have a question: dimension (like time or wavelength see here...) will be a functionality for tile Provider? |
@kring what's the status of this? Do you think this something we might want to add or can this be closed? |
Closing given that this hasn't been updated in a while. Thanks all for the support, and please re-open separate PRs for things appropriate for core Cesium. |
Hello,
like I said in my mail with the CLA, I make a contributition that can parse the capabilities of Web Map Service, Tile Map Service and Web Map Tile Service.
I can't find a public server that don't have a CORS restriction also it's difficult to make a sandCastle example.
Nevertheless, if you have an accessible WMS, TMS or WMTS, you can use this code:
var tabCapabilities;
Cesium.OGCHelper.parser({service:'XXX',url:'URL'}).then(function(tab){console.log(tab);tabCapabilities=tab});
console.log(tabCapabilities);
where
It's my first pull and I fear that it's a poor contribution also I'm waiting your remarks