L7 Geospatial Data Visualization Engine

repository·master·Indexed 26 days ago

https://github.com/antvis/l7

An open-source, WebGL-based engine by AntV for high-performance 2D and 3D geospatial data visualization. It supports various map types and data formats including CSV, JSON, and GeoJSON. The ecosystem includes @antv/l7 for core functionality, @antv/l7-layers for built-in layers like PointLayer and HeatmapLayer, and l7-three for rendering 3D models via Three.js.

Tokens
278.9K
Snippets
795
Records
1.5K
Agent score
86%

What's inside L7

  1. Overview of L7 Geospatial Data Visualization Engine

    master

    L7 is an open-source, WebGL-based geospatial data visualization framework designed for large-scale data analysis. It transforms complex spatial data into 2D and 3D symbols using visual variables like color, size, volume, and texture.

    Key Features:

    • Data-Driven Visualization: Supports various map types to derive insights from data.
    • High Performance: Real-time, dynamic rendering of millions of spatial data points in both 2D and 3D.
    • Flexible Data Ingestion: Supports CSV, JSON, and GeoJSON formats, with the ability to define custom data formats without complex spatial transformations.
    • Map Base Support: Supports Amap (Gaode Maps) for domestic compliance and Mapbox for international business needs. It also supports offline/intranet deployment.
  2. Overview of L7 geospatial data visual analysis engine

    master

    L7 is an open-source, WebGL-based framework for large-scale geospatial data visual analysis. It is designed to convert complex spatial data into 2D and 3D symbols using visual variables like color, size, volume, and texture.

    Key capabilities include:

    • Data-driven visual display: Supports various map visualization types to derive insights from numbers and shapes.
    • High-performance rendering: Integrated 2D and 3D rendering capable of handling millions of spatial data points in real-time.
    • Flexible data access: Supports CSV, JSON, and GeoJSON formats, with the ability to customize data formats.
    • Multiple basemaps: Supports AMap (for compliance in China) and Mapbox (for international use), and supports offline intranet deployment.
  3. Supported data formats for L7 layers

    master

    L7 layers use longitude and latitude formats for spatial data. The library supports three primary data source formats:

    • GeoJSON: For standard geographic feature collections.
    • CSV: For delimited text files.
    • JSON: For standard JSON structures.

    Note: Most data formats require a corresponding parser to correctly interpret the data structure.

  4. Understand L7 Scales

    master

    Scales in L7 convert map data values (numbers, dates, categories, etc.) into visual variables like color, size, or shape.

    Two key concepts:

    • Domain: The interval of the input map data values.
    • Range: The interval of the output visual values.

    L7 automatically infers the scale type if not explicitly configured:

    • 'linear': If the field is numeric.
    • 'cat': If the field is a string.
    • Constant: If the field does not exist or is a fixed value.
  5. Understand the @antv/l7-layers Refactoring Roadmap

    master

    The @antv/l7-layers package is undergoing a multi-stage refactoring to decompose the BaseLayer 'God Class' into specialized delegates while maintaining full backward compatibility with the ILayer interface.

    Key architectural changes include:

    • Delegation Pattern: BaseLayer now acts as a coordinator, forwarding ILayer public method calls to specialized internal managers (e.g., LayerStyleFluent, LayerPickingManager, LayerVisibilityZoom).
    • Plugin Modernization: Transitioning to a LayerPluginRegistry for better control over plugin lifecycle and ordering.
    • Configuration Model: Introduction of LayerConfigModel to unify configuration reading and updating via read() and apply(patch) methods.
    • Type Safety: Strengthening types for source options, shape options, and encoded style maps to replace any with specific interfaces like IShapeOption and IEncodedStyleMap.
  6. Understand L7 Component types

    master

    L7 provides three main types of components for map interaction and information display:

    1. Control: UI elements positioned around the edges of the map (e.g., hovering over the map periphery) used for presenting information or providing interaction for the map and its layers.
    2. Popup: Floating bubbles displayed at specific latitude and longitude coordinates on the map. The content within the bubble is fully customizable by the developer.
    3. Marker: Similar to Popups, but the content is rendered directly on the map at the specified coordinates rather than inside a bubble container, allowing for complete custom visual representation.
  7. Understand L7 Scale concepts

    master

    Scale is used to map map data values (numbers, dates, categories, etc.) to visual variables (color, size, shape).

    Two key concepts are:

    • Domain: The defined interval of the map data values.
    • Range: The defined interval of the visual values.

    L7 automatically infers the scale type based on the data type of the first record in a field if no scale is explicitly configured:

    • String: Inferred as cat (categorical).
    • Number: Inferred as linear (continuous).
    • Missing field: Treated as a constant value.
  8. Understand the @antv/l7-layers refactoring roadmap

    master

    The @antv/l7-layers package is undergoing a multi-stage refactoring process to address the 'God Class' problem in BaseLayer.ts and improve maintainability. The roadmap is divided into several phases:

    • Phase 0: Cleanup: Low-risk cleaning of naming, types, and dead code.
    • Phase 1: Decompose God Class: Breaking down BaseLayer using internal delegation while maintaining external transparency.
    • Phase 2: Plugin/Service Convergence: Improving plugin mechanisms and service replacement/testability.
    • Phase 3: Configuration/Types: Enhancing type safety and establishing a single source of truth.
    • Phase 4: Rendering Pipeline: Refactoring the rendering hot path (render, renderModels, renderMultiPass).
    • Phase 5: Tiles/Sub-layers: Clarifying boundaries and removing duplication in tile layers.
    • Phase 6: Testing/Documentation: Continuous improvement of coverage.
    • Phase 7: API Evolution: Long-term expansion and API changes.
  9. Understand the @antv/l7-source progressive refactoring process

    master

    The @antv/l7-source package is undergoing a progressive refactoring. This process is documented to ensure architectural continuity and to allow developers to track changes, risks, and progress.

    Key documentation files for understanding the refactoring state include:

    • PLAN.md: The complete refactoring roadmap (Phases 0–7), including status diagnosis, priority matrix, and risk mitigation.
    • PROGRESS.md: A chronological record of refactoring steps, detailing what was changed, how it was verified, and associated risks.
    • BACKLOG.md: A list of legacy issues, pending optimizations, and known problems not addressed in the current round.
    • ADR/: Architectural Decision Records for key structural choices.

    Refactoring is guided by principles of behavioral equivalence, strict backward compatibility for the ISource interface and public exports, and incremental, documented updates.

  10. Understand the Source data lifecycle

    master

    The L7 Source follows a specific pipeline for processing data:

    1. Raw Data: The initial input (GeoJSON, MVT, etc.).
    2. Loader: Fetches or decodes the raw data (e.g., MVTLoader, ImageLoader).
    3. Parser: A pure function that transforms the loaded data into a specific shape (IParserData).
    4. Transforms: Operations like filter, map, join, grid, or cluster that act on the parsed data. Note that modern transforms are immutable and return new objects rather than modifying the input in place.
  11. Use RasterLayer for image and data tiles

    master

    The RasterLayer in L7 supports loading various image tile formats including TMS, WMS, and WMTS, as well as Tiff and Lerc data raster tiles.

    Supported configurations:

    • Picture grid: Use parserType: 'rasterTile' and dataType: 'image'.
    • Data grid: Use parserType: 'rasterTile' and dataType: 'arraybuffer' (single channel).
    • Color remote sensing image: Use parserType: 'rasterRgb' and dataType: 'arraybuffer' (multi-channel).

    Note: Currently only supports the 3857 coordinate system.