Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Ordnance Survey is the national mapping agency for Great Britain and produces a
- Data Hub Explorer: [https://labs.os.uk/prototyping/data-hub-explorer/](https://labs.os.uk/prototyping/data-hub-explorer/)
- Free Software: [Open Government License](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/)

**Note:** This package is under active development.

## Contents <!-- omit in toc -->

- [osdatahub (JavaScript)](#osdatahub-javascript)
Expand Down Expand Up @@ -136,7 +134,7 @@ Different APIs support different search operations. Let's explore them...

---

The OS NGD API can be accessed via `osdatahub.ngd`. For further information on using the OS NGD API and its capabilities, please refer to the [OS Data Hub](https://osdatahub.os.uk/docs/ofa/overview) documentation and technical specification.
The OS NGD (National Geographic Database) API can be accessed via `osdatahub.ngd`. For further information on using the OS NGD API and its capabilities, please refer to the [OS Data Hub](https://osdatahub.os.uk/docs/ofa/overview) documentation and technical specification.

#### [**Features (Collection Items)**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/ngd.features.html)

Expand Down Expand Up @@ -241,7 +239,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

#### [**Point-Based Radius**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/placesAPI.radius.html)

Expand All @@ -260,7 +258,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

#### [**Nearest Feature**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/placesAPI.nearest.html)

Expand Down Expand Up @@ -291,7 +289,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

#### [**UPRN (Unique Property Reference Number)**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/placesAPI.uprn.html)

Expand All @@ -304,7 +302,7 @@ osdatahub.placesAPI.uprn(apiKey, uprnIdentifer, {});
Parameters:

- `apiKey` (string) - Your OS Data Hub API Key
- `uprnIdentifier` (integer) - A valid UPRN identifer
- `uprnIdentifier` (integer) - A valid UPRN identifier

#### [**Postcode (Full or Partial)**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/placesAPI.postcode.html)

Expand All @@ -322,7 +320,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

#### [**Find (Plain Text Search)**](https://ordnancesurvey.github.io/osdatahub-js/docs/functions/placesAPI.find.html)

Expand All @@ -340,7 +338,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

<br>

Expand Down Expand Up @@ -379,7 +377,7 @@ Parameters:
Optional Parameters (add as named arguments e.g. `{crs: 27700}`):

- `offset` (integer, default 0) - The starting position to collect features
- `limit` (integrer, default 1,000) - The maximum number of features to return
- `limit` (integer, default 1,000) - The maximum number of features to return

## Authors

Expand Down
34 changes: 17 additions & 17 deletions docs/assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
e || !t || !t.__esModule
? ae(n, "default", { value: t, enumerable: !0 })
: n,
t
t,
)
);
var de = _e((ce, he) => {
Expand Down Expand Up @@ -73,7 +73,7 @@
continue;
}
throw new TypeError(
"clone is not deep and does not support nested objects"
"clone is not deep and does not support nested objects",
);
}
return n;
Expand Down Expand Up @@ -151,7 +151,7 @@
: e === t.Set.empty
? this
: new t.Set(
Object.keys(this.elements).concat(Object.keys(e.elements))
Object.keys(this.elements).concat(Object.keys(e.elements)),
);
}),
(t.idf = function (e, n) {
Expand Down Expand Up @@ -185,7 +185,7 @@
return e.map(function (m) {
return new t.Token(
t.utils.asString(m).toLowerCase(),
t.utils.clone(n)
t.utils.clone(n),
);
});
for (
Expand Down Expand Up @@ -228,7 +228,7 @@
t.utils.warn(
`Function is not registered with pipeline. This may cause problems when serialising the index.
`,
e
e,
);
}),
(t.Pipeline.load = function (e) {
Expand Down Expand Up @@ -1021,7 +1021,7 @@
t.version +
"' does not match serialized index '" +
e.version +
"'"
"'",
);
for (var l = 0; l < i.length; l++) {
var h = i[l],
Expand Down Expand Up @@ -1067,7 +1067,7 @@
(t.Builder.prototype.field = function (e, n) {
if (/\//.test(e))
throw new RangeError(
"Field '" + e + "' contains illegal character '/'"
"Field '" + e + "' contains illegal character '/'",
);
this._fields[e] = n || {};
}),
Expand Down Expand Up @@ -1190,7 +1190,7 @@
}),
(t.Builder.prototype.createTokenSet = function () {
this.tokenSet = t.TokenSet.fromArray(
Object.keys(this.invertedIndex).sort()
Object.keys(this.invertedIndex).sort(),
);
}),
(t.Builder.prototype.build = function () {
Expand Down Expand Up @@ -1241,7 +1241,7 @@
this.metadata[i][a][h] == null
? (this.metadata[i][a][h] = e.metadata[i][a][h])
: (this.metadata[i][a][h] = this.metadata[i][a][h].concat(
e.metadata[i][a][h]
e.metadata[i][a][h],
));
}
}
Expand Down Expand Up @@ -1704,11 +1704,11 @@
(this.navigation = document.querySelector(".col-menu")),
window.addEventListener(
"scroll",
ne(() => this.onScroll(), 10)
ne(() => this.onScroll(), 10),
),
window.addEventListener(
"resize",
ne(() => this.onResize(), 10)
ne(() => this.onResize(), 10),
),
(this.searchInput = document.querySelector("#tsd-search input")),
this.searchInput &&
Expand Down Expand Up @@ -1827,7 +1827,7 @@
r = document.querySelector("#tsd-search .results");
if (!n || !r)
throw new Error(
"The input field or the result list wrapper was not found"
"The input field or the result list wrapper was not found",
);
let i = !1;
r.addEventListener("mousedown", () => (i = !0)),
Expand All @@ -1846,7 +1846,7 @@
"input",
ue(() => {
Ae(t, e, n, r);
}, 200)
}, 200),
);
let i = !1;
n.addEventListener("keydown", (s) => {
Expand Down Expand Up @@ -1943,7 +1943,7 @@
for (; o != -1; )
i.push(
ie(t.substring(s, o)),
`<b>${ie(t.substring(o, o + r.length))}</b>`
`<b>${ie(t.substring(o, o + r.length))}</b>`,
),
(s = o + r.length),
(o = n.indexOf(r, s));
Expand All @@ -1968,7 +1968,7 @@
je = !1,
H = !1,
xe = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
navigator.userAgent,
);
document.documentElement.classList.add(xe ? "is-mobile" : "not-mobile");
xe &&
Expand Down Expand Up @@ -2073,7 +2073,7 @@
document.querySelectorAll(".tsd-index-section").forEach((n) => {
n.style.display = "block";
let r = Array.from(n.querySelectorAll(".tsd-index-link")).every(
(i) => i.offsetParent == null
(i) => i.offsetParent == null,
);
n.style.display = r ? "none" : "block";
});
Expand Down Expand Up @@ -2139,7 +2139,7 @@
this.getIconRotation(i),
],
},
o
o,
)
.addEventListener("finish", () => {
this.icon.style.transform = this.getIconRotation(i);
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function requestNames(config: Config): Promise<OSFeatureCollection> {
responseObject.results.forEach((result) => {
coordsTemp = coords.fromBNG(
result.GAZETTEER_ENTRY.GEOMETRY_X,
result.GAZETTEER_ENTRY.GEOMETRY_Y
result.GAZETTEER_ENTRY.GEOMETRY_Y,
);
result.GAZETTEER_ENTRY.LNG = coordsTemp.lng;
result.GAZETTEER_ENTRY.LAT = coordsTemp.lat;
Expand All @@ -35,7 +35,7 @@ async function requestNames(config: Config): Promise<OSFeatureCollection> {
*/
export const nearest = async (
apiKey: string,
point: [number, number]
point: [number, number],
): Promise<OSFeatureCollection> => {
validateParams({ apiKey, point });

Expand Down Expand Up @@ -64,7 +64,7 @@ export const nearest = async (
export const find = async (
apiKey: string,
query: string,
{ offset = 0, limit = 100 }: { offset?: number; limit?: number } = {}
{ offset = 0, limit = 100 }: { offset?: number; limit?: number } = {},
): Promise<OSFeatureCollection> => {
validateParams({ apiKey, query, offset, limit });

Expand Down
14 changes: 7 additions & 7 deletions src/ngd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const features = async (
crs?: null | string | number;
bboxCRS?: null | string | number;
filterCRS?: null | string | number;
} = {}
} = {},
): Promise<FeatureCollection> => {
validateParams({ bbox, datetime });
const config = initialiseConfig(apiKey, offset, limit);
Expand All @@ -81,7 +81,7 @@ export const features = async (
* @return {Promise<NGDCollection | NGDCollection[]>} - Collection information
*/
export const collections = async (
collectionId = ""
collectionId = "",
): Promise<NGDCollection | NGDCollections> => {
const endpoint = root + `${collectionId}`;
return (await get(endpoint).then((response) => response.json())) as Promise<
Expand All @@ -98,7 +98,7 @@ export const collections = async (
export const schema = async (collectionId: string): Promise<NGDSchema> => {
const endpoint = root + `${collectionId}/schema`;
return (await get(endpoint).then((response) =>
response.json()
response.json(),
)) as Promise<NGDSchema>;
};

Expand All @@ -109,11 +109,11 @@ export const schema = async (collectionId: string): Promise<NGDSchema> => {
* @return {Promise<NGDQueryables>} - JSON containing querable properties
*/
export const queryables = async (
collectionId: string
collectionId: string,
): Promise<NGDQueryables> => {
const endpoint = root + `${collectionId}/queryables`;
return (await get(endpoint).then((response) =>
response.json()
response.json(),
)) as Promise<NGDQueryables>;
};

Expand All @@ -135,10 +135,10 @@ export const feature = async (
crs = null,
}: {
crs?: null | string | number;
} = {}
} = {},
): Promise<Feature> => {
const endpoint = buildUrl(collectionId, { featureId, crs });
return (await get(endpoint, apiKey).then((response) =>
response.json()
response.json(),
)) as Promise<Feature>;
};
Loading