Skip to content

Commit

Permalink
Merge in development
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Dec 16, 2024
2 parents 45b9518 + dd8a4ab commit 8de139a
Show file tree
Hide file tree
Showing 95 changed files with 389 additions and 122,271 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/spice/kernels/*
!/spice/kernels/.gitkeep
/Missions/spice-kernels-conf.json
!/Missions/spice-kernels-conf.example.json
!/Missions/spice-kernels-conf.example*json

/build/*
/data/*
Expand Down
4 changes: 2 additions & 2 deletions API/Backend/Geodatasets/models/geodatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ function makeNewGeodatasetTable(
sequelize
.query("SELECT MAX(id) FROM geodatasets")
.then(([results]) => {
let newTable =
"g" + (parseInt(results[0].max) + 1) + "_geodatasets";
const max = parseInt(results[0].max);
let newTable = "g" + ((isNaN(max) ? 0 : max) + 1) + "_geodatasets";

Geodatasets.create({
name: name,
Expand Down
22 changes: 20 additions & 2 deletions API/Backend/Geodatasets/routes/geodatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ router.post("/entries", function (req, res, next) {
* req.body.value
* req.body.id (specific feature id instead of key:value)
* req.body.orderBy
* req.body.restrictToGeometryType
* req.body.offset (i.e. if -1, then return feature previous to key:val) (can also be 'first' or 'last')
*/
router.post("/search", function (req, res, next) {
Expand Down Expand Up @@ -424,19 +425,36 @@ router.post("/search", function (req, res, next) {
)}, ${Utils.forceAlphaNumUnder(parseFloat(maxy))}, 4326), geom)`;
}

const geometryTypes = [
"Point",
"LineString",
"Polygon",
"MultiPoint",
"MultiLineString",
"MultiPolygon",
];

const geomTypeWhere =
geometryTypes.indexOf(req.body.restrictToGeometryType) != -1
? " AND geometry_type = :geomtype"
: "";

let q =
`SELECT properties, ST_AsGeoJSON(geom), id FROM ${Utils.forceAlphaNumUnder(
table
)}` +
(req.body.last || offset != null
? `${where} ORDER BY id ${offset != null ? "ASC" : "DESC LIMIT 1"}`
: " WHERE properties ->> :key = :value");
? `${where}${geomTypeWhere} ORDER BY id ${
offset != null && !req.body.last ? "ASC" : "DESC LIMIT 1"
}`
: ` WHERE properties ->> :key = :value${geomTypeWhere}`);

sequelize
.query(q + ";", {
replacements: {
orderBy: orderBy || "id",
key: req.body.key,
geomType: req.body.restrictToGeometryType,
value:
typeof req.body.value === "string"
? req.body.value.replace(/[`;'"]/gi, "")
Expand Down
14 changes: 11 additions & 3 deletions API/Backend/Users/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,17 @@ router.post("/login", function (req, res) {
clearLoginSession(req);

req.session.regenerate((err) => {
let MMGISUser = req.cookies.MMGISUser
? JSON.parse(req.cookies.MMGISUser)
: false;
let MMGISUser;
try {
let userCookie = req.cookies.MMGISUser;
if (typeof userCookie === "string" && userCookie.endsWith("}undefined"))
userCookie = userCookie.substring(0, userCookie.length - 9);

MMGISUser = userCookie ? JSON.parse(userCookie) : false;
} catch (err) {
res.send({ status: "failure", message: "Malformed MMGISUser cookie." });
return;
}
let username = req.body.username || (MMGISUser ? MMGISUser.username : null);

if (username == null) {
Expand Down
213 changes: 2 additions & 211 deletions API/templates/config_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
tools: [
{
name: "Layers",
icon: "buffer",
icon: "layers",
js: "LayersTool",
},
{
Expand All @@ -61,215 +61,6 @@ module.exports = {
icon: "information-variant",
js: "InfoTool",
},
{
name: "Sites",
icon: "pin",
js: "SitesTool",
variables: {
sites: [
{
name: "Site1",
code: "S1",
view: [-4.667975771815966, 137.370253354311, 16],
},
{
name: "Site2",
code: "S2",
view: [-4.667985128408622, 137.3702734708786, 20],
},
],
},
},
{
name: "Chemistry",
icon: "flask",
js: "ChemistryTool",
},
{
name: "Draw",
icon: "lead-pencil",
js: "DrawTool",
},
{
name: "FileManager",
icon: "folder-multiple",
js: "FileManagerTool",
},
{
name: "Identifier",
icon: "map-marker",
js: "IdentifierTool",
variables: {
"Tile with DEM": {
url: "Data/missionDEM.tif",
unit: "m",
},
},
},
{
name: "Measure",
icon: "chart-areaspline",
js: "MeasureTool",
variables: {
dem: "Data/missionDEM.tif",
},
},
],
layers: [
{
name: "A Header",
type: "header",
initialOpacity: 1,
sublayers: [
{
name: "S1 Drawings",
kind: "none",
type: "vector",
url: "Drawn/S1_speDrawings.geojson",
tms: true,
visibility: false,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "s1drawings",
color: "undefined",
fillColor: "undefined",
weight: null,
fillOpacity: 1,
opacity: 1,
},
variables: {},
radius: 1,
},
{
name: "S2 Drawings",
kind: "none",
type: "vector",
url: "Drawn/S2_speDrawings.geojson",
tms: true,
visibility: false,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "s2drawings",
color: "undefined",
fillColor: "undefined",
weight: null,
fillOpacity: 1,
opacity: 1,
},
variables: {},
radius: 1,
},
{
name: "ChemCam",
kind: "none",
type: "vector",
url: "Layers/ChemCam/chemcam.json",
tms: true,
visibility: true,
visibilitycutoff: 17,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "chemcam",
color: "prop:color1",
fillColor: "prop:color3",
weight: 2,
fillOpacity: 1,
opacity: 1,
},
variables: {
useKeyAsName: "TARGET",
chemistry: [
"Al2O3",
"CaO",
"FeOT",
"K2O",
"MgO",
"Na2O",
"SiO2",
"TiO2",
],
search: "(TARGET)",
},
radius: 5,
},
{
name: "Waypoints",
kind: "none",
type: "vector",
url: "Layers/Waypoints/waypoints.json",
legend: "Layers/Waypoints/legend.csv",
tms: true,
visibility: true,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "waypoints",
color: "white",
fillColor: "#000",
weight: 2,
fillOpacity: 1,
opacity: 1,
},
variables: {},
radius: 8,
},
{
name: "Polygon",
kind: "none",
type: "vector",
url: "Layers/Polygon/polygon.geojson",
tms: true,
visibility: false,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "polygon",
color: "prop:somecolor",
fillColor: "prop:fill",
weight: 2,
fillOpacity: 0.7,
opacity: 1,
},
variables: {},
radius: 4,
},
{
name: "Line",
kind: "none",
type: "vector",
url: "Layers/Line/line.json",
tms: true,
visibility: false,
initialOpacity: 1,
togglesWithHeader: true,
style: {
className: "line",
color: "white",
fillColor: "white",
weight: 5,
fillOpacity: 1,
opacity: 1,
},
variables: {},
radius: 1,
},
{
name: "Tile with DEM",
type: "tile",
url: "Layers/TilewithDEM/Gale_HiRISE/{z}/{x}/{y}.png",
demtileurl: "Layers/TilewithDEM/Gale_HiRISE_DEM/{z}/{x}/{y}.png",
tms: true,
visibility: true,
initialOpacity: 1,
togglesWithHeader: true,
minZoom: 16,
maxNativeZoom: 17,
maxZoom: 22,
},
],
},
],
layers: [],
};
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Disable Globe more thoroughly when off
Additional Body Metadata for Draw Webhooks
Remove restriction on Layer names
Check for empty time configs in TimeControl
Dropdown in the topbar for a selected features properties links
Dropdown in the topbar for a selected feature's properties links

#### Fixed

Expand Down
55 changes: 55 additions & 0 deletions Missions/spice-kernels-conf.example.mars2020.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"body": {
"description": "If the MMGIS ENV 'SPICE_SCHEDULED_KERNEL_DOWNLOAD=true', then at every other midnight, MMGIS will read /Missions/spice-kernels-conf.json and re/download all the specified kernels to /spice/kernels.'body' names and 'target' names must be valid NAIF SPICE names/ids. Meta-kernels (.tm) can also be set for download by using an object instead of a string (see example below).",
"MARS": {
"description": "MARS",
"kernels": [
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls",
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00011.tpc",
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de440.bsp",
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/spk/mar097s.bsp",
"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/mars_iau2000_v1.tpc"
],
"targets": {
"MARS2020": {
"description": "M20 - Mars2020 Rover",
"kernels": [
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/spk/m2020_atls_ops210303_v1.bsp",
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/spk/m2020_ls_ops210303_iau2000_v1.bsp",
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/sclk/M2020_168_SCLKSCET.00009.tsc",
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/sclk/m2020_lmst_ops210303_v1.tsc",
"https://naif.jpl.nasa.gov/pub/naif/MARS2020/kernels/fk/m2020_v04.tf"
]
},
"-74": {
"description": "MRO - Mars Reconnaissance Orbiter",
"kernels": [
"https://naif.jpl.nasa.gov/pub/naif/MRO/kernels/spk/mro_psp.bsp"
]
},
"-202": {
"description": "MVN - MAVEN - Mars Atmosphere and Volatile Evolution",
"kernels": [
"https://naif.jpl.nasa.gov/pub/naif/MAVEN/kernels/spk/maven_orb.bsp"
]
},
"-53": {
"description": "ODY - 2001 Mars Odyssey",
"kernels": [
"https://naif.jpl.nasa.gov/pub/naif/M01/kernels/spk/m01_map.bsp"
]
},
"-143": {
"description": "TGO - ExoMars Trace Gas Orbiter",
"kernels": [
{
"url": "https://naif.jpl.nasa.gov/pub/naif/EXOMARS2016/kernels/mk/em16_ops.tm",
"mkRoot": "https://naif.jpl.nasa.gov/pub/naif/EXOMARS2016/kernels",
"mkRegex": ".*/spk/em16_tgo_fsp.*_01_202[4-9].*.bsp"
}
]
}
}
}
}
}
Loading

0 comments on commit 8de139a

Please sign in to comment.