@amedia/atlas-js
v0.1.1
Published
Lightweight client for Atlas geographic data services
Maintainers
Keywords
Readme
@amedia/atlas-js
Lightweight client for Atlas geographic data services. Works in browsers, edge runtimes, and Node.js.
Install
npm install @amedia/atlas-jsUsage
import { AtlasClient } from '@amedia/atlas-js';
const atlas = new AtlasClient({
baseUrl: 'https://services.api.no/api/atlas-ng/v1'
});
// Entity lookup
const { entities } = await atlas.get('municipalities', { q: '0301' });
// Graph query — resolve references in-place
const resolved = await atlas.graph('municipalities', '0301',
'code,name,sitekeys:publication(name,domain)'
);
// Embed + auto-expand — best for lists (server deduplicates)
const expanded = await atlas.getExpanded('municipalities', {
embed: '(sitekeys:publication(name,domain))'
});
// Point-in-polygon
const result = await atlas.pip(59.9127, 10.7461);
// FeatureCollection
const fc = await atlas.featureCollection('municipalities', {
code: '0301',
size: 'small'
});API
new AtlasClient(options)
baseUrl— Atlas API base URLversion— Data version (default:'latest')
.get(endpoint, params) → AtlasResponse
.getExpanded(endpoint, params) → T[] (embed + auto-expand)
.graph(endpoint, code, graphQuery) → T[] (in-place resolution)
.featureCollection(type, params) → GeoJSON
.query(request) → QueryService response
.pip(lat, lon) → QueryService response (shorthand)
expandEmbed(response) → T[]
Standalone function to expand _embedded references inline.
