@swissgeo/coordinates 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/{registerProj4-BuUOcPpF.cjs → index-D7Gdk-1d.cjs} +6 -6
- package/dist/{registerProj4-CwR_kPOz.js → index-DZ4q3KlK.js} +1932 -1987
- package/dist/index.cjs +5 -5
- package/dist/index.js +605 -551
- package/dist/ol.cjs +1 -1
- package/dist/ol.d.ts +4 -7
- package/dist/ol.js +480 -3988
- package/package.json +3 -3
- package/src/DevApp.vue +9 -3
- package/src/ol.ts +4 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swissgeo/coordinates",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Projection definition and coordinates utils for SWISSGEO projects.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"type": "module",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"vitest": "^4.0.16",
|
|
39
39
|
"vue": "^3.5.26",
|
|
40
40
|
"vue-tsc": "^3.2.2",
|
|
41
|
-
"@swissgeo/config-
|
|
42
|
-
"@swissgeo/config-
|
|
41
|
+
"@swissgeo/config-typescript": "1.0.0",
|
|
42
|
+
"@swissgeo/config-eslint": "1.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"proj4": "^2.20.2"
|
package/src/DevApp.vue
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { View } from 'ol'
|
|
2
3
|
import OLTileLayer from 'ol/layer/Tile'
|
|
3
4
|
import OLMap from 'ol/Map'
|
|
5
|
+
import { register } from 'ol/proj/proj4'
|
|
4
6
|
import XYZ from 'ol/source/XYZ'
|
|
5
7
|
import proj4 from 'proj4'
|
|
6
8
|
import { onMounted } from 'vue'
|
|
7
9
|
|
|
8
|
-
import { getLV95TileGrid,
|
|
10
|
+
import { getLV95TileGrid, getLV95ViewConfig } from '@/ol'
|
|
9
11
|
import { LV95 } from '@/proj'
|
|
12
|
+
import registerProj4 from '@/registerProj4'
|
|
10
13
|
|
|
11
14
|
const pixelKarteFarbeURL = 'https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/2056/{z}/{x}/{y}.jpeg'
|
|
12
15
|
|
|
13
16
|
function setupOpenLayers() {
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
registerProj4(proj4);
|
|
19
|
+
register(proj4);
|
|
16
20
|
|
|
17
21
|
const pixelKarteFarbe = new OLTileLayer({
|
|
18
22
|
source: new XYZ({
|
|
@@ -25,7 +29,9 @@ function setupOpenLayers() {
|
|
|
25
29
|
new OLMap({
|
|
26
30
|
target: 'ol-map',
|
|
27
31
|
layers: [pixelKarteFarbe],
|
|
28
|
-
view:
|
|
32
|
+
view: new View({
|
|
33
|
+
...getLV95ViewConfig()
|
|
34
|
+
})
|
|
29
35
|
})
|
|
30
36
|
}
|
|
31
37
|
|
package/src/ol.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
/** @module swissgeo/coordinates/ol */
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import type { ViewOptions } from 'ol/View'
|
|
4
4
|
|
|
5
|
-
import { View } from 'ol'
|
|
6
|
-
import { register } from 'ol/proj/proj4'
|
|
7
5
|
import WMTSTileGrid from 'ol/tilegrid/WMTS'
|
|
8
6
|
|
|
9
7
|
import { LV95 } from '@/proj'
|
|
10
8
|
import { LV95_RESOLUTIONS } from '@/proj/SwissCoordinateSystem'
|
|
11
|
-
import registerProj4 from '@/registerProj4'
|
|
12
|
-
|
|
13
|
-
export function registerSwissGeoProjections(proj4Instance: typeof proj4) {
|
|
14
|
-
registerProj4(proj4Instance)
|
|
15
|
-
register(proj4Instance)
|
|
16
|
-
}
|
|
17
9
|
|
|
18
10
|
function indexOfMaxResolution(layerMaxResolution: number): number {
|
|
19
11
|
const resolutionSteps = LV95.getResolutionSteps()
|
|
@@ -40,8 +32,8 @@ export function getLV95TileGrid(maxResolution = 0.25): WMTSTileGrid {
|
|
|
40
32
|
})
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
export function
|
|
44
|
-
return
|
|
35
|
+
export function getLV95ViewConfig(): ViewOptions {
|
|
36
|
+
return {
|
|
45
37
|
projection: LV95.epsg,
|
|
46
38
|
center: LV95.bounds.center,
|
|
47
39
|
zoom: LV95.getDefaultZoom(),
|
|
@@ -49,5 +41,5 @@ export function getLV95View(): View {
|
|
|
49
41
|
resolutions: LV95_RESOLUTIONS,
|
|
50
42
|
extent: LV95.bounds.flatten,
|
|
51
43
|
constrainOnlyCenter: true,
|
|
52
|
-
}
|
|
44
|
+
}
|
|
53
45
|
}
|