diff --git a/index.html b/index.html index 60227e97..0c07915b 100644 --- a/index.html +++ b/index.html @@ -31,8 +31,8 @@ - + diff --git a/src/components/MapboxMaps/MapComponent.vue b/src/components/MapboxMaps/MapComponent.vue index 6b2a7cc6..9ef514d0 100644 --- a/src/components/MapboxMaps/MapComponent.vue +++ b/src/components/MapboxMaps/MapComponent.vue @@ -422,7 +422,11 @@ function splitMultiPolygons(str) { let hadnlerStr = str.replace(",MULTIPOLYGON","-MULTIPOLYGON"); + + hadnlerStr = str.replace(",POLYGON","-POLYGON"); + let result = hadnlerStr.split("-"); + // 移除开头的 "MULTIPOLYGON" 和多余的括号 // const cleanedStr = str.replace(/^MULTIPOLYGON\(/, '').replace(/\)+$/, ''); @@ -450,15 +454,18 @@ // let geom = "POLYGON((118.30942404 34.54767078,118.30959516 34.54754872,118.30958905 34.54752205,118.30959487 34.54750374,118.30965049 34.54746674,118.30964908 34.54745006,118.30962383 34.54738605,118.30957555 34.5472699,118.30952264 34.54714257,118.30973014 34.54667279,118.30967912 34.54659146,118.30936047 34.54675231,118.30931661 34.54664677,118.30928872 34.54661326,118.30928872 34.54661326,118.30926985 34.54670567,118.30924701 34.5468275,118.3092984 34.54689984,118.30928597 34.54696466,118.30932441 34.54694948,118.30934028 34.54697598,118.30934409 34.54702737,118.30940075 34.54711623,118.30932317 34.54714554,118.30935741 34.54735289,118.30942404 34.54767078,118.30942404 34.54767078))"; let calAreaParams = { - "wktgeom":geom, - "type":type + "wktgeom":geom, + "type":type } splitTubanBackYuan(calAreaParams).then(res=>{ + + if(!res.gengdituban){ message.warning("分割数据为空"); emit("handlerSplitResultEmpty"); + return null; } let geojson = { @@ -470,11 +477,10 @@ let wktArray = splitMultiPolygons(res.gengdituban); - if(wktArray.length>0){ wktArray?.forEach((item,index)=>{ - console.log("item",item); + let feature = { "type": "Feature", "properties": {