# geomapping

> Geolocation coordinates on image

Latest version **0.0.3** (published 2020-10-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install geomapping
pnpm add geomapping
yarn add geomapping
bun add geomapping
```

## Health

**Score 5/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-10-26 |
| First published | 2020-10-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sébastien Montlibert |
| Maintainers | speuta |
| Keywords | geolocalisation, gps, image |

## Links

- npm: https://www.npmjs.com/package/geomapping
- Repository: https://github.com/axeon-software/geomapping
- Homepage: https://github.com/axeon-software/geomapping#readme
- Issues: https://github.com/axeon-software/geomapping/issues
- npm.io page: https://npm.io/package/geomapping

## Dependencies (1)

- [zoomable](https://npm.io/package/zoomable.md) github:fabsharp/Zoomable

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-10-26

## README

# GeoMapping

[![npm version](https://badge.fury.io/js/geomapping.svg)](https://badge.fury.io/js/geomapping)

## Get started:
Installation:  
`npm install geomapping`

Include GeoMapping script, you can also load a config file.
``` html
<script src="myPath/geomapping.js"></script>
<script src="myPath/geomap-config.js"></script>
```

Init geoMapping:
``` javascript
var geoMap = new GeoMapping(geomapConfig);
```

[See example of config](./demo/geomap-config.js)

## Methods:
*  **getPoints():** Return all points with x and y position.
*  **getPointById(id):** Return the point object.
*  **filterPointsByData(key, value):** Return points object filtered by your params.
*  **addPoint(lat, lng, id, data):** Add it to the list of points.
*  **removePoint(id):** Remove it from the list of points.
*  **getLatLngOnMap(x, y):** Get lat and lng of a point in the map.
*  **getPointXYOnMap(lat, lng):** Get x and y of a coord in the map.
*  **trackPosition(errorCallback):** Track user GPS position, use "UPDATE_POSITION" event to get map point coords.
*  **stopTrackPosition():** Stop tracking position.

Example:
``` javascript
var points = geoMap.getPoints();
var myPoint = geoMap.addPoint(43.604652, 1.444209, "Toulouse", {
    dpt: "Haute Garonne",
    postal: 31000
});
if(!myPoint.isOutOfMap){
    createHotspot(myPoint.x, myPoint.y);
}
geoMap.getPointById("Toulouse");
geoMap.filterPointsByData("postal", 31000);
geoMap.trackPosition(function(errorMessage){
    // Error code here
});
```

## Events:
*  READY : when the lib is ready.
*  ADD : when a point is added.
*  REMOVE : when a point is removed.
*  UPDATE_POSITION : when the user move when tracking position is activated.
*  STOP_POSITION : when tracking is stopped.

Example:
``` javascript
geoMap.on(GeoMapping.EVENTS.READY, function(){
    console.log('READY !!');
});

geoMap.on(GeoMapping.EVENTS.ADD, function(data){
    console.log('NEW POINT ADDED !!', data);
    updatePoints();
});
```

## Library Dev:

Compil via rollup:
- Dev live reload: `npm run watch`
- Build: `npm run build`

Test: Open `./test/index.html`

> `npm run test` do not work for the moment (No DOM to load Image)

---
_Source: https://npm.io/package/geomapping · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
