altizure-plugin-shapefile
v0.0.3
Published
The Shapefile plugin for Altizure Javascript SDK.
Downloads
3
Readme
altizure-plugin-shapefile
The Shapefile plugin for Altizure Javascript SDK.
Setup
Dependencies
- nodejs
- yarn
Setup
Clone the repository
git clone https://bitbucket.org/<YOUR_GIT>/altizure-plugin-shapefile/
Install npm modules
cd altizure-plugin-shapefile
yarn
Compile debug version
yarn build
Compile release version
yarn release
Pre-Release
- Coding style
yarn lint
usage
This plugin needs altizure
defined.
support shapefile type
- Polygon
- MultiPolygon
- LineString
- Point
in js
This plugin has to be used together with the altizure
module. Make sure altizure
is in your dependencies (or devDependencies) list in package.json
file.
import {Sandbox} from 'altizure'
import {polygonsFromShp} from 'altizure-plugin-shapefile'
let options = {
altizureApi:{
key: your key here...
}
}
let sandbox = new Sandbox('page-content', options)
let shpOptions = {
shpPath: '../testdata/polygons_wgs84.shp',
dbfPath: '../testdata/polygons_wgs84.dbf',
encoding: 'GBK' // if table info contains Chinese characters, please use GBK
}
let polygons
altizure.Shapefile.polygonsFromShp(shpOptions, sandbox, {
top: 60,
bottom: 0.2,
color: 0xffffff * Math.random(),
opacity: 0.2
}).then(function(res) {
polygons = res
console.log(polygons)
})
in html
Include altizure-sdk.min.js
before this plugin.
<head>
<script type="text/javascript" src="https://unpkg.com/altizure/release/altizure-sdk.min.js"></script>
<script type="text/javascript" src="../../build/altizure-plugin-shapefile.min.js"></script>
</head>
<body>
<div id="page-content" />
<script>
let options = {
altizureApi:{
key: your key here...
}
}
let sandbox = new altizure.Sandbox('page-content', options)
let shpOptions = {
shpPath: '../testdata/polygons_wgs84.shp',
dbfPath: '../testdata/polygons_wgs84.dbf',
encoding: 'GBK' // if table info contains Chinese characters, please use GBK
}
let polygons
altizure.Shapefile.polygonsFromShp(shpOptions, sandbox, {
top: 60,
bottom: 0.2,
color: 0xffffff * Math.random(),
opacity: 0.2
}).then(function(res) {
polygons = res
console.log(polygons)
})
</script>
</body>