Skip to content

Commit

Permalink
position map
Browse files Browse the repository at this point in the history
  • Loading branch information
sfggeogis committed May 7, 2024
1 parent 93a2c1e commit b47ff87
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 8 deletions.
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,66 @@
* Basic mapicgc-gl-js viewer
* Vanilla JS + Vite

### Mapicgc-gl-js documentation

* https://openicgc.github.io/mapicgc-doc/

### To install

```
git clone https://github.com/OpenICGC/basic-mapicgc-gl-js-viewer.git
```bash
git clone https://github.com/OpenICGC/basic-mapicgc-gl-js-viewer-js.git

cd /basic-mapicgc-gl-js-viewer
cd /basic-mapicgc-gl-js-viewer-js

npm install
npm run build
npm run serve

```



### Javascript

```javascript

import { Map, Config } from "mapicgc-gl-js";
//import * as mapicgcgl from "mapicgc-gl-js";

async function initMap() {
try {
const data = await Config.getConfigICGC();
const map = new Map({
container: "map",
style: data.Styles.LIGHT,
center: [1.808, 41.618],
zoom: 10,
maxZoom: 19,
hash: true,
pitch: 0,
});
map.on("load", () => {
//GEOCODER
map.addGeocoderICGC();
//CONTROLS
map.addGeolocateControl(
{
positionOptions: {
enableHighAccuracy: true,
},
trackUserLocation: true,
},
"bottom-right"
);
map.addExportControl({}, "top-right");
map.addFullscreenControl({}, "top-right");
map.addTerrainICGC(data.Terrains.ICGC5M, "bottom-right");
});
} catch (err) {
console.error(err);
}
}

initMap();

```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "template_mapicgc",
"name": "basic-mapicgc-gl-js-viewer-js",
"version": "0.0.1",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit b47ff87

Please sign in to comment.