We are trying to use the UrlTemplateImageryProvider to render tiles that we are also rendering in OpenLayers. These tiles are served from our server in a z,x,-y format, and we have put together an url as follows: /bla/{z}/{x}/{reverseY}.png
We built the tiles using gdal2tiles. tilemapresource.xml included below.
We are having complete difficulty with passing in options and having CesiumJS request the right tiles.
If we just pass in the url, we get requests for images with the correct z and x values but the y value is off by thousands, for example a y value (it is in Hawaii) that is requested is 29166 but the y tiles that we have for that z and x run in the range of 363xx.
This is our main question -- why are these Y values incorrect?
Secondary question: how do we use a bounding rectangle:
If we pass in a rectangle in the options, there is no rectangle defined in the constructed UrlTemplateImageryProvider, and in ImageryLayer.js on line 442, rectangle is undefined for our imageryProvider:
var imageryBounds = Rectangle.intersection(imageryProvider.rectangle, this._rectangle, imageryBoundsScratch);
(here is our rectangle:
east: 0.3392507670702749
north: -2.709084989512464
south: -2.710495394056505
west: 0.3381396085358207)
In UrlTemplateImageryProvider on line 561 when it is initializing, it calls:
that._rectangle = defaultValue(properties.rectangle, that._tilingScheme.rectangle);
// at this point it has our rectangle
that._rectangle = Rectangle.intersection(that._rectangle, that._tilingScheme.rectangle);
In this case the intersection fails, and that._rectangle becomes undefined.
If we construct our own tiling scheme with bounds:
tilingScheme: new WebMercatorTilingScheme({rectangleSouthwestInMeters: new Cartesian2(258425.85, 2143816.56),
rectangleNortheastInMeters: new Cartesian2(267007.87, 2150754.24)})
the intersection still fails and that._rectangle is undefined.
However in this case, we shouldn't have to use a rectangle as it's already set in our tiling scheme
If we set imageryProvider.rectangle after we construct it and it is ignored, then the imagery is never requested.
The tilemapresource.xml is as follows:
<?xml version="1.0" encoding="utf-8"?>
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
<Title>kilauea_pan_sharp_101617.tif</Title>
<Abstract></Abstract>
<SRS>EPSG:900913</SRS>
<BoundingBox minx="19.37397245530835" miny="-155.29994646908671" maxx="19.43763714970252" maxy="-155.21913624130707"/>
<Origin x="19.37397245530835" y="-155.29994646908671"/>
<TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
<TileSets profile="mercator">
<TileSet href="12" units-per-pixel="38.21851413574219" order="12"/>
<TileSet href="13" units-per-pixel="19.10925706787109" order="13"/>
<TileSet href="14" units-per-pixel="9.55462853393555" order="14"/>
<TileSet href="15" units-per-pixel="4.77731426696777" order="15"/>
<TileSet href="16" units-per-pixel="2.38865713348389" order="16"/>
<TileSet href="17" units-per-pixel="1.19432856674194" order="17"/>
<TileSet href="18" units-per-pixel="0.59716428337097" order="18"/>
<TileSet href="19" units-per-pixel="0.29858214168549" order="19"/>
<TileSet href="20" units-per-pixel="0.14929107084274" order="20"/>
</TileSets>
</TileMap>
We are on Cesium 1.38.0, OSX and Chrome.
Unfortunately we have left this until the last minute and it is now urgent. Any help is greatly greatly appreciated.
Thanks
Tamar
p.s. we tried to also include the naturalearthii example but the url in the documentation no longer points to the tiles, what is the correct url? The documentation states:
var tms = new Cesium.UrlTemplateImageryProvider({
url : 'https://cesiumjs.org/tilesets/imagery/naturalearthii/{z}/{x}/{reverseY}.jpg',
credit : '© Analytical Graphics, Inc.',
tilingScheme : new Cesium.GeographicTilingScheme(),
maximumLevel : 5
});