GeoMapping
Get started:
Installation:
npm install geomapping
Include GeoMapping script, you can also load a config file.
Init geoMapping:
var geoMap = geomapConfig;
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:
var points = geoMap;var myPoint = geoMap;if!myPointisOutOfMap;geoMap;geoMap;geoMap;
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:
geoMap;geoMap;
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)