tlbs-map-vue

repository·master·Indexed 40 days ago

https://github.com/tencent/tlbs-map-vue

A Vue component library for version 1.3.2 that wraps the Tencent Location Based Services (LBS) JavaScript API. It enables reactive map management for Vue 2 and Vue 3 applications, featuring components like Arc for flow visualization, Area for regional data, Dot for scatter plots, and DomOverlay for custom HTML overlays.

Tokens
20.9K
Snippets
39
Records
108
Agent score
50%

What's inside tlbs-map-vue

  1. Overview of tlbs-map-vue features

    master

    tlbs-map-vue is a Vue-based component library built on top of the Tencent LBS JavaScript API.

    Key features include:

    • Reactive Components: Encapsulates Tencent Map APIs into reactive Vue components. You can change map effects by simply modifying data without managing complex API calls.
    • Framework Compatibility: Supports both Vue 2 and Vue 3.
    • High Extensibility: Provides access to map and layer instances, allowing you to call underlying Tencent Map APIs directly.
  2. Use the Heatmap component

    master

    The Heatmap component visualizes data density and distribution trends using color gradients. You can pass data points and configure visual properties like radius, height, and opacity directly via props.

    <Heat 
      :data="heatData" 
      :radius="50" 
      :height="100" 
      :opacity="0.8" 
      :min="0" 
      :max="100"
    />
  3. Use the Area component for regional data visualization

    master

    The Area component is used to display the outlines of different regions and their data distributions on a map. It allows for custom styling, data binding, and interaction handling like clicks and hovers.

    <Area 
      :data="yourAreaData" 
      :styles="yourAreaStyles" 
      :selectOptions="yourSelectOptions" 
      :options="yourAreaOptions" 
    />
  4. Use the MultiMarker component

    master

    The MultiMarker component is used to display multiple annotation points on a map with customizable icons. You can pass point data via geometries, define styles via styles, and configure layer behavior using options.

    <template>
      <!-- Example usage of MultiMarker -->
      <MultiMarker
        id="my-layer"
        :geometries="geometries"
        :styles="styles"
        :options="options"
      />
    </template>
    
    <script setup>
    // geometries: TMap.PointGeometry[]
    // styles: { [key: string]: TMap.MarkerStyleOptions }
    // options: TMap.MultiMarkerOptions
    </script>
  5. Use the MultiPolyline component

    master

    The MultiPolyline component is used to display multiple polylines on a map, allowing for custom styling for each individual line. You can pass geometries (the line data) and styles (the visual appearance) via props.

    <MultiPolyline
      id="my-polyline-layer"
      :geometries="polylineData"
      :styles="polylineStyles"
      :options="{
        disableInteractive: false,
        isStopPropagation: false
      }"
    />
  6. Use the MultiCircle component

    master

    The MultiCircle component is used to render multiple circles on the map, allowing for custom styling for each circle. You can pass circle data via the geometries prop and define styles using the styles prop.

    <CircleDemo/>
    
    <!-- Example usage pattern based on component structure -->
    <MultiCircle
      :geometries="[{ id: 'circle1', center: { lat: 22.5, lng: 114.0 }, radius: 1000 }]"
      :styles="{ 'circle1': { fillColor: '#ff0000' } }"
    />
  7. Use MarkerClusterOverlay for point clustering

    master

    The MarkerClusterOverlay component provides a way to group multiple map markers into clusters based on their proximity. This helps manage map clutter when displaying a large number of points. You can control the clustering behavior using props like gridSize (the distance threshold for clustering) and maxZoom (the zoom level above which clustering stops).

    <MarkerClusterOverlay
      :geometries="yourPointGeometries"
      :gridSize="60"
      :maxZoom="20"
    />
  8. Use the Arc component for flow visualization

    master

    The Arc component is used to visualize connections between two points, making it ideal for migration maps or flow direction scenarios.

    To use it, provide an array of TMap.visualization.ArcLine data to the data prop. You can control the visual style via pickerStyle or the options prop. The mode prop determines if the arcs are horizontal (clinging to the ground) or vertical (perpendicular to the map plane).

    <Arc 
      :data="arcData" 
      mode="vertical" 
      :options="arcOptions" 
    />
  9. Use the GeometryEditor component

    master

    The GeometryEditor component allows users to draw and edit circular and polygonal geometries on a map. It supports features like snapping, selection, splitting, and unioning polygons.

    To use it, you can pass configuration props for circles and polygons, such as layer IDs, initial geometries, and styles. You can also control the editor's mode (e.g., 'edit' or 'draw') and whether snapping or selection is enabled.

    <GeometryEditor 
      circleId="my-circle-layer" 
      polygonId="my-polygon-layer" 
      actionMode="draw" 
      snappable={true} 
    />