Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
190d187
Update docusaurus.config.ts
mscno Aug 21, 2024
747011b
deps
mscno Aug 21, 2024
2f7bc3f
add leaflet docs link
mscno Aug 21, 2024
3c9a729
build first version of map libre docs
mscno Sep 18, 2024
0b80cfb
path fix
mscno Sep 18, 2024
55851ea
change header
mscno Sep 18, 2024
2e7f278
fix links
mscno Sep 18, 2024
b7e36a5
tweaks
mscno Sep 18, 2024
8af384a
fix links
mscno Sep 18, 2024
3066293
fix url
mscno Sep 18, 2024
c110cc3
tests
mscno Sep 18, 2024
923a24c
tmp remove all docs
mscno Sep 18, 2024
c6ba871
tweak maplibre
mscno Sep 23, 2024
9490ac7
tweak vercel
mscno Sep 23, 2024
93f56dc
test new baseurkl
mscno Sep 23, 2024
f595c30
test again
mscno Sep 23, 2024
3bd9fd9
fix vercel maplibre
mscno Sep 23, 2024
e361619
update vercel with root redir
mscno Sep 23, 2024
bf5838c
fix path
mscno Sep 23, 2024
c6b8d87
dummy files for all draw/edit/helper modes
zxwild Oct 23, 2024
cd3d4ac
basic demo map for each mode
zxwild Oct 23, 2024
ab970ef
update geoman maplibre version, typing fixes
zxwild Oct 23, 2024
3c27eb4
geojson features, required modes for demo maps
zxwild Oct 24, 2024
aeb14aa
basic documentation for edit modes
zxwild Oct 24, 2024
e4b6931
basic docs for draw modes
zxwild Oct 25, 2024
4f67e87
basic docs for helper modes
zxwild Oct 25, 2024
8b4bedd
basic operations docs: init, events, modes
zxwild Oct 25, 2024
38b810e
typo fixes
zxwild Oct 25, 2024
26b0f8f
events doc fix
zxwild Oct 25, 2024
298cd29
better geoman instantiating, shape markers fix
zxwild Oct 28, 2024
01dd062
more docs for mode handling methods
zxwild Oct 30, 2024
4f94cfa
fix auto enabled states for modes with actions
zxwild Oct 30, 2024
389e9b6
Update 01-basics.md
dailyprice Nov 10, 2024
cf157d8
Merge pull request #1 from geoman-io/doc_updates
mscno Nov 13, 2024
be11a4c
fix unquoted html tags
mscno Nov 13, 2024
7f16a6e
try fix clean urls
mscno Nov 13, 2024
206ec2c
Update index.md
dailyprice Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# IDE
.idea

# Dependencies
/node_modules

Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
engine-strict=true
resolution-mode=highest
@geoman-io:registry=https://npm.geoman.io/
108 changes: 108 additions & 0 deletions docs/01-basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: "Basic Usage"
---

# Basic Usage

## Installation

### Pro Version

```shell
# install pro version
npm install @geoman-io/maplibre-geoman-pro
```

Add the following content to .npmrc in your project root

```shell
@geoman-io:registry=https://npm.geoman.io/
//npm.geoman.io/:_authToken="`<YOUR LICENSE KEY>`"
```

Replace `<YOUR LICENSE KEY>` with your license key.
Don't have a license key yet? [Purchase one here](https://geoman.io/pricing).

### Free Version

```shell
# install free version
npm install @geoman-io/maplibre-geoman-free
```

## Expected HTML Structure
```html
<!-- index.html -->
<html lang="en_US">
<head>
<title>Geoman Maplibre</title>
<style>
#dev-map {
height: 100vh;
width: 100vw;
}
</style>
</head>
<body>
<div id="dev-map"></div>
</body>
</html>
```

## Maplibre and Geoman initialization
```typescript
import ml from 'maplibre-gl';
import { type GmOptionsPartial } from '@geoman-io/maplibre-geoman-pro';

import 'maplibre-gl/dist/maplibre-gl.css';
import '@geoman-io/maplibre-geoman-pro/dist/maplibre-geoman.css';


const mapStyle: ml.StyleSpecification = {
version: 8,
glyphs: 'https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf',
sources: {
'osm-tiles': {
type: 'raster',
tiles: [
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
],
tileSize: 256,
attribution: '© OpenStreetMap contributors',
},
},
layers: [
{
id: 'osm-tiles-layer',
type: 'raster',
source: 'osm-tiles',
minzoom: 0,
maxzoom: 19,
},
],
};

const map = new ml.Map({
container: 'dev-map',
style: mapLibreStyle,
center: [0, 51],
zoom: 5,
});

const gmOptions: GmOptionsPartial = {
// geoman options here
};

const geoman = new Geoman(map, gmOptions);

map.on('gm:loaded', () => {
console.log('Geoman fully loaded');

// Here you can add your geojson shapes for example
const shapeGeoJson = {
type: 'Feature',
geometry: { type: 'Point', coordinates: [0, 51] },
};
map.gm.features.addGeoJsonFeature({ shapeGeoJson });
});
```
31 changes: 31 additions & 0 deletions docs/02-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Events"
---

# Event Listening

Event listening works the same way as in Maplibre. You can listen to all events fired by Geoman.

```typescript
// example of listening to the create event
map.on('gm:create', (event: GMEvent) => {
log.debug('Event', event);
});
```

To debug all events, you can use the following code. This will display all Geoman events in the browser console.

```typescript
import { type GlobalEventsListenerParemeters } from '@geoman-io/maplibre-geoman-pro';

map.gm.setGlobalEventsListener((event: GlobalEventsListenerParemeters) => {
if (event.type === 'converted') {
console.log('Regular event', event);
} else if (event.type === 'system') {
console.log('System event', event);
}
});

// you can disable the global events listener when you don't need it anymore
map.gm.setGlobalEventsListener(null);
```
24 changes: 24 additions & 0 deletions docs/03-mode-switching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "Modes Handling"
---

# Mode Handling

All available modes can be enabled, disabled, or toggled using the following methods:

For example, to handle the `edit:drag` mode:
```typescript
// enable mode
map.gm.options.enableMode('edit', 'drag');

// disable mode
map.gm.options.disableMode('edit', 'drag');

// toggle mode
map.gm.options.toggleMode('edit', 'drag');

// check mode state
map.gm.options.isModeEnabled('edit', 'drag');
```

TypeScript support is available, so you can see all available options for each method in Geoman.
16 changes: 0 additions & 16 deletions docs/12.utils.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/14.lazy-loading.md

This file was deleted.

24 changes: 0 additions & 24 deletions docs/16.keyboard.md

This file was deleted.

8 changes: 0 additions & 8 deletions docs/changelog/_category_.json

This file was deleted.

Loading