maptalks.analysis

Usage
maptalks.analysis a plugin to excute analysis task in maptalks.
Install
- Install with npm:
npm install @maptalks/analysis.
- Use unpkg CDN:
https://unpkg.com/@maptalks/analysis/dist/maptalks.analysis.js
Vanilla Javascript
<script type="text/javascript" src="../maptalks.analysis.js"></script>
<script>
var map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
var groupLayer = new maptalks.GroupGLLayer('g', [], { sceneConfig }).addTo(map);
var center = map.getCenter();
var eyePos = [center.x + 0.01, center.y, 0];
var lookPoint = [center.x, center.y, 0];
var verticalAngle = 30;
var horizontalAngle = 20;
var viewshedAnalysis = new maptalks.ViewshedAnalysis({
eyePos,
lookPoint,
verticalAngle,
horizontalAngle
});
viewshedAnalysis.addTo(groupLayer);
</script>
ES6
import { ViewshedAnalysis } from '@maptalks/analysis';
const map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
const groupLayer = new maptalks.GroupGLLayer('g', [], { sceneConfig }).addTo(map);
const center = map.getCenter();
const eyePos = [center.x + 0.01, center.y, 0];
const lookPoint = [center.x, center.y, 0];
const verticalAngle = 30;
const horizontalAngle = 20;
const viewshedAnalysis = new maptalks.ViewshedAnalysis({
eyePos,
lookPoint,
verticalAngle,
horizontalAngle
});
viewshedAnalysis.addTo(groupLayer);
API
-
Class : ViewshedAnalysis(inherited from maptalks.Eventable)
ViewshedAnalysis's constructor.
Method : new ViewshedAnalysis(options)
eyePos | Array | null | position of eye, include longitude、latitude、altitude |
lookPoint | Array | null | position of look point |
verticalAngle | Number | 90 | vertical angle of viewer |
horizontalAngle | Number | 90 | horizontal angle of viewer |
Method : addTo(groupgllayer)
add viewshed analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
ViewshedAnalysis: this
Method : remove()
remove the viewshed analysis from groupgllayer
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
ViewshedAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
ViewshedAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false
-
Class : FloodAnalysis(inherited from maptalks.Eventable)
FloodAnalysis's constructor.
Method : new FloodAnalysis(options)
boundary | Array | | the coordinate rings of flood boundary |
waterColor | Array | [0.1451, 0.2588, 0.4863] | the color of water |
waterHeight | Array | null | the depth of water |
Method : addTo(groupgllayer)
add flood analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
FloodAnalysis: this
Method : remove()
remove the flood analysis from groupgllayer
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
FloodAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
FloodAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false
-
Class : SkylineAnalysis(inherited from maptalks.Eventable)
SkylineAnalysis's constructor.
Method : new SkylineAnalysis(options)
lineColor | Array | [1, 0, 0] | the color of skyline |
lineWidth | Array | 1.0 | the width of skyline |
Method : addTo(groupgllayer)
add skyline analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
SkylineAnalysis: this
Method : remove()
remove the skyline analysis from groupgllayer
Method : exportSkylineMap(options)
remove the skyline analysis from groupgllayer
save | Boolean | true | whether pop a file save dialog to save the export image |
filename | String | export | specify the file name, if options.save is true |
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
SkylineAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
SkylineAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false
-
Class : InsightAnalysis(inherited from maptalks.Eventable)
InsightAnalysis's constructor.
Method : new InsightAnalysis(options)
lineColor | Array | [1, 0, 0] | the color of Insight |
lineWidth | Array | 1.0 | the width of Insight |
Method : addTo(groupgllayer)
add insight analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
InsightAnalysis: this
Method : remove()
remove the insight analysis from groupgllayer
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
InsightAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
InsightAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false
-
Class : CutAnalysis(inherited from maptalks.Eventable)
CutAnalysis's constructor.
Method : new CutAnalysis(options)
position | Array | | the position of helper parts |
rotation | Array | | the Euler angle of helper parts |
scale | Array | | the scale of helper parts |
Method : addTo(groupgllayer)
add cut analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
CutAnalysis: this
Method : remove()
remove the cut analysis from groupgllayer
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
CutAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
returns :
CutAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false
Method : reset()
reset cutanalysis's initial state
returns :
CutAnalysis: return this
-
Class : ExcavateAnalysis(inherited from maptalks.Eventable)
ExcavateAnalysis's constructor.
Method : new ExcavateAnalysis(options)
boundary | Array | | the coordinate rings of excavate boundary |
textureUrl | String | | the excavate texture's url |
height | Number | | excavate height |
Method : addTo(groupgllayer)
add excavate analysis to groupgllayer
groupgllayer | maptalks.GroupGLLayer | | a groupgllayer to add |
returns :
ExcavateAnalysis: this
Method : remove()
remove the excavate analysis from groupgllayer
Method : update(name, value)
name | String | | name of property |
value | Any | | value of property |
Method : enable()
enable the analysis task
returns :
ExcavateAnalysis: return this
Method : disable()
disable the analysis task, when disable the analysis task, it will be not available
returns :
ExcavateAnalysis: return this
Method : isEnbale()
whether the analysis task is enable
returns :
Boolean: true or false