antv-l7/demos/line.html

86 lines
8.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="geometry" content="diagram">
<link rel="stylesheet" href="./assets/common.css">
<title>city demo</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<div id="map"></div>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
var buildLayer =null;
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [116.428925,39.903969 ],
pitch: 0,
zoom: 15,
minZoom: 5,
maxZoom: 18
});
scene.on('loaded', () => {
const line = {"type":"FeatureCollection",
"features":[{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[116.379883,39.865601,0],[116.379997,39.865498,15],[116.380104,39.865364,47],[116.380203,39.865246,95],[116.380348,39.865032,170],[116.380478,39.864765,277],[116.380478,39.864765,384],[116.380745,39.864727,514],[116.381218,39.864799,685],[116.381439,39.864841,875],[116.381798,39.864906,1097],[116.382034,39.864979,1341],[116.382309,39.865093,1612],[116.383095,39.865559,1968],[116.383575,39.865742,2370],[116.383896,39.865822,2801],[116.384232,39.865871,3261],[116.384537,39.865883,3747],[116.384903,39.865868,4264],[116.385132,39.865841,4801],[116.385422,39.865761,5364],[116.385582,39.865696,5942],[116.385582,39.865696,6520],[116.385788,39.865623,7117],[116.386055,39.865517,7740],[116.38694,39.86525,8444],[116.387482,39.865128,9196],[116.387672,39.865204,9966],[116.387741,39.865391,10758],[116.387772,39.865475,11560],[116.387901,39.866009,12422],[116.387955,39.866352,13322],[116.38797,39.866581,14248],[116.38797,39.867085,15230],[116.38797,39.867371,16244],[116.387947,39.867935,17321],[116.387939,39.868587,18471],[116.387932,39.869381,19709],[116.387932,39.870155,21033],[116.387901,39.870506,22396],[116.387901,39.870506,23759],[116.388077,39.870682,25147],[116.388222,39.870762,26550],[116.388275,39.870773,27958],[116.388542,39.87077,29389],[116.389153,39.870762,30872],[116.390015,39.870762,32429],[116.390114,39.870777,33995],[116.39019,39.870804,35568],[116.390259,39.870827,37147],[116.390755,39.87112,38779],[116.390961,39.871201,40431],[116.392235,39.871254,42192],[116.392296,39.871258,43958],[116.394577,39.871346,45919],[116.395042,39.871368,47920],[116.395279,39.871368,49941],[116.396156,39.871372,52037],[116.396156,39.871372,54133],[116.397476,39.871574,56344],[116.398438,39.871616,58637],[116.399734,39.871685,61041],[116.400322,39.871693,63495],[116.401268,39.871746,66030],[116.402931,39.871826,68707],[116.403282,39.871861,71414],[116.404373,39.871948,74215],[116.405106,39.87196,77079],[116.406166,39.871979,80034],[116.40712,39.872005,83071],[116.40934,39.872074,86298],[116.411125,39.872124,89678],[116.411407,39.872135,93082],[116.413887,39.872189,96698],[116.414276,39.8722,100347],[116.414642,39.872192,104027],[116.414818,39.872177,107722],[116.415344,39.872074,111463],[116.415779,39.871899,115246],[116.41687,39.871395,119138],[116.417328,39.871201,123075],[116.417603,39.871124,127037],[116.417801,39.87109,131016],[116.418159,39.871048,135026],[116.418488,39.87104,139064],[116.419136,39.871075,143157],[116.419708,39.871113,147299],[116.419891,39.87112,151457],[116.420082,39.87114,155631],[116.420425,39.871159,159834],[116.420761,39.871178,164066],[116.420853,39.871185,168306],[116.420944,39.871193,172554],[116.421066,39.871201,176812],[116.421219,39.871201,181083],[116.421257,39.871208,185357],[116.421883,39.871246,189685],[116.421883,39.871246,194013],[116.42202,39.871201,198354],[116.422081,39.87117,202701],[116.422127,39.871124,207054],[116.422195,39.871033,211419],[116.422226,39.870586,215834],[116.422211,39.870533,220255],[116.422188,39.870476,224683],[116.422142,39.87043,229117],[116.422081,39.87038,233559],[116.421997,39.87035,238009],[116.421867,39.87035,242470],[116.421783,39.870361,246938],[116.421715,39.870388,251413],[116.42157,39.870453,255902],[116.421501,39.870502,260399],[116.421501,39.870502,264896],[116.421486,39.870792,269425],[116.421478,39.870861,273962],[116.421455,39.871437,278563],[116.421425,39.872169,283246],[116.421379,39.873272,288052],[116.421326,39.874275,292970],[116.42131,39.875,297969],[116.421295,39.87532,303004],[116.421272,39.875843,308097],[116.421219,39.876854,313303],[116.42112,39.878708,318716],[116.42112,39.878853,324145],[116.421051,39.880367,329743],[116.421028,39.880692,335377],[116.421021,39.880863,341030],[116.421013,39.880928,346690],[116.421005,39.881634,352429],[116.420952,39.882782,358296],[116.420944,39.88303,364191],[116.420914,39.883743,370165],[116.420906,39.883854,376151],[116.420898,39.883934,382146],[116.42083,39.884594,388215],[116.420784,39.884773,394304],[116.420723,39.884964,400415],[116.420486,39.885441,406583],[116.420471,39.885475,412755],[116.419678,39.88699,419109],[116.419647,39.887062,425471],[116.419304,39.887848,431925],[116.41925,39.888035,438400],[116.419197,39.888264,444901],[116.419167,39.888504,451429],[116.419144,39.888882,457999],[116.419128,39.889191,464603],[116.419075,39.890392,471341],[116.419075,39.890545,478096],[116.419052,39.890923,484893],[116.419029,39.891357,491738],[116.419014,39.89204,498659],[116.419029,39.89259,505641],[116.419037,39.892956,512664],[116.419029,39.893246,519719],[116.418999,39.893608,526814],[116.418961,39.893852,533936],[116.418915,39.894402,541119],[116.418915,39.894592,548323],[116.418846,39.895786,555660],[116.4188,39.897121,563146],[116.4188,39.897209,570642],[116.418709,39.899338,578375],[116.418663,39.900223,586207],[116.418655,39.900414,594060],[116.418571,39.901062,601985],[116.418556,39.901173,609922],[116.418533,39.901489,617894],[116.418526,39.90163,625882],[116.418488,39.902054,633917],[116.418465,39.902344,641984],[116.418442,39.902649,650085],[116.418434,39.902706,658192],[116.418434,39.903198,666354],[116.418419,39.903553,674556],[116.418365,39.904186,682829],[116.418335,39.904579,691146],[116.418327,39.904858,699494],[116.41832,39.905056,707864],[116.418312,39.905304,716262],[116.418266,39.906265,724767],[116.418121,39.908184,733486],[116.418121,39.908184,742205],[116.420853,39.908241,751157],[116.421234,39.908241,760142],[116.422356,39.90826,769223],[116.422928,39.908272,778353],[116.42334,39.908279,787518],[116.423454,39.908283,796693],[116.424446,39.908283,805953],[116.424522,39.908283,815219],[116.425194,39.908302,824542],[116.426964,39.908337,834016],[116.426964,39.908337,843490],[116.426987,39.908001,853001],[116.42701,39.907352,862584],[116.427032,39.906639,872246],[116.427048,39.906246,881952],[116.427055,39.905941,891692],[116.427063,39.90509,901527],[116.427238,39.904968,911382],[116.42746,39.904915,921257],[116.428894,39.904907,931254],[116.428894,39.904907,941251],[116.428909,39.904835,951256],[116.428925,39.904427,961306],[116.428963,39.904129,971389],[116.428963,39.904129,981472],[116.428909,39.90406,991564],[116.428925,39.903969,1001666],[116.42894,39.90329,1011844],[116.42894,39.90329,1022022],[116.427841,39.903244,1032294],[116.427299,39.903233,1042612]]}}]};
const linelayer = scene.LineLayer({
zIndex: 2
})
.shape('line')
.size([2,0])
.source(line)
.color('#ff893a')
.animate({
enable:true,
interval:1,
duration:2,
trailLength:0.1,
repeat:10,
})
.render();
linelayer.on('animateEnd',()=>{
console.log('动画结束');
})
$.get('./data/yunqi.geojson', data => {
citylayer = scene.PolygonLayer({
zIndex: 2
})
.source(data)
.shape('fill')
.active({fill:'red'})
.size('floor',[10,2000])
.color('rgba(242,246,250,0.96)')
.render();
})
$.get('./data/test.json', data => {
citylayer2 = scene.PolygonLayer({
zIndex: 2
})
.source(data)
.shape('fill')
.active({fill:'red'})
// .size('floor',[10,2000])
.color('red')
.render();
})
})
</script>
</body>
</html>