Skip to content

Instantly share code, notes, and snippets.

@wantwantxu
wantwantxu / geojson2polyline
Last active Apr 21, 2021
#leaflet #geojson
View geojson2polyline
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