Skip to content

Instantly share code, notes, and snippets.

@wantwantxu
wantwantxu / geojson2polyline
Last active April 21, 2021 08:22
#leaflet #geojson
class GeoJsonUtil{
geojson2Leaflet(geojson , vectorConfig){
let shapes = [];
for(let i = 0, len = geojson.features.length; i < len; ++i){
let feature = geojson.features[i];
feature.id = feature.properties[vectorConfig.idField?vectorConfig.idField:'id']
feature.name = feature.properties[vectorConfig.nameField?vectorConfig.nameField:'name']
let geom = this._reverseLatLng(feature.geometry)
let shape = null
let opt = vectorConfig.style