@camptocamp/ogc-client
Advanced tools
Comparing version 1.1.1-dev.ea0f0b6 to 1.1.1-dev.ea20885
@@ -7,3 +7,3 @@ export { default as WfsEndpoint } from './wfs/endpoint.js'; | ||
export type { WmtsLayerDimensionValue, WmtsLayerResourceLink, WmtsEndpointInfo, WmtsLayer, WmtsMatrixSet, } from './wmts/model.js'; | ||
export type { Address, Contact, Provider, LayerStyle, BoundingBox, FetchOptions, GenericEndpointInfo, MimeType, CrsCode, } from './shared/models.js'; | ||
export type { Address, Contact, Provider, LayerStyle, BoundingBox, MetadataURL, FetchOptions, GenericEndpointInfo, MimeType, CrsCode, } from './shared/models.js'; | ||
export { default as OgcApiEndpoint } from './ogc-api/endpoint.js'; | ||
@@ -10,0 +10,0 @@ export * from './ogc-api/model.js'; |
@@ -72,2 +72,7 @@ /** | ||
} | ||
export type MetadataURL = { | ||
format?: string; | ||
type?: string; | ||
url: string; | ||
}; | ||
//# sourceMappingURL=models.d.ts.map |
@@ -153,2 +153,13 @@ import { readProviderFromCapabilities } from "../shared/ows.js"; | ||
).map(getElementText).filter((v, i, arr) => arr.indexOf(v) === i); | ||
const metadata = serviceVersion === "2.0.0" ? findChildrenElement(featureTypeEl, "MetadataURL").map( | ||
(metadataUrlEl) => ({ | ||
url: getElementAttribute(metadataUrlEl, "xlink:href") | ||
}) | ||
) : findChildrenElement(featureTypeEl, "MetadataURL").map( | ||
(metadataUrlEl) => ({ | ||
format: getElementAttribute(metadataUrlEl, "format"), | ||
type: getElementAttribute(metadataUrlEl, "type"), | ||
url: getElementText(metadataUrlEl).trim() | ||
}) | ||
); | ||
return { | ||
@@ -164,3 +175,4 @@ name: getElementText(findChildElement(featureTypeEl, "Name")), | ||
latLonBoundingBox: serviceVersion.startsWith("1.0") ? parseBBox100() : parseBBox(), | ||
keywords | ||
keywords, | ||
...metadata.length && { metadata } | ||
}; | ||
@@ -167,0 +179,0 @@ } |
@@ -99,3 +99,4 @@ import { | ||
outputFormats: featureType.outputFormats, | ||
keywords: featureType.keywords | ||
keywords: featureType.keywords, | ||
..."metadata" in featureType && { metadata: featureType.metadata } | ||
}; | ||
@@ -102,0 +103,0 @@ } |
@@ -15,3 +15,4 @@ import { | ||
latLonBoundingBox: boundingBox, | ||
keywords | ||
keywords, | ||
metadata | ||
} = featureType; | ||
@@ -54,3 +55,4 @@ const hitsAttr = serviceVersion.startsWith("2.0") ? "numberMatched" : "numberOfFeatures"; | ||
...!Number.isNaN(objectCount) && { objectCount }, | ||
...keywords && { keywords } | ||
...keywords && { keywords }, | ||
...metadata && { metadata } | ||
}; | ||
@@ -57,0 +59,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { BoundingBox, CrsCode, MimeType } from '../shared/models.js'; | ||
import { BoundingBox, CrsCode, MetadataURL, MimeType } from '../shared/models.js'; | ||
export type WfsVersion = '1.0.0' | '1.1.0' | '2.0.0'; | ||
@@ -12,2 +12,3 @@ export type WfsFeatureTypeInternal = { | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
}; | ||
@@ -37,2 +38,3 @@ export type FeaturePropertyType = string | number | boolean; | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
}; | ||
@@ -39,0 +41,0 @@ export type WfsFeatureTypeFull = { |
@@ -194,2 +194,12 @@ import { hasInvertedCoordinates } from "../shared/crs-utils.js"; | ||
} | ||
const metadata = findChildrenElement(layerEl, "MetadataURL").map( | ||
(metadataUrlEl) => ({ | ||
type: getElementAttribute(metadataUrlEl, "type"), | ||
format: getElementText(findChildElement(metadataUrlEl, "Format")), | ||
url: getElementAttribute( | ||
findChildElement(metadataUrlEl, "OnlineResource"), | ||
"xlink:href" | ||
) | ||
}) | ||
); | ||
const children = findChildrenElement(layerEl, "Layer").map( | ||
@@ -220,2 +230,3 @@ (layer) => parseLayer( | ||
...maxScaleDenominator !== null ? { maxScaleDenominator } : {}, | ||
...metadata.length && { metadata }, | ||
...children.length && { children } | ||
@@ -222,0 +233,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { BoundingBox, CrsCode, LayerStyle } from '../shared/models.js'; | ||
import { BoundingBox, CrsCode, LayerStyle, type MetadataURL } from '../shared/models.js'; | ||
export type WmsLayerAttribution = { | ||
@@ -38,2 +38,3 @@ title?: string; | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
/** | ||
@@ -40,0 +41,0 @@ * Not defined if the layer is a leaf in the tree |
@@ -96,9 +96,19 @@ import { readProviderFromCapabilities } from "../shared/ows.js"; | ||
const contentsEl = findChildElement(rootEl, "Contents"); | ||
function getMatrixSetCrs(contentsEl2, identifier) { | ||
const matrixSet = findChildrenElement(contentsEl2, "TileMatrixSet").find( | ||
(matrixSetEl) => { | ||
const identifierEl = findChildElement(matrixSetEl, "Identifier"); | ||
return getElementText(identifierEl) === identifier; | ||
} | ||
); | ||
return getElementText(findChildElement(matrixSet, "SupportedCRS")); | ||
} | ||
function parseMatrixSetLink(element) { | ||
const fullMatrixSet = findChildrenElement(contentsEl, "TileMatrixSet").find( | ||
(el) => getElementText(findChildElement(el, "Identifier")) | ||
const identifier = getElementText( | ||
findChildElement(element, "TileMatrixSet") | ||
); | ||
const crs = getMatrixSetCrs(contentsEl, identifier); | ||
return { | ||
identifier: getElementText(findChildElement(element, "TileMatrixSet")), | ||
crs: getElementText(findChildElement(fullMatrixSet, "SupportedCRS")), | ||
identifier, | ||
crs, | ||
limits: findChildrenElement(element, "TileMatrixLimits", true).map( | ||
@@ -105,0 +115,0 @@ (element2) => ({ |
import { MimeType } from '../shared/models.js'; | ||
import { WmtsLayerDimensionValue, WmtsLayerResourceLink, WmtsEndpointInfo, WmtsLayer, WmtsMatrixSet } from './model.js'; | ||
import { WmtsEndpointInfo, WmtsLayer, WmtsLayerDimensionValue, WmtsLayerResourceLink, WmtsMatrixSet } from './model.js'; | ||
import type WMTSTileGrid from 'ol/tilegrid/WMTS'; | ||
@@ -4,0 +4,0 @@ /** |
@@ -172,5 +172,10 @@ import { setQueryParams } from "../shared/http-utils.js"; | ||
const matrixSet = this.getMatrixSetByIdentifier(matrixSetLink.identifier); | ||
return this.tileGridModule.then( | ||
({ buildOpenLayersTileGrid }) => buildOpenLayersTileGrid(matrixSet, matrixSetLink.limits) | ||
); | ||
return this.tileGridModule.then((olTileGridModule) => { | ||
if (!olTileGridModule) | ||
return null; | ||
return olTileGridModule.buildOpenLayersTileGrid( | ||
matrixSet, | ||
matrixSetLink.limits | ||
); | ||
}); | ||
} | ||
@@ -177,0 +182,0 @@ } |
{ | ||
"name": "@camptocamp/ogc-client", | ||
"version": "1.1.1-dev.ea0f0b6", | ||
"version": "1.1.1-dev.ea20885", | ||
"description": "A pure JS library for interacting with geospatial services.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/dist-node.js", |
@@ -36,2 +36,3 @@ export { default as WfsEndpoint } from './wfs/endpoint.js'; | ||
BoundingBox, | ||
MetadataURL, | ||
FetchOptions, | ||
@@ -38,0 +39,0 @@ GenericEndpointInfo, |
@@ -81,1 +81,7 @@ /** | ||
} | ||
export type MetadataURL = { | ||
format?: string; | ||
type?: string; | ||
url: string; | ||
}; |
@@ -44,2 +44,9 @@ import { parseXmlString } from '../shared/xml-utils.js'; | ||
], | ||
metadata: [ | ||
{ | ||
format: 'text/plain', | ||
type: 'TC211', | ||
url: 'https://www.pigma.org/geonetwork/?uuid=cbcae9a4-7fc0-4fc8-bd78-089af3af4e8a', | ||
}, | ||
], | ||
name: 'asp:asp_rpg2010', | ||
@@ -64,2 +71,19 @@ otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'], | ||
], | ||
metadata: [ | ||
{ | ||
format: 'text/html', | ||
type: 'TC211', | ||
url: 'https://www.pigma.org/geonetwork?uuid=4d840710-3f09-4f48-aa31-d2c4c0ee6fda', | ||
}, | ||
{ | ||
format: 'text/html', | ||
type: '19115', | ||
url: 'https://www.pigma.org/geonetwork?uuid=4d840710-3f09-4f48-aa31-d2c4c0ee6fda', | ||
}, | ||
{ | ||
format: 'text/xml', | ||
type: '19115', | ||
url: 'https://www.pigma.org/geonetwork/srv/fre/xml_iso19139?uuid=4d840710-3f09-4f48-aa31-d2c4c0ee6fda', | ||
}, | ||
], | ||
name: 'cd16:comptages_routiers_l', | ||
@@ -86,2 +110,19 @@ otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'], | ||
name: 'cd16:hierarchisation_l', | ||
metadata: [ | ||
{ | ||
format: 'text/html', | ||
type: 'TC211', | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
format: 'text/html', | ||
type: '19115', | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
format: 'text/xml', | ||
type: '19115', | ||
url: 'https://www.pigma.org/geonetwork/srv/fre/xml_iso19139?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
], | ||
otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'], | ||
@@ -99,3 +140,9 @@ outputFormats: [ | ||
const doc = parseXmlString(capabilities200); | ||
expect(readFeatureTypesFromCapabilities(doc)).toEqual(expectedTypes); | ||
const typesWithoutMetadataUrlAttributes = expectedTypes.map((type) => ({ | ||
...type, | ||
metadata: type.metadata.map((metadata) => ({ url: metadata.url })), | ||
})); | ||
expect(readFeatureTypesFromCapabilities(doc)).toEqual( | ||
typesWithoutMetadataUrlAttributes | ||
); | ||
}); | ||
@@ -147,2 +194,16 @@ it('reads the feature types (1.1.0)', () => { | ||
], | ||
metadata: [ | ||
{ | ||
url: 'https://www.geo2france.fr/geonetwork/srv/fre/catalog.search#/metadata/facf3747-bc19-44c7-9fd8-1f765d99c059', | ||
}, | ||
{ | ||
url: 'https://www.geo2france.fr/geonetwork/srv/fre/catalog.search#/metadata/facf3747-bc19-44c7-9fd8-1f765d99c059', | ||
}, | ||
{ | ||
url: 'https://www.geo2france.fr/geonetwork/srv/api/records/facf3747-bc19-44c7-9fd8-1f765d99c059/formatters/xml', | ||
}, | ||
{ | ||
url: 'https://www.geo2france.fr/geonetwork/srv/api/records/facf3747-bc19-44c7-9fd8-1f765d99c059/formatters/xml', | ||
}, | ||
], | ||
name: 'cr_hdf:domaine_public_hdf_com', | ||
@@ -149,0 +210,0 @@ otherCrs: [], |
@@ -246,2 +246,18 @@ import { readProviderFromCapabilities } from '../shared/ows.js'; | ||
.filter((v, i, arr) => arr.indexOf(v) === i); | ||
const metadata = | ||
serviceVersion === '2.0.0' | ||
? findChildrenElement(featureTypeEl, 'MetadataURL').map( | ||
(metadataUrlEl) => ({ | ||
url: getElementAttribute(metadataUrlEl, 'xlink:href'), | ||
}) | ||
) | ||
: findChildrenElement(featureTypeEl, 'MetadataURL').map( | ||
(metadataUrlEl) => ({ | ||
format: getElementAttribute(metadataUrlEl, 'format'), | ||
type: getElementAttribute(metadataUrlEl, 'type'), | ||
url: getElementText(metadataUrlEl).trim(), | ||
}) | ||
); | ||
return { | ||
@@ -261,3 +277,4 @@ name: getElementText(findChildElement(featureTypeEl, 'Name')), | ||
keywords: keywords, | ||
...(metadata.length && { metadata }), | ||
}; | ||
} |
@@ -149,2 +149,13 @@ // @ts-expect-error ts-migrate(7016) | ||
keywords: ['features', 'hierarchisation_l'], | ||
metadata: [ | ||
{ | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
url: 'https://www.pigma.org/geonetwork/srv/fre/xml_iso19139?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
], | ||
otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'], | ||
@@ -190,2 +201,13 @@ outputFormats: [ | ||
keywords: ['features', 'hierarchisation_l'], | ||
metadata: [ | ||
{ | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
url: 'https://www.pigma.org/geonetwork?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
{ | ||
url: 'https://www.pigma.org/geonetwork/srv/fre/xml_iso19139?uuid=cd27adaa-0ec5-4934-9374-143df09fb9f6', | ||
}, | ||
], | ||
otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'], | ||
@@ -192,0 +214,0 @@ outputFormats: [ |
@@ -131,2 +131,3 @@ import { | ||
keywords: featureType.keywords, | ||
...('metadata' in featureType && { metadata: featureType.metadata }), | ||
} as WfsFeatureTypeSummary; | ||
@@ -133,0 +134,0 @@ } |
@@ -34,2 +34,3 @@ import { | ||
keywords, | ||
metadata, | ||
} = featureType; | ||
@@ -83,2 +84,3 @@ | ||
...(keywords && { keywords }), | ||
...(metadata && { metadata }), | ||
}; | ||
@@ -85,0 +87,0 @@ } |
@@ -1,2 +0,7 @@ | ||
import { BoundingBox, CrsCode, MimeType } from '../shared/models.js'; | ||
import { | ||
BoundingBox, | ||
CrsCode, | ||
MetadataURL, | ||
MimeType, | ||
} from '../shared/models.js'; | ||
@@ -14,2 +19,3 @@ export type WfsVersion = '1.0.0' | '1.1.0' | '2.0.0'; | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
}; | ||
@@ -50,2 +56,3 @@ | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
}; | ||
@@ -52,0 +59,0 @@ |
@@ -139,2 +139,9 @@ import { | ||
minScaleDenominator: 200000, | ||
metadata: [ | ||
{ | ||
format: 'text/xml', | ||
type: 'TC211', | ||
url: 'http://www.geocatalogue.fr/api-public/servicesRest?Service=CSW&Request=GetRecordById&Version=2.0.2&id=BR_CAR_ADA&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full', | ||
}, | ||
], | ||
name: 'SCAN_F_GEOL1M', | ||
@@ -196,2 +203,9 @@ queryable: false, | ||
name: 'SCAN_F_GEOL250', | ||
metadata: [ | ||
{ | ||
format: 'text/xml', | ||
type: 'TC211', | ||
url: 'http://www.geocatalogue.fr/api-public/servicesRest?Service=CSW&Request=GetRecordById&Version=2.0.2&id=BR_CAR_ACA&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full', | ||
}, | ||
], | ||
queryable: true, | ||
@@ -239,2 +253,9 @@ opaque: true, | ||
name: 'SCAN_D_GEOL50', | ||
metadata: [ | ||
{ | ||
format: 'text/xml', | ||
type: 'TC211', | ||
url: 'http://www.geocatalogue.fr/api-public/servicesRest?Service=CSW&Request=GetRecordById&Version=2.0.2&id=72cc8d40-1bb6-41a3-8376-9734f23336ff&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full', | ||
}, | ||
], | ||
queryable: true, | ||
@@ -241,0 +262,0 @@ opaque: true, |
@@ -297,2 +297,13 @@ import { XmlDocument, XmlElement } from '@rgrove/parse-xml'; | ||
const metadata = findChildrenElement(layerEl, 'MetadataURL').map( | ||
(metadataUrlEl) => ({ | ||
type: getElementAttribute(metadataUrlEl, 'type'), | ||
format: getElementText(findChildElement(metadataUrlEl, 'Format')), | ||
url: getElementAttribute( | ||
findChildElement(metadataUrlEl, 'OnlineResource'), | ||
'xlink:href' | ||
), | ||
}) | ||
); | ||
const children = findChildrenElement(layerEl, 'Layer').map((layer) => | ||
@@ -323,2 +334,3 @@ parseLayer( | ||
...(maxScaleDenominator !== null ? { maxScaleDenominator } : {}), | ||
...(metadata.length && { metadata }), | ||
...(children.length && { children }), | ||
@@ -325,0 +337,0 @@ }; |
@@ -1,2 +0,7 @@ | ||
import { BoundingBox, CrsCode, LayerStyle } from '../shared/models.js'; | ||
import { | ||
BoundingBox, | ||
CrsCode, | ||
LayerStyle, | ||
type MetadataURL, | ||
} from '../shared/models.js'; | ||
@@ -41,2 +46,3 @@ export type WmsLayerAttribution = { | ||
keywords?: string[]; | ||
metadata?: MetadataURL[]; | ||
/** | ||
@@ -43,0 +49,0 @@ * Not defined if the layer is a leaf in the tree |
@@ -617,3 +617,3 @@ import { | ||
identifier: 'BigWorldPixel', | ||
crs: 'urn:ogc:def:crs:EPSG:6.18:3:3857', | ||
crs: 'urn:ogc:def:crs:OGC:1.3:CRS84', | ||
limits: [], | ||
@@ -685,3 +685,3 @@ }, | ||
identifier: 'GoogleMapsCompatible', | ||
crs: 'urn:ogc:def:crs:EPSG::3857', | ||
crs: 'urn:ogc:def:crs:EPSG:6.18.3:3857', | ||
limits: [], | ||
@@ -688,0 +688,0 @@ }, |
@@ -122,9 +122,33 @@ import type { BoundingBox, LayerStyle } from '../shared/models.js'; | ||
const contentsEl = findChildElement(rootEl, 'Contents'); | ||
/** | ||
* Get the TileMatrixSet CRS | ||
* @param contentsEl - Contents | ||
* @param identifier - TileMatrixSet identifier | ||
* @returns The SupportedCRS of the TileMatrixSet | ||
*/ | ||
function getMatrixSetCrs(contentsEl: XmlElement, identifier: string): string { | ||
const matrixSet = findChildrenElement(contentsEl, 'TileMatrixSet').find( | ||
(matrixSetEl) => { | ||
const identifierEl = findChildElement(matrixSetEl, 'Identifier'); | ||
return getElementText(identifierEl) === identifier; | ||
} | ||
); | ||
return getElementText(findChildElement(matrixSet, 'SupportedCRS')); | ||
} | ||
/** | ||
* Get the parameters of the TileMatrixSetLink | ||
* @param element - TileMatrixSetLink | ||
* @returns | ||
*/ | ||
function parseMatrixSetLink(element: XmlElement): MatrixSetLink { | ||
const fullMatrixSet = findChildrenElement(contentsEl, 'TileMatrixSet').find( | ||
(el) => getElementText(findChildElement(el, 'Identifier')) | ||
const identifier = getElementText( | ||
findChildElement(element, 'TileMatrixSet') | ||
); | ||
const crs = getMatrixSetCrs(contentsEl, identifier); | ||
return { | ||
identifier: getElementText(findChildElement(element, 'TileMatrixSet')), | ||
crs: getElementText(findChildElement(fullMatrixSet, 'SupportedCRS')), | ||
identifier, | ||
crs, | ||
limits: findChildrenElement(element, 'TileMatrixLimits', true).map( | ||
@@ -131,0 +155,0 @@ (element) => ({ |
@@ -6,6 +6,6 @@ import { MimeType } from '../shared/models.js'; | ||
import { | ||
WmtsEndpointInfo, | ||
WmtsLayer, | ||
WmtsLayerDimensionValue, | ||
WmtsLayerResourceLink, | ||
WmtsEndpointInfo, | ||
WmtsLayer, | ||
WmtsMatrixSet, | ||
@@ -213,6 +213,10 @@ } from './model.js'; | ||
const matrixSet = this.getMatrixSetByIdentifier(matrixSetLink.identifier); | ||
return this.tileGridModule.then(({ buildOpenLayersTileGrid }) => | ||
buildOpenLayersTileGrid(matrixSet, matrixSetLink.limits) | ||
); | ||
return this.tileGridModule.then((olTileGridModule) => { | ||
if (!olTileGridModule) return null; | ||
return olTileGridModule.buildOpenLayersTileGrid( | ||
matrixSet, | ||
matrixSetLink.limits | ||
); | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1449788
23910