1.2.11 • Published 2 months ago

@ido-team/map v1.2.11

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

地图 api 说明

地图配置项示例

IdoMap.mapOptions = {
  lat: 31.936722,
  lng: 120.050611,
  zoom: 11,
  layer: [
    {
      url: "http://t1.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk=key",
      Subdomains: ["0", "1", "2", "3"],
    },
  ],
};

地图配置项详细

lat: number;
lng: number;
CRS?: "4490";
layer?: {
    url: string;
    Subdomains?: string[];
    maxZoom?: number;
    minZoom?: number;
    errorTileUrl?: string;
    attribution?: string;
  }[];
attribution?: string;

初始化

const mapInstance = new IdoMap("divId");

方法

创建点位 createMarkers

const collections = mapInstance.createMarkers([
  {
    id: "1", //唯一标识,可根据数据对比进行局部点位更新
    lat: "31.936722", //纬度
    lng: "120.050611", //经度,
    iconAnchor: [12, 0],
    className: "leaflet-div-icon",
    html: "XXXX公司",
    popupHtml:
      '<div style="background: #ffffff;"><a href=javascript:alert("当前企业:${obj.html}")>${obj.html}</a></div>',
    enterprise_id: "aaaa",
  },
  {
    id: "3", //唯一标识,可根据数据对比进行局部点位更新
    clickEvent: "alert('当前企业id:${obj.enterprise_id}')", //点击事件
    lat: "31.936722", //纬度
    lng: "120.050611", //经度,
    enterprise_id: "12345678",
  },
  {
    lat: "31.906707", //纬度
    lng: "120.151291", //经度,
    popupHtml: '<div style="background: #ffffff;">222</div>',
  },
]);

通过 geojson 生成图层/集合 createByGeoJson

const geoLayer = mapInstance.createByGeoJson(lineString, {
  style: { color: "red", weight: 1, dashArray: 3 },
  popupHtml: "多边形",
  enterprise_id: "2222",
  clickEvent: "alert('当前企业id:${obj.enterprise_id}')", //点击事件
});

创建图层 createLayer

const layer = mapInstance.createLayer(
  {
    layerType: "special_enterprise",
    collections
  }
);

为地图/图层添加图层/集合 addLayer

mapInstance.addLayer(layer);
或
mapInstance.addLayer(geoLayer,layer);
1.2.11

2 months ago

1.2.8

6 months ago

1.2.10

5 months ago

1.2.9

5 months ago

1.2.7

6 months ago

1.2.6

6 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.99

7 months ago

1.1.98

8 months ago

1.1.97

8 months ago

1.1.96

8 months ago

1.1.95

9 months ago

1.1.94

9 months ago

1.1.93

9 months ago

1.1.92

9 months ago

1.1.91

9 months ago

1.1.90

10 months ago

1.1.89

10 months ago

1.1.88

10 months ago

1.1.87

10 months ago

1.1.86

10 months ago

1.1.85

10 months ago

1.1.84

11 months ago

1.1.81

12 months ago

1.1.83

12 months ago

1.1.82

12 months ago

1.1.80

12 months ago

1.1.79

12 months ago

1.1.78

12 months ago

1.1.77

12 months ago

1.1.76

12 months ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.70

12 months ago

1.1.74

12 months ago

1.1.30

1 year ago

1.1.73

12 months ago

1.1.72

12 months ago

1.1.71

12 months ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.75

12 months ago

1.1.31

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.39

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.52

1 year ago

1.1.50

1 year ago

1.1.56

1 year ago

1.1.55

1 year ago

1.1.54

1 year ago

1.1.53

1 year ago

1.1.16

1 year ago

1.1.59

1 year ago

1.1.15

1 year ago

1.1.58

1 year ago

1.1.57

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.63

1 year ago

1.1.62

1 year ago

1.1.61

1 year ago

1.1.60

1 year ago

1.1.67

12 months ago

1.1.23

1 year ago

1.1.66

1 year ago

1.1.22

1 year ago

1.1.65

1 year ago

1.1.21

1 year ago

1.1.64

1 year ago

1.1.20

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.69

12 months ago

1.1.25

1 year ago

1.1.68

12 months ago

1.1.24

1 year ago

1.1.14

1 year ago

1.1.9-alpha.1

1 year ago

1.1.3-alpha.1

1 year ago

1.1.8-alpha.1

1 year ago

1.1.7-alpha.1

1 year ago

1.1.5-alpha.1

1 year ago

1.1.6-alpha.1

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.2-alpha.1

1 year ago

1.1.13

1 year ago

1.1.1-alpha.1

1 year ago

1.1.0-alpha.1

1 year ago

1.0.0-alpha.1

1 year ago