Browse Source

fix: 修复导入geojson圆覆盖物报错问题

master
Cmen 3 years ago
parent
commit
b6a34f9d0e
  1. 8
      src/store/utils/getMapOptions.ts

8
src/store/utils/getMapOptions.ts

@ -23,7 +23,7 @@ export function getMapOptions(geojson: GeoJSON.FeatureCollection) {
const addPolygon = (feature: GeoJSON.Feature) => { const addPolygon = (feature: GeoJSON.Feature) => {
const { geometry, properties } = feature; const { geometry, properties } = feature;
const { name, fineType, lngLat, radius, building, water, grass, height } = const { name, fineType, center, radius, building, water, grass, height } =
properties as any; properties as any;
const { coordinates } = geometry as GeoJSON.Polygon; const { coordinates } = geometry as GeoJSON.Polygon;
const path = convertPath(coordinates[0]); const path = convertPath(coordinates[0]);
@ -32,11 +32,11 @@ export function getMapOptions(geojson: GeoJSON.FeatureCollection) {
name, name,
type: OverlayTypes.Polygon, type: OverlayTypes.Polygon,
}; };
if (fineType === "rect") { if (fineType === OverlayTypes.Rectangle) {
overlay.path = path; overlay.path = path;
overlay.type = OverlayTypes.Rectangle; overlay.type = OverlayTypes.Rectangle;
} else if (fineType === "circle") { } else if (fineType === OverlayTypes.Circle) {
overlay.lngLat = lngLat; overlay.lngLat = center;
overlay.radius = radius; overlay.radius = radius;
overlay.type = OverlayTypes.Circle; overlay.type = OverlayTypes.Circle;
} else { } else {

Loading…
Cancel
Save