五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

GIS開發(fā):geojson圖層批量坐標(biāo)轉(zhuǎn)換

2022-06-23 08:53 作者:地理信息技術(shù)雜談  | 我要投稿

在沒有規(guī)律的坐標(biāo)偏移情況下,如國(guó)內(nèi)在線地圖偏移和經(jīng)緯度轉(zhuǎn)換,可以進(jìn)行方便進(jìn)行單個(gè)坐標(biāo)的轉(zhuǎn)換,轉(zhuǎn)換圖層就需要自己進(jìn)行開發(fā)了。
感謝coordtransform庫(kù)的作者,這里使用了coordtransform進(jìn)行偏移坐標(biāo)的轉(zhuǎn)換。

//引入fs和coordtransform庫(kù)

const?fs?=?require('fs');

const?coordtransform?=?require('coordtransform');

//geojson矢量對(duì)象處理

function?dataByfeaturetype(_feature)?{

????this.datafeature?=?_feature;

????this.featuretype?=?_feature.geometry.type;

????this.coords?=?_feature.geometry.coordinates;

????this.newcoords?=?[];

}

//點(diǎn)、線、面中數(shù)據(jù)坐標(biāo)遍歷處理

dataByfeaturetype.prototype.handlePoint?=?function?()?{

????this.newcoords?=?coordtransform.wgs84togcj02(this.coords[0],?this.coords[1]);

}

dataByfeaturetype.prototype.handleMultipointOrLinestring?=?function?()?{

????let?_tempCoords?=?[];

????for?(let?_udx?=?0;?_udx?<?this.coords.length;?_udx++)?{

? ?//這個(gè)根據(jù)自己的需要,選擇坐標(biāo)的偏移處理函數(shù)

????????_tempCoords.push(coordtransform.wgs84togcj02(this.coords[_udx][0],?this.coords[_udx][1]));

????}

????this.newcoords?=?_tempCoords;

}

dataByfeaturetype.prototype.handleMultiLineStringOrPolygon?=?function?()?{

????let?_tempCoords?=?[];

????for?(let?_udx?=?0;?_udx?<?this.coords.length;?_udx++)?{

????????let?_evCoords?=?[];

????????for?(let?_ndx?=?0;?_ndx?<?this.coords[_udx].length;?_ndx++)?{

//這個(gè)根據(jù)自己的需要,選擇坐標(biāo)的偏移處理函數(shù)

????????????_evCoords.push(coordtransform.wgs84togcj02(this.coords[_udx][_ndx][0],?this.coords[_udx][_ndx][1]));

????????}

????????_tempCoords.push(_evCoords);

????}

????this.newcoords?=?_tempCoords;

}

dataByfeaturetype.prototype.handleMultiPolygon?=?function?()?{

????let?_tempCoords?=?[];

????for?(let?_udx?=?0;?_udx?<?this.coords.length;?_udx++)?{

????????let?_polygons?=?[];

????????for?(let?_ndx?=?0;?_ndx?<?this.coords[_udx].length;?_ndx++)?{

????????????let?_polygon?=?[];

????????????for?(let?_tdx?=?0;?_tdx?<?this.coords[_udx][_ndx].length;?_tdx++)?{

????????????????_polygon.push(coordtransform.wgs84togcj02(this.coords[_udx][_ndx][_tdx][0],?this.coords[_udx][_ndx][_tdx][1]));

????????????}

????????????_polygons.push(_polygon);

????????}

????????_tempCoords.push(_polygons);

????}

????this.newcoords?=?_tempCoords;

}

//根據(jù)圖層的不同類型,選擇處理方法

dataByfeaturetype.prototype.handleByType?=?function?()?{

????switch?(this.featuretype)?{

????????case?"Point":

????????????this.handlePoint();

????????????break;

????????case?"MultiPoint":

????????case?"LineString":

????????????this.handleMultipointOrLinestring();

????????????break;

????????case?"MultiLineString":

????????case?"Polygon":

????????????this.handleMultiLineStringOrPolygon();

????????????break;

????????case?"MultiPolygon":

????????????this.handleMultiPolygon();

????????????break;

????}

}

//獲取數(shù)據(jù)處理結(jié)果

dataByfeaturetype.prototype.getResult?=?function?()?{

????this.datafeature.geometry.coordinates?=?this.newcoords;

????return?this.datafeature;

};

//輸入文件

fs.readFile('輸入geojson文件',?{

????encoding:?'utf-8'

},?(err,?res)?=>?{

????if?(err)?return;

????let?_geojsondata?=?JSON.parse(res);

????let?_newfeatures?=?[];

????let?_features?=?_geojsondata.features;

????for?(let?_fdx?=?0;?_fdx?<?_features.length;?_fdx++)?{

????????let?_feature?=?_features[_fdx];

????????let?_featurehandle?=?new?dataByfeaturetype(_feature);

????????_featurehandle.handleByType();

????????_newfeatures.push(_featurehandle.getResult());

????}

????_geojsondata.features?=?_newfeatures;

??//輸出處理結(jié)果

????fs.writeFile("輸出geojson",?JSON.stringify(_geojsondata),?(err)?=>?{

????????console.log(err);

????});

});

GIS開發(fā):geojson圖層批量坐標(biāo)轉(zhuǎn)換的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
新营市| 南川市| 禄丰县| 新巴尔虎右旗| 太仆寺旗| 内黄县| 永康市| 巢湖市| 南华县| 明水县| 陆丰市| 瑞丽市| 石景山区| 清新县| 黔西县| 沁源县| 郓城县| 盐亭县| 张掖市| 太仓市| 金华市| 汝州市| 宁晋县| 盘山县| 尼玛县| 磴口县| 兴安盟| 永仁县| 松阳县| 鄂托克前旗| 宁海县| 漠河县| 雷州市| 淮安市| 本溪市| 景德镇市| 胶州市| 新沂市| 健康| 越西县| 郎溪县|