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

5 months ago

1.2.10

4 months ago

1.2.9

4 months ago

1.2.7

6 months ago

1.2.6

6 months ago

1.2.5

6 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

6 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

8 months ago

1.1.94

8 months ago

1.1.93

9 months ago

1.1.92

9 months ago

1.1.91

9 months ago

1.1.90

9 months ago

1.1.89

9 months ago

1.1.88

9 months ago

1.1.87

10 months ago

1.1.86

10 months ago

1.1.85

10 months ago

1.1.84

10 months ago

1.1.81

11 months ago

1.1.83

11 months ago

1.1.82

11 months ago

1.1.80

11 months ago

1.1.79

11 months ago

1.1.78

11 months ago

1.1.77

11 months ago

1.1.76

11 months ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.70

11 months ago

1.1.74

11 months ago

1.1.30

1 year ago

1.1.73

11 months ago

1.1.72

11 months ago

1.1.71

11 months ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.75

11 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

12 months ago

1.1.50

12 months ago

1.1.56

12 months ago

1.1.55

12 months ago

1.1.54

12 months ago

1.1.53

12 months ago

1.1.16

1 year ago

1.1.59

12 months ago

1.1.15

1 year ago

1.1.58

12 months ago

1.1.57

12 months ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.63

12 months ago

1.1.62

12 months ago

1.1.61

12 months ago

1.1.60

12 months ago

1.1.67

12 months ago

1.1.23

1 year ago

1.1.66

12 months ago

1.1.22

1 year ago

1.1.65

12 months ago

1.1.21

1 year ago

1.1.64

12 months ago

1.1.20

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.69

11 months ago

1.1.25

1 year ago

1.1.68

11 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