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 c98343a commit cf5a97e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/database/geojsonParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export function makeOAPIF(geojson, dataDef) {
var property = dataDef.schema.properties[propertyName];

var item = {};
if (property["label"]) item.title = property["label"];
if (property["description"]) item.description = property["description"];
if (property["type"]) item.type = property["type"];
if (property["format"]) item.format = property["format"];
if (property.label) item.title = property.label;
if (property.description) item.description = property.description;
if (property.type) item.type = property.type;
if (property.format) item.format = property.format;
// (OAPIF P5) Requirement 4 The keyword "x-ogc-role" SHALL be used to declare a specific role of the property
// (OAPIF P5) Requirement 5 A property with "x-ogc-role" set to "id" SHALL be the identifier of the
// item in the collection that contains the item.
Expand All @@ -70,7 +70,7 @@ export function makeOAPIF(geojson, dataDef) {
// Requirement 14A: A property with "x-ogc-role" set to "type" SHALL be a string property.
// Requirement 14B: At most one property in a schema SHALL have "x-ogc-role" with a value "type".
// else if (item.type == 'string') item['x-ogc-role'] = 'type'
if (property["role"]) item["x-ogc-role"] = property["role"].toLowerCase();
if (property.role) item["x-ogc-role"] = property.role.toLowerCase();
if (property.values) item.enum = property.values;

geojson.schema[propertyName] = item;
Expand All @@ -81,8 +81,8 @@ export function makeOAPIF(geojson, dataDef) {
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();
item["format"] = `${property.type}-${property.geometryType}`.toLowerCase();
geojson.schema["geometry"] = item;
item.format = `${property.type}-${property.geometryType}`.toLowerCase();
geojson.schema.geometry = item;
}

geojson.queryables = {};
Expand Down
10 changes: 5 additions & 5 deletions src/models/features/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,20 +408,20 @@ function get(neutralUrl, format, collectionId, query, options, callback) {
// - title
// - description
// - keywords
if (_query["q"]) {
if (_query.q) {
// Req 1: If a single search term is specified, then only resources that contain that search term in one or
// more of the searched text fields SHALL be in the result set.
// Req 2: For multiple search terms that are comma separated (logical OR), only resources that contain one
// or more the specified search terms in one or more of the searched text fields SHALL be in the result set.
// Req 3: For multiple search terms that are white space separated, only resources that contain all the search terms
// specified, in the order specified and separated by any number of white spaces in one or more of the
// searched text fields SHALL be in the result set.
var parts = _query["q"].split(",");
var parts = _query.q.split(",");

delete _query["q"];
delete _query.q;
}

if (_query["sortby"]) {
if (_query.sortby) {
// (OAPIF P8) Requirement 6A: If the sortby parameter is specified, then the resources in a response SHALL be ordered by
// the keys and sort directions (i.e. ascending or descending) specified.
// Requirement 6B: The specific set of keys that may be used for sorting SHALL be specified by
Expand Down Expand Up @@ -457,7 +457,7 @@ function get(neutralUrl, format, collectionId, query, options, callback) {

features.sort(fieldSorter(parts));

delete _query["sortby"];
delete _query.sortby;
}

if (_query.skipGeometry === "true") doSkipGeometry = true;
Expand Down

0 comments on commit cf5a97e

Please sign in to comment.