cesium中geoJSON数据的生成

0.推荐工具

1.首先推荐一个生成geoJSON文件的工具,你可以在地图上随意画图形,然后会给你生成对应的geoJSON文件,特别好用。
https://geojson.io/#map=2/0/20

1.首先展示效果图

cesium中geoJSON数据的生成_第1张图片

2.对应的geoJSON文件为

    let myjson = {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {},
          "geometry": {
          //四个数组分别对应四个点
            "coordinates": [
              [
                120.55706316249672,
                23.84171257936383
              ],
              [
                120.81518470009706,
                23.850792834425178
              ],
              [
                120.82114135096452,
                23.687251086958497
              ],
              [
                120.69605168274305,
                23.680886826072957
              ],
              [
                120.57096201452157,
                23.674522565187416
              ],
              [
                120.55309206191919,
                23.836264121040543
              ]
            ],
            "type": "LineString"
          }
        },
        {
          "type": "Feature",
          "properties": {
            "name": "机场",
            //空值图标颜色
            "marker-color": "#a45151",
            //空值图标大小,可选值为small,medium,large
            "marker-size": "small",
            //对应icon,可选值在下面会详细说明
            "marker-symbol": "airfield"
          },
          "geometry": {
          //点的位置
            "coordinates": [
              120.69108705069681,
              23.773590536547303
            ],
            //所画类型
            "type": "Point"
          }
        },
      ]
    }

3.加载geoJSON

    viewer.dataSources.add(
      Cesium.GeoJsonDataSource.load(
        myjson	// 这里是json文件的地址
      )
    );

4.marker-symbol图标的可选值

cesium中geoJSON数据的生成_第2张图片
其中数字和字母直接写就行,图标对应的写法在下面,整理了好久。并且翻译过了,英语不好的朋友可以对照着翻译找。

airport,alcohol-shop , america-football , art-gallery, bakery,bank
bar, baseball,basketball , beer, bicycle , building , bus ,
cafe ,camera , campsite , car , cemetery , cesium, chemist ,
cinema , circle-stroked ,circle , city , clothing-store ,
college ,commercial, cricket , cross , dam
, danger , disability , dog-park , embassy
, emergency-telephone , entrance , farm , fast-food,
ferry , fire-station , fuel ,garden , gift
, golf , grocery , hairdresser , harbor ,
heart , heliport , hospital, ice-cream ,
industrial , land-use , laundry , library ,
lighthouse , lodging , logging ,
london-underground , marker-stroked , marker
, minefield , mobilephone , monument ,
museum, music , oil-well , park ,
park2 , parking-garage , parking, pharmacy
, pitch , place-of-worship, playground ,
police , polling-place ,post , prison ,
rail-above , rail-light , rail-metro ,
rail-underground , rail , religious-christian ,
religious-jewish , religious-muslim , restaurant ,
roadblock , rocket , school , scooter ,
shop , skiing , slaughterhouse , soccer ,
square-stroked , square , star-stroked , star
, suitcase , swimming , telephone , tennis
, theatre , toilets , town-hall , town ,
triangle-stroked , triangle , village ,
warehouse, waste-basket water, wetland ,
zoo , marker-sy,

对应中文

机场,酒精店,美国足球,美术馆,面包店,银行酒吧,棒球,篮球,啤酒,自行车,建筑,公共汽车,咖啡馆,照相机,露营地,汽车,墓地,铯,化学家,电影院,圆圈描边,圆圈,城市,服装店,大学,商业,板球,十字架,水坝,危险,残疾,狗公园,大使馆,紧急电话,入口,农场,快餐,渡轮,消防站,燃料,花园,礼品,高尔夫,杂货店,理发师,港口,心脏,直升机场,医院,冰淇淋,工业,土地使用,洗衣房,图书馆,灯塔,住宿,伐木,伦敦地铁,标记笔,标记,雷场,手机,纪念碑,博物馆,音乐,油井,公园,公园2,停车场,停车,药房,球场,礼拜场所,操场,警察,投票站,邮政,监狱,铁路上方,铁路灯,铁路地铁,铁路地下,铁路,宗教基督徒,宗教犹太人,宗教穆斯林,餐馆,路障,火箭,学校,滑板车,商店,滑雪,屠宰场,足球,方形划水,方形,星形划水,星形,行李箱,游泳,电话,网球,剧院,厕所,市政厅,城镇,三角形划水,三角形划,村庄,仓库,废篮水,湿地,动物园,标记系统,

你可能感兴趣的:(cesium,js)