I'm wondering about the process of creating a custom imagery provider. The API I'm using takes GET requests and sends back a JSON array, one parameter of which is an image url. These images need to be requested via a specific lat/lon point, and each image is 0.025 degrees in width and height; ie one image request for every 0.025x0.025 square on the globe. Clearly this is a lot of requests, so it'd need to be limited to a certain zoom level.
Here's an example of the current URL request structure:
https://api.nasa.gov/planetary/earth/imagery?lon=100.75&lat=1.5&date=2014-02-01&cloud_score=True&api_key=DEMO_KEY
I'm in contact with the guys who run the API, and could potentially have it return more Cesium-friendly responses.
To clarify: basically, the question is about URL structures - the API I'm using does not have one URL as in the example below, it requires individual requests to be made for each lat/lon point.
var provider = new Cesium.WebMapServiceImageryProvider({
url: '//sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer',
layers : '0',
proxy: new Cesium.DefaultProxy('/proxy/')
});
viewer.imageryLayers.addImageryProvider(provider);
This type of imagery service is very atypical for the type of visualization you want to do. If the tiles are not hierarchical and instead one flat layer of millions of tiles (which is what it sounds like), you’ll need to write your own TilingScheme and probably a custom ImageryProvider as well. Since you only have one level, there’s no way to show it until you are zoomed in close enough to the earth so that you only load a reasonable number of files, so you’ll have to use a different layer for any non-close to the earth views. By implementing a custom scheme, you can ensure you generate tiles that are 0.025x0.025. Implementing the imagery provider should be trivial once you have the scheme down. You can use the TileCoordinatesImageryProvider to help debug your TilingScheme and load a couple of images for reference using SingleTileImageryProvider.
Sorry I don’t have a silver bullet solution for you, but the above should definitely work (it’s just a little more involved).
That's fine, I wasn't expecting any sort of pre-made solution. I'm aware the imagery service isn't ideal, but the Landsat satellites only take these images at one resolution/zoom level. And yes, I believe there would be close to 100 million of these 0.025°x0.025° tiles to fill the globe, so limiting to a zoom level is exactly what I'd like to do - happy to use the Bing (or equivalent) imagery until that threshold.
Do you know of any working examples of a custom TilingScheme? I already have a (semi) working solution just using SingleTileImageryProvider that just finds the centre of the viewport at a certain zoom level, and then gets images for all 0.025°x0.025° tiles in the viewport. I'm not familiar with the TilingScheme method, though.
While LandSat is only taking the imagery at 1 level, you can use the gdal tools to merge and/or retile the imagery into the hierarchical structure Matt was referring to. Generally when using GDAL people generate a TMS and move all the files to their web server.