@swissgeo/coordinates 1.0.1 → 1.0.3
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 +11 -4
- package/dist/{registerProj4-CwR_kPOz.js → index-C-LPtO1W.js} +2094 -2148
- package/dist/index-C-LPtO1W.js.map +1 -0
- package/dist/{registerProj4-BuUOcPpF.cjs → index-e9ERo8-f.cjs} +7 -6
- package/dist/index-e9ERo8-f.cjs.map +1 -0
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +16 -14
- package/dist/index.js +606 -551
- package/dist/index.js.map +1 -0
- package/dist/ol.cjs +2 -1
- package/dist/ol.cjs.map +1 -0
- package/dist/ol.d.ts +10 -5
- package/dist/ol.js +582 -4080
- package/dist/ol.js.map +1 -0
- package/index.html +3 -0
- package/package.json +5 -3
- package/src/DevApp.vue +33 -32
- package/src/ol.ts +60 -53
- package/src/proj/CoordinateSystem.ts +6 -4
- package/src/proj/SwissCoordinateSystem.ts +7 -7
- package/src/proj/WGS84CoordinateSystem.ts +4 -4
- package/src/proj/WebMercatorCoordinateSystem.ts +2 -2
- package/src/proj/__test__/CoordinateSystem.spec.ts +2 -2
- package/src/proj/__test__/SwissCoordinateSystem.spec.ts +9 -9
- package/vite.config.ts +4 -0
package/README.md
CHANGED
|
@@ -85,25 +85,32 @@ const center = extentUtils.getExtentCenter(extentLV95)
|
|
|
85
85
|
The package provides specialized helpers for OpenLayers in `@swissgeo/coordinates/ol`.
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
|
-
import {
|
|
88
|
+
import {registerProj4 } from '@swissgeo/coordinates'
|
|
89
|
+
import { getLV95ViewConfig, getLV95WMTSTileGrid } from '@swissgeo/coordinates/ol'
|
|
89
90
|
import TileLayer from 'ol/layer/Tile'
|
|
90
91
|
import Map from 'ol/Map'
|
|
92
|
+
import View from 'ol/View'
|
|
91
93
|
import XYZ from 'ol/source/XYZ'
|
|
94
|
+
import { register } from 'ol/proj/proj4'
|
|
92
95
|
import proj4 from 'proj4'
|
|
93
96
|
|
|
94
97
|
// 1. Register projections in proj4 and OpenLayers
|
|
95
|
-
|
|
98
|
+
registerProj4(proj4);
|
|
99
|
+
register(proj4);
|
|
96
100
|
|
|
97
101
|
// 2. Use helpers to create View and TileGrid
|
|
98
102
|
const map = new Map({
|
|
99
103
|
target: 'map',
|
|
100
|
-
view:
|
|
104
|
+
view: new View({
|
|
105
|
+
...getLV95ViewConfig(),
|
|
106
|
+
// any other view configuration
|
|
107
|
+
}),
|
|
101
108
|
layers: [
|
|
102
109
|
new TileLayer({
|
|
103
110
|
source: new XYZ({
|
|
104
111
|
url: 'https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/2056/{z}/{x}/{y}.jpeg'
|
|
105
112
|
projection: LV95.epsg,
|
|
106
|
-
tileGrid:
|
|
113
|
+
tileGrid: getLV95WMTSTileGrid()
|
|
107
114
|
})
|
|
108
115
|
})
|
|
109
116
|
]
|