Skip to content

Commit

Permalink
use dot notation
Browse files Browse the repository at this point in the history
  • Loading branch information
lathoub committed Sep 9, 2024
1 parent cf5a97e commit 6627f2b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/database/geojsonParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function makeOAPIF(geojson, dataDef) {
var property = dataDef.schema.geometry;
var item = {};
// (OAPIF P5) Requirement 9 A property with "x-ogc-role" set to "primary-geometry" SHALL be a spatial property.
if (property["role"]) item["x-ogc-role"] = property["role"].toLowerCase();
if (property.role) item["x-ogc-role"] = property.role.toLowerCase();
item.format = `${property.type}-${property.geometryType}`.toLowerCase();
geojson.schema.geometry = item;
}
Expand All @@ -89,7 +89,7 @@ export function makeOAPIF(geojson, dataDef) {
if (dataDef.queryables) {
if (dataDef.queryables.spatial) {
dataDef.queryables.spatial.forEach((geom) => {
geojson.queryables[`geometry`] = geojson.schema[geom];
geojson.queryables.geometry = geojson.schema[geom];
});
}
if (dataDef.queryables.temporal) {
Expand Down
2 changes: 1 addition & 1 deletion src/models/features/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function replacee(formatFreeUrl, collectionId, featureId, body, callback) {
collection.features.push(body);
}

var formatFreeUrl = formatFreeUrl.substr(0, formatFreeUrl.lastIndexOf("/"));
formatFreeUrl = formatFreeUrl.substr(0, formatFreeUrl.lastIndexOf("/"));
formatFreeUrl = join(formatFreeUrl, newId.toString());

return callback(undefined, body, formatFreeUrl);
Expand Down
3 changes: 1 addition & 2 deletions src/models/features/items.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as turf from "@turf/turf";
import { JSONPath } from "jsonpath-plus";
import urlJoin from "url-join";
import { getDatabases } from "../../database/database.js";
import utils from "../../utils/utils.js";
Expand Down Expand Up @@ -430,7 +429,7 @@ function get(neutralUrl, format, collectionId, query, options, callback) {
// (OAPIF P8) At a sortable resource endpoint, the operation SHALL support a parameter sortby with the following
// characteristics (using an OpenAPI Specification 3.0 fragment):
// - pattern: '[+|-]?[A-Za-z_].*'
let parts = _query["sortby"].split(",");
let parts = _query.sortby.split(",");

function fieldSorter(fields) {
return function (a, b) {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/proj4.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ const projectFeature = function (

const fromProjection = getProjByCode(codeSridFrom);
if (fromProjection == undefined) return;
const fromProj = fromProjection["proj4"];
const fromProj = fromProjection.proj4;
const toProjection = getProjByCode(codeSridTo);
if (toProjection == undefined) return;
const toProjec = toProjection["proj4"];
const toProjec = toProjection.proj4;
if (!fromProjection || !toProjection) return;

return _projectFeature(feature, fromProj, toProjec, digits);
Expand All @@ -131,10 +131,10 @@ const projectFeatureCollection = function (

const fromProjection = getProjByCode(codeSridFrom);
if (fromProjection == undefined) return;
const fromProj = fromProjection["proj4"];
const fromProj = fromProjection.proj4;
const toProjection = getProjByCode(codeSridTo);
if (toProjection == undefined) return;
const toProjec = toProjection["proj4"];
const toProjec = toProjection.proj4;
if (!fromProjection || !toProjection) return;

let features = JSON.parse(JSON.stringify(_features));
Expand All @@ -155,10 +155,10 @@ const projectBBox = function (
) {
const fromProjection = getProjByCode(codeSridFrom);
if (!fromProjection) return undefined;
const fromProj = fromProjection["proj4"];
const fromProj = fromProjection.proj4;
const toProjection = getProjByCode(codeSridTo);
if (!toProjection) return undefined;
const toProj = toProjection["proj4"];
const toProj = toProjection.proj4;
if (!fromProj || !toProj) return featureBBox;

var p1 = _point([Number(featureBBox.bbox[0]), Number(featureBBox.bbox[1])]);
Expand Down

0 comments on commit 6627f2b

Please sign in to comment.