0.0.28 • Published 2 years ago
globe-sdk-leafet v0.0.28
Globe map sdk
Map sdk use only globe server
Installation
Use the package manager npm to install foobar.
npm i globe-sdk-leafet
yarn add globe-sdk-leafet
Usage
import React, { useEffect, useRef } from 'react';
import { MapSDK } from 'globe-sdk-leafet';
import "globe-sdk-leafet/dist/index.css";
const options: any = {
map: {
coordinates: {
latitude: 0,
longitude: 0
}
},
};
const MapComponent: React.FC = () => {
const mapContainerRef: any = useRef(null);
useEffect(() => {
const mapSDK = new MapSDK(mapContainerRef.current);
mapSDK.init(options);
mapSDK.onShapeCreated((shape:any, layer:any) => {
if (shape === 'Marker') {
const geojson = layer.toGeoJSON();
console.log(geojson);
} else if (shape === 'Circle') {
const geojson = layer.toGeoJSON();
console.log(geojson);
} else if (shape === 'Polygon' || shape === 'Rectangle' || shape === 'Polyline') {
const geojson = layer.toGeoJSON();
console.log(geojson);
}
});
return () => {
mapSDK?.destroy();
};
}, []);
return (
<>
<div ref={mapContainerRef} style={{ width: '100%', height: '100vh' }} />
</>
)
};
export default MapComponent
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
0.0.20
2 years ago
0.0.21
2 years ago
0.0.22
2 years ago
0.0.23
2 years ago
0.0.24
2 years ago
0.0.25
2 years ago
0.0.15
2 years ago
0.0.16
2 years ago
0.0.17
2 years ago
0.0.18
2 years ago
0.0.19
2 years ago
0.0.10
2 years ago
0.0.11
2 years ago
0.0.12
2 years ago
0.0.13
2 years ago
0.0.14
2 years ago
0.0.26
2 years ago
0.0.9
2 years ago
0.0.27
2 years ago
0.0.8
2 years ago
0.0.28
2 years ago
0.0.5
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago