Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var bboxMinCoord1, bboxMinCoord2, bboxMaxCoord1, bboxMaxCoord2, urn;
// We only support CRS84 and EPSG:4326
if (parameter.crs.indexOf("crs84") !== -1) {
// CRS84 uses long, lat rather that lat, long order.
bboxMinCoord1 = CesiumMath.toDegrees(value.west);
bboxMinCoord2 = CesiumMath.toDegrees(value.south);
bboxMaxCoord1 = CesiumMath.toDegrees(value.east);
bboxMaxCoord2 = CesiumMath.toDegrees(value.north);
// Comfortingly known as WGS 84 longitude-latitude according to Table 3 in OGC 07-092r1.
urn = "urn:ogc:def:crs:OGC:1.3:CRS84";
} else {
// The URN value urn:ogc:def:crs:EPSG:6.6:4326 shall mean the Coordinate Reference System (CRS) with code
// 4326 specified in version 6.6 of the EPSG database available at http://www.epsg.org/. That CRS specifies
// the axis order as Latitude followed by Longitude.
// We don't know about other URN versions, so are going to return 6.6 regardless of what was requested.
bboxMinCoord1 = CesiumMath.toDegrees(value.south);
bboxMinCoord2 = CesiumMath.toDegrees(value.west);
bboxMaxCoord1 = CesiumMath.toDegrees(value.north);
bboxMaxCoord2 = CesiumMath.toDegrees(value.east);
urn = "urn:ogc:def:crs:EPSG:6.6:4326";
}
return {
inputType: "BoundingBoxData",
inputValue:
bboxMinCoord1 +
"," +
bboxMinCoord2 +
"," +
bboxMaxCoord1 +
"," +
bboxMaxCoord2 +
if (parameter.crs.indexOf("crs84") !== -1) {
// CRS84 uses long, lat rather that lat, long order.
bboxMinCoord1 = CesiumMath.toDegrees(value.west);
bboxMinCoord2 = CesiumMath.toDegrees(value.south);
bboxMaxCoord1 = CesiumMath.toDegrees(value.east);
bboxMaxCoord2 = CesiumMath.toDegrees(value.north);
// Comfortingly known as WGS 84 longitude-latitude according to Table 3 in OGC 07-092r1.
urn = "urn:ogc:def:crs:OGC:1.3:CRS84";
} else {
// The URN value urn:ogc:def:crs:EPSG:6.6:4326 shall mean the Coordinate Reference System (CRS) with code
// 4326 specified in version 6.6 of the EPSG database available at http://www.epsg.org/. That CRS specifies
// the axis order as Latitude followed by Longitude.
// We don't know about other URN versions, so are going to return 6.6 regardless of what was requested.
bboxMinCoord1 = CesiumMath.toDegrees(value.south);
bboxMinCoord2 = CesiumMath.toDegrees(value.west);
bboxMaxCoord1 = CesiumMath.toDegrees(value.north);
bboxMaxCoord2 = CesiumMath.toDegrees(value.east);
urn = "urn:ogc:def:crs:EPSG:6.6:4326";
}
return {
inputType: "BoundingBoxData",
inputValue:
bboxMinCoord1 +
"," +
bboxMinCoord2 +
"," +
bboxMaxCoord1 +
"," +
bboxMaxCoord2 +
"," +
urn
function launch(wmsCatalogItem, bbox) {
// // At the moment just grab the screen extent
// // Calculate view extent in degrees
// const bbox = wmsCatalogItem.terria.currentViewer.getCurrentExtent();
bbox.west = CesiumMath.toDegrees(bbox.west);
bbox.south = CesiumMath.toDegrees(bbox.south);
bbox.east = CesiumMath.toDegrees(bbox.east);
bbox.north = CesiumMath.toDegrees(bbox.north);
const query = {
service: "WCS",
request: "GetCoverage",
version: "1.0.0",
format: "GeoTIFF",
crs: "EPSG:4326",
width: 1024,
height: Math.round((1024 * bbox.height) / bbox.width),
coverage: wmsCatalogItem.linkedWcsCoverage,
bbox: `${bbox.west},${bbox.south},${bbox.east},${bbox.north}`
};
if (defined(wmsCatalogItem.discreteTime)) {
query.time = wmsCatalogItem.discreteTime.toISOString();
function launch(wmsCatalogItem, bbox) {
// // At the moment just grab the screen extent
// // Calculate view extent in degrees
// const bbox = wmsCatalogItem.terria.currentViewer.getCurrentExtent();
bbox.west = CesiumMath.toDegrees(bbox.west);
bbox.south = CesiumMath.toDegrees(bbox.south);
bbox.east = CesiumMath.toDegrees(bbox.east);
bbox.north = CesiumMath.toDegrees(bbox.north);
const query = {
service: "WCS",
request: "GetCoverage",
version: "1.0.0",
format: "GeoTIFF",
crs: "EPSG:4326",
width: 1024,
height: Math.round((1024 * bbox.height) / bbox.width),
coverage: wmsCatalogItem.linkedWcsCoverage,
bbox: `${bbox.west},${bbox.south},${bbox.east},${bbox.north}`
};
if (defined(wmsCatalogItem.discreteTime)) {
query.time = wmsCatalogItem.discreteTime.toISOString();
}
function launch(wmsCatalogItem, bbox) {
// // At the moment just grab the screen extent
// // Calculate view extent in degrees
// const bbox = wmsCatalogItem.terria.currentViewer.getCurrentExtent();
bbox.west = CesiumMath.toDegrees(bbox.west);
bbox.south = CesiumMath.toDegrees(bbox.south);
bbox.east = CesiumMath.toDegrees(bbox.east);
bbox.north = CesiumMath.toDegrees(bbox.north);
const query = {
service: "WCS",
request: "GetCoverage",
version: "1.0.0",
format: "GeoTIFF",
crs: "EPSG:4326",
width: 1024,
height: Math.round((1024 * bbox.height) / bbox.width),
coverage: wmsCatalogItem.linkedWcsCoverage,
bbox: `${bbox.west},${bbox.south},${bbox.east},${bbox.north}`
};
functionParameterToInput: function(catalogFunction, parameter, value) {
var bboxMinCoord1, bboxMinCoord2, bboxMaxCoord1, bboxMaxCoord2, urn;
// We only support CRS84 and EPSG:4326
if (parameter.crs.indexOf("crs84") !== -1) {
// CRS84 uses long, lat rather that lat, long order.
bboxMinCoord1 = CesiumMath.toDegrees(value.west);
bboxMinCoord2 = CesiumMath.toDegrees(value.south);
bboxMaxCoord1 = CesiumMath.toDegrees(value.east);
bboxMaxCoord2 = CesiumMath.toDegrees(value.north);
// Comfortingly known as WGS 84 longitude-latitude according to Table 3 in OGC 07-092r1.
urn = "urn:ogc:def:crs:OGC:1.3:CRS84";
} else {
// The URN value urn:ogc:def:crs:EPSG:6.6:4326 shall mean the Coordinate Reference System (CRS) with code
// 4326 specified in version 6.6 of the EPSG database available at http://www.epsg.org/. That CRS specifies
// the axis order as Latitude followed by Longitude.
// We don't know about other URN versions, so are going to return 6.6 regardless of what was requested.
bboxMinCoord1 = CesiumMath.toDegrees(value.south);
bboxMinCoord2 = CesiumMath.toDegrees(value.west);
bboxMaxCoord1 = CesiumMath.toDegrees(value.north);
bboxMaxCoord2 = CesiumMath.toDegrees(value.east);
urn = "urn:ogc:def:crs:EPSG:6.6:4326";
}
function addBoundingBox(requestData, rectangle) {
requestData["box"] = {
minLat: CesiumMath.toDegrees(rectangle.south),
maxLon: CesiumMath.toDegrees(rectangle.east),
maxLat: CesiumMath.toDegrees(rectangle.north),
minLon: CesiumMath.toDegrees(rectangle.west)
};
}
function positionToLatLng(position, prevLayer) {
var cartographic = Ellipsoid.WGS84.cartesianToCartographic(
position,
cartographicScratch
);
let lon = CesiumMath.toDegrees(cartographic.longitude);
if (prevLayer) {
if (prevLayer._latlng.lng - lon > 180) {
lon = lon + 360;
} else if (prevLayer._latlng.lng - lon < -180) {
lon = lon - 360;
}
}
return L.latLng(CesiumMath.toDegrees(cartographic.latitude), lon);
}
function convertEntityPositionsToLatLons(positions) {
var carts = Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
var latlngs = [];
let lastLongitude = null;
for (var p = 0; p < carts.length; p++) {
let lon = CesiumMath.toDegrees(carts[p].longitude);
if (lastLongitude - lon > 180) {
lon = lon + 360;
} else if (lastLongitude - lon < -180) {
lon = lon - 360;
}
latlngs.push(L.latLng(CesiumMath.toDegrees(carts[p].latitude), lon));
lastLongitude = lon;
}
return latlngs;
}
var rectangleToPolygonArray = function(rectangle) {
var sw = Rectangle.southwest(rectangle),
se = Rectangle.southeast(rectangle),
nw = Rectangle.northwest(rectangle),
ne = Rectangle.northeast(rectangle);
return [
[
[CesiumMath.toDegrees(sw.longitude), CesiumMath.toDegrees(sw.latitude)],
[CesiumMath.toDegrees(se.longitude), CesiumMath.toDegrees(se.latitude)],
[CesiumMath.toDegrees(ne.longitude), CesiumMath.toDegrees(ne.latitude)],
[CesiumMath.toDegrees(nw.longitude), CesiumMath.toDegrees(nw.latitude)],
[CesiumMath.toDegrees(sw.longitude), CesiumMath.toDegrees(sw.latitude)]
]
];
};