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

Loading…
Cancel
Save