Skip to content

Repository files navigation

@aerius/vue-geo-components

Shared Vue 3 + OpenLayers geo components for AERIUS frontends. The stack is Vue 3, Vite, TypeScript, OpenLayers 10, proj4, and Pinia.

The library is built with Vite and ships as ESM. ol, vue, proj4, and pinia are peer dependencies: the library does not bundle them, it uses the app's own copies.

Status: starting point. This repo sets up the build, tooling, and CI. The real map code comes in a follow-up. The MapView component and RD helper here are a small working example.

Use it in an app

1. Point npm at Nexus for the @aerius scope. Add this line to the app's .npmrc:

@aerius:registry=https://nexus.aerius.nl/repository/npm/

(If reads need a login, run npm login --scope=@aerius --registry=https://nexus.aerius.nl/repository/npm/ once.)

2. Install it, plus the peer dependencies if the app doesn't already have them:

npm install @aerius/vue-geo-components
npm install ol vue proj4 pinia

3. Use it:

<script setup lang="ts">
import { MapView } from "@aerius/vue-geo-components";
import "@aerius/vue-geo-components/style.css";
import "ol/ol.css";
</script>

<template>
  <MapView :zoom="7" style="height: 480px" />
</template>

MapView uses the Dutch RD map projection (EPSG:28992) by default. Child components can get the map with useMap().

Use the newest build

Say an app uses this library and you want to always work against the latest version. There are two cases:

You are editing the library too. Use yalc: your local library changes show up in the app the moment you save - live, with nothing to publish. This is the fastest loop. See docs/local-development.md.

You just want the newest published build (you're not editing the library). Depend on the dev tag in the app's package.json:

"@aerius/vue-geo-components": "dev"

Every push to this library's main publishes a new dev snapshot. Pull the newest one into the app with:

npm update @aerius/vue-geo-components

Each snapshot has a unique version, so this always works cleanly. The app stays on whatever is locked in its package-lock.json until you run npm update, so npm ci stays reproducible. See docs/versioning.md.

Pin a released version

For a stable build (e.g. on an app's release branch), depend on a real release number instead of the dev tag:

npm install @aerius/vue-geo-components@0.2.0

Real releases are published to the latest tag from a GitHub Release - see docs/versioning.md.

Develop this library

Use Node 24 (see .nvmrc).

npm install
npm run dev          # rebuild on every save
npm run lint
npm run type-check
npm test
npm run build        # type-check + build dist/

What it exports

Everything comes from src/index.ts:

Export What it is
MapView The OpenLayers map as a Vue component. Shares the map with child components.
useMap / provideMap / mapInjectionKey Get or share the map instance.
RD / registerRdProjection / isRdRegistered Dutch RD map projection (EPSG:28992).
useMapViewStore Shared map state (center, zoom).

License

AGPL-3.0-only. See LICENSE.

About

Vue library with generic geo components

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages