Gogeo

package module
v1.6.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: AGPL-3.0-or-later Imports: 32 Imported by: 4

README

Gogeo - High-Performance GIS Spatial Analysis Library for Go

Go Version GDAL

Gogeo is a high-performance Go GIS spatial analysis library built on GDAL/OGR, designed for large-scale geospatial data processing. It provides comprehensive spatial analysis capabilities through parallel computing, tile-based processing, and precision control.

✨ Key Features

🚀 High-Performance Parallel Computing
  • Tile-based Processing: Automatically splits large datasets into tiles for parallel processing
  • Multi-threaded Worker Pool: Configurable concurrent worker threads
  • Memory Optimization: Smart memory management and resource cleanup
  • Progress Monitoring: Real-time progress callbacks and user cancellation support
🎯 Complete Spatial Analysis Operations
  • Clip: Clip one layer with another layer
  • Erase: Remove overlapping parts from input layer
  • Identity: Preserve input features and add overlapping attributes
  • Intersect: Calculate intersection of two layers
  • SymDifference: Calculate symmetric difference of two layers
  • Union: Calculate union of two layers
  • Update: Update one layer with another layer
📁 Comprehensive Data I/O Support
  • PostGIS Database: Read from and write to PostGIS databases
  • Shapefile: Support for ESRI Shapefile format
  • File Geodatabase: Support for ESRI File Geodatabase (.gdb)
  • Format Conversion: Convert between different geospatial formats
  • Layer Management: List layers, get layer information, and metadata
🔧 Advanced Features
  • Geometry Precision Control: Configurable geometry precision grid
  • Field Management: Smart field mapping and conflict resolution
  • Spatial Indexing: Automatic spatial index optimization for query performance
  • Boundary Processing: Intelligent boundary feature deduplication
  • Resource Management: Automatic cleanup with finalizers

📦 Installation

Prerequisites

Ensure GDAL development libraries are installed on your system:

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install libgdal-dev gdal-bin

CentOS/RHEL:

sudo yum install gdal-devel gdal

macOS:

brew install gdal

Windows: Download and install OSGeo4W or GDAL Windows binaries

Install Gogeo
go get github.com/GrainArc/Gogeo

🚀 Quick Start

Basic Usage Example
package main

import (
   "fmt"
   "log"
   "path/filepath"
   "runtime"
   "time"

   "github.com/GrainArc/Gogeo" // 根据您的实际包路径调整
)

func main() {
   // 设置输入文件路径
   shpFile1 := "data/layer1.shp"  // 第一个shapefile路径
   shpFile2 := "data/layer2.shp"  // 第二个shapefile路径
   outputFile := "output/intersection_result.shp" // 输出文件路径

   fmt.Println("开始空间相交分析测试...")
   fmt.Printf("输入文件1: %s\n", shpFile1)
   fmt.Printf("输入文件2: %s\n", shpFile2)
   fmt.Printf("输出文件: %s\n", outputFile)

   // 执行空间相交分析
   err := performSpatialIntersectionTest(shpFile1, shpFile2, outputFile)
   if err != nil {
      log.Fatalf("空间相交分析失败: %v", err)
   }

   fmt.Println("空间相交分析完成!")
}

func performSpatialIntersectionTest(shpFile1, shpFile2, outputFile string) error {
   startTime := time.Now()

   // 1. 读取第一个shapefile
   fmt.Println("正在读取第一个shapefile...")
   reader1, err := Gogeo.NewFileGeoReader(shpFile1)
   if err != nil {
      return fmt.Errorf("创建第一个文件读取器失败: %v", err)
   }

   layer1, err := reader1.ReadShapeFile()
   if err != nil {
      return fmt.Errorf("读取第一个shapefile失败: %v", err)
   }

   // 打印第一个图层信息
   fmt.Println("第一个图层信息:")
   layer1.PrintLayerInfo()

   // 2. 读取第二个shapefile
   fmt.Println("\n正在读取第二个shapefile...")
   reader2, err := Gogeo.NewFileGeoReader(shpFile2)
   if err != nil {
      layer1.Close()
      return fmt.Errorf("创建第二个文件读取器失败: %v", err)
   }

   layer2, err := reader2.ReadShapeFile()
   if err != nil {
      layer1.Close()
      return fmt.Errorf("读取第二个shapefile失败: %v", err)
   }

   // 打印第二个图层信息
   fmt.Println("第二个图层信息:")
   layer2.PrintLayerInfo()

   // 3. 配置并行相交分析参数
   config := &Gogeo.ParallelGeosConfig{
      TileCount:      4,                    // 4x4分块
      MaxWorkers:     runtime.NumCPU(),     // 使用所有CPU核心
      BufferDistance: 0.001,                // 分块缓冲距离
      IsMergeTile:    true,                 // 合并分块结果
      ProgressCallback: progressCallback,   // 进度回调函数
      PrecisionConfig: &Gogeo.GeometryPrecisionConfig{
         Enabled:       true,
         GridSize:      0.0001,  // 几何精度网格大小
         PreserveTopo:  true,    // 保持拓扑
         KeepCollapsed: false,   // 不保留退化几何
      },
   }

   // 4. 选择字段合并策略
   strategy := Gogeo.MergeWithPrefix // 使用前缀区分字段来源

   fmt.Printf("\n开始执行空间相交分析...")
   fmt.Printf("分块配置: %dx%d, 工作线程: %d\n",
      config.TileCount, config.TileCount, config.MaxWorkers)
   fmt.Printf("字段合并策略: %s\n", strategy.String())

   // 5. 执行空间相交分析
   result, err := Gogeo.SpatialIntersectionAnalysis(layer1, layer2, strategy, config)
   if err != nil {
      return fmt.Errorf("空间相交分析执行失败: %v", err)
   }

   analysisTime := time.Since(startTime)
   fmt.Printf("\n相交分析完成! 耗时: %v\n", analysisTime)
   fmt.Printf("结果要素数量: %d\n", result.ResultCount)

   // 6. 将结果写出为shapefile
   fmt.Println("正在写出结果到shapefile...")
   writeStartTime := time.Now()

   // 获取输出文件的图层名称(不含扩展名)
   layerName := getFileNameWithoutExt(outputFile)

   err = Gogeo.WriteShapeFileLayer(result.OutputLayer, outputFile, layerName, true)
   if err != nil {
      result.OutputLayer.Close()
      return fmt.Errorf("写出shapefile失败: %v", err)
   }

   writeTime := time.Since(writeStartTime)
   totalTime := time.Since(startTime)

   fmt.Printf("结果写出完成! 耗时: %v\n", writeTime)
   fmt.Printf("总耗时: %v\n", totalTime)
   fmt.Printf("输出文件: %s\n", outputFile)

   // 7. 验证输出文件
   err = verifyOutputFile(outputFile)
   if err != nil {
      fmt.Printf("警告: 输出文件验证失败: %v\n", err)
   } else {
      fmt.Println("输出文件验证成功!")
   }

   // 清理资源
   result.OutputLayer.Close()

   return nil
}

// progressCallback 进度回调函数
func progressCallback(complete float64, message string) bool {
   // 显示进度信息
   fmt.Printf("\r进度: %.1f%% - %s", complete*100, message)

   // 如果进度完成,换行
   if complete >= 1.0 {
      fmt.Println()
   }

   // 返回true继续执行,返回false取消执行
   return true
}

// getFileNameWithoutExt 获取不含扩展名的文件名
func getFileNameWithoutExt(filePath string) string {
   fileName := filepath.Base(filePath)
   return fileName[:len(fileName)-len(filepath.Ext(fileName))]
}

// verifyOutputFile 验证输出文件
func verifyOutputFile(filePath string) error {
   // 读取输出文件验证
   reader, err := Gogeo.NewFileGeoReader(filePath)
   if err != nil {
      return fmt.Errorf("无法读取输出文件: %v", err)
   }

   layer, err := reader.ReadShapeFile()
   if err != nil {
      return fmt.Errorf("无法读取输出图层: %v", err)
   }
   defer layer.Close()

   // 打印输出图层信息
   fmt.Println("\n输出图层信息:")
   layer.PrintLayerInfo()

   // 检查要素数量
   featureCount := layer.GetFeatureCount()
   if featureCount == 0 {
      return fmt.Errorf("输出文件中没有要素")
   }

   fmt.Printf("验证通过: 输出文件包含 %d 个要素\n", featureCount)
   return nil
}

// 高级测试函数:测试不同的字段合并策略
func testDifferentStrategies(shpFile1, shpFile2 string) error {
   strategies := []Gogeo.FieldMergeStrategy{
      Gogeo.UseTable1Fields,
      Gogeo.UseTable2Fields,
      Gogeo.MergePreferTable1,
      Gogeo.MergePreferTable2,
      Gogeo.MergeWithPrefix,
   }

   config := &Gogeo.ParallelGeosConfig{
      TileCount:      2,
      MaxWorkers:     runtime.NumCPU(),
      BufferDistance: 0.001,
      IsMergeTile:    true,
      ProgressCallback: progressCallback,
   }

   for i, strategy := range strategies {
      fmt.Printf("\n=== 测试策略 %d: %s ===\n", i+1, strategy.String())

      outputFile := fmt.Sprintf("output/test_strategy_%d.shp", i+1)

      // 读取图层
      layer1, err := Gogeo.ReadShapeFileLayer(shpFile1)
      if err != nil {
         return err
      }

      layer2, err := Gogeo.ReadShapeFileLayer(shpFile2)
      if err != nil {
         layer1.Close()
         return err
      }

      // 执行分析
      result, err := Gogeo.SpatialIntersectionAnalysis(layer1, layer2, strategy, config)
      if err != nil {
         return fmt.Errorf("策略 %s 执行失败: %v", strategy.String(), err)
      }

      // 写出结果
      layerName := fmt.Sprintf("strategy_%d", i+1)
      err = Gogeo.WriteShapeFileLayer(result.OutputLayer, outputFile, layerName, true)
      if err != nil {
         result.OutputLayer.Close()
         return fmt.Errorf("策略 %s 写出失败: %v", strategy.String(), err)
      }

      fmt.Printf("策略 %s 完成,结果要素: %d,输出: %s\n",
         strategy.String(), result.ResultCount, outputFile)

      result.OutputLayer.Close()
   }

   return nil
}

// 性能测试函数
func performanceTest(shpFile1, shpFile2 string) error {
   fmt.Println("\n=== 性能测试 ===")

   // 测试不同的分块配置
   tileConfigs := []int{2, 4, 8}

   for _, tileCount := range tileConfigs {
      fmt.Printf("\n--- 测试分块配置: %dx%d ---\n", tileCount, tileCount)

      config := &Gogeo.ParallelGeosConfig{
         TileCount:      tileCount,
         MaxWorkers:     runtime.NumCPU(),
         BufferDistance: 0.001,
         IsMergeTile:    true,
         ProgressCallback: nil, // 性能测试时不显示进度
      }

      startTime := time.Now()

      // 读取图层
      layer1, err := Gogeo.ReadShapeFileLayer(shpFile1)
      if err != nil {
         return err
      }

      layer2, err := Gogeo.ReadShapeFileLayer(shpFile2)
      if err != nil {
         layer1.Close()
         return err
      }

      // 执行分析
      result, err := Gogeo.SpatialIntersectionAnalysis(layer1, layer2,
         Gogeo.MergePreferTable1, config)
      if err != nil {
         return err
      }

      duration := time.Since(startTime)
      fmt.Printf("分块 %dx%d: 耗时 %v, 结果要素 %d\n",
         tileCount, tileCount, duration, result.ResultCount)

      result.OutputLayer.Close()
   }

   return nil
}

PostGIS Database Example
// Configure PostGIS connection
config := &gogeo.PostGISConfig{
    Host:     "localhost",
    Port:     "5432",
    Database: "gis_db",
    User:     "postgres",
    Password: "password",
    Schema:   "public",
    Table:    "land_use",
}

// Create PostGIS reader
reader := gogeo.NewPostGISReader(config)
layer, err := reader.ReadGeometryTable()
if err != nil {
    log.Fatal("Failed to read PostGIS table:", err)
}
defer layer.Close()

// Print layer information
layer.PrintLayerInfo()

📚 API Documentation

Core Data Structures
// Parallel processing configuration
type ParallelGeosConfig struct {
    MaxWorkers       int                        // Maximum worker threads
    TileCount        int                        // Tile count (N×N grid)
    IsMergeTile      bool                       // Whether to merge tile results
    PrecisionConfig  *GeometryPrecisionConfig   // Geometry precision configuration
    ProgressCallback ProgressCallback           // Progress callback function
}

// Geometry precision configuration
type GeometryPrecisionConfig struct {
    Enabled           bool    // Enable precision control
    GridSize          float64 // Precision grid size
    PreserveCollinear bool    // Preserve collinear points
    KeepCollapsed     bool    // Keep collapsed geometries
}

// Analysis result
type GeosAnalysisResult struct {
    OutputLayer *GDALLayer // Output layer
    ResultCount int        // Number of result features
}

// PostGIS connection configuration
type PostGISConfig struct {
    Host     string // Database host
    Port     string // Database port
    Database string // Database name
    User     string // Username
    Password string // Password
    Schema   string // Schema name
    Table    string // Table name
}
Spatial Analysis Functions
// Spatial clip
func SpatialClipAnalysis(inputLayer, clipLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Spatial erase
func SpatialEraseAnalysis(inputLayer, eraseLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Spatial identity
func SpatialIdentityAnalysis(inputLayer, methodLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Spatial intersect
func SpatialIntersectAnalysis(inputLayer, intersectLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Spatial union
func SpatialUnionAnalysis(inputLayer, unionLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Symmetric difference
func SpatialSymDifferenceAnalysis(inputLayer, diffLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

// Spatial update
func SpatialUpdateAnalysis(inputLayer, updateLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)
Data I/O Functions
// Read functions
func ReadShapeFileLayer(filePath string, layerName ...string) (*GDALLayer, error)
func ReadGDBLayer(filePath string, layerName ...string) (*GDALLayer, error)
func ReadGeospatialFile(filePath string, layerName ...string) (*GDALLayer, error)

// Write functions
func WriteShapeFileLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error
func WriteGDBLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error
func WriteGeospatialFile(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

// Utility functions
func ConvertFile(sourceFilePath, targetFilePath, sourceLayerName, targetLayerName string, overwrite bool) error
func CopyLayerToFile(sourceLayer *GDALLayer, targetFilePath, targetLayerName string, overwrite bool) error
PostGIS Functions
// Create PostGIS reader
func NewPostGISReader(config *PostGISConfig) *PostGISReader

// Read geometry table
func (r *PostGISReader) ReadGeometryTable() (*GDALLayer, error)

// Convenience function
func MakePGReader(table string) *PostGISReader

🎯 Use Cases

1. Large-Scale Land Use Analysis
// Process provincial land use data with administrative boundaries
landUseResult, err := gogeo.SpatialIdentityAnalysis(landUseLayer, adminBoundaryLayer, &gogeo.ParallelGeosConfig{
    MaxWorkers:  12,
    TileCount:   6,
    IsMergeTile: true,
})
2. Environmental Impact Assessment
// Calculate intersection of project impact area with protected areas
impactResult, err := gogeo.SpatialIntersectAnalysis(projectAreaLayer, protectedAreaLayer, config)
3. Urban Planning Analysis
// Erase ecological protection areas from construction land
buildableResult, err := gogeo.SpatialEraseAnalysis(constructionLayer, ecologyLayer, config)
4. Data Format Migration
// Migrate Shapefile data to PostGIS
sourceLayer, _ := gogeo.ReadShapeFileLayer("data.shp")
// Process and save to PostGIS (implementation depends on your PostGIS writer)

⚡ Performance Optimization

1. Parallel Configuration Recommendations
// CPU-intensive tasks
config.MaxWorkers = runtime.NumCPU()

// I/O-intensive tasks  
config.MaxWorkers = runtime.NumCPU() * 2

// Large dataset processing
config.TileCount = 8  // 64 tiles
2. Memory Optimization
// Enable result merging to reduce memory usage
config.IsMergeTile = true

// Appropriate precision settings to avoid over-computation
config.PrecisionConfig.GridSize = 0.001  // 1mm precision is usually sufficient
3. Data Preprocessing
  • Build spatial indexes on data before analysis
  • Remove invalid geometries
  • Ensure consistent coordinate reference systems

🔧 Configuration Parameters

MaxWorkers (Worker Thread Count)
  • Recommended: 1-2 times CPU core count
  • Impact: Too many causes context switching overhead, too few underutilizes CPU
TileCount (Tile Count)
  • Recommended: 4-8 (generates 16-64 tiles)
  • Impact: Too many tiles increase boundary processing overhead, too few reduce parallelism
GridSize (Precision Grid)
  • Recommended: 0.001-0.0001 (1mm-0.1mm)
  • Impact: Too large loses detail, too small increases computation overhead

🐛 Troubleshooting

Common Issues
  1. GDAL Library Not Found

    Error: cannot find GDAL library
    Solution: Ensure GDAL development libraries are properly installed and environment variables are set
    
  2. Out of Memory

    Error: out of memory
    Solution: Reduce MaxWorkers or increase TileCount for finer granularity
    
  3. Invalid Geometry

    Error: invalid geometry
    Solution: Enable precision control or preprocess data to remove invalid geometries
    
  4. PostGIS Connection Failed

    Error: connection failed
    Solution: Check database connection parameters and ensure PostgreSQL/PostGIS is running
    
Debugging Tips
// Enable verbose logging
config.ProgressCallback = func(progress float64, message string) bool {
    log.Printf("Progress: %.2f%% - %s", progress*100, message)
    return true
}

// Check data validity
if layer.GetFeatureCount() == 0 {
    log.Println("Warning: Layer is empty")
}

// Print layer information
layer.PrintLayerInfo()

🤝 Contributing

We welcome contributions of all kinds!

How to Contribute
  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request
Development Environment Setup
# Clone repository
git clone https://github.com/yourusername/gogeo.git
cd gogeo

# Install dependencies
go mod tidy

# Run tests
go test ./...

# Build examples
go build ./examples/...
Code Style
  • Follow Go conventions and best practices
  • Add comprehensive tests for new features
  • Update documentation for API changes
  • Ensure proper resource cleanup

📄 License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

What this means:
  • Free for open source projects: You can use, modify, and distribute this code in open source projects
  • Educational and research use: Free for academic and research purposes
  • No proprietary/commercial use: You cannot use this code in closed-source commercial products
  • 📋 Share improvements: Any modifications must be shared under the same license
  • 🌐 Network services: If you run this as a web service, you must provide the source code
Commercial Licensing

For commercial use or if you need a different license, please contact us at: your.email@example.com

We offer flexible commercial licenses for businesses that want to use Gogeo in proprietary applications.

Full License Text

The complete AGPL-3.0 license text is available at: https://www.gnu.org/licenses/agpl-3.0.html

🙏 Acknowledgments

  • GDAL/OGR - Powerful geospatial data processing library
  • GEOS - Geometry computation engine
  • PostGIS - Spatial database extension for PostgreSQL
  • All contributors to the Go community

📞 Contact


⭐ If this project helps you, please give us a star!

Documentation

Overview

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

RasterBand.go

RasterBandAdvanced.go

RasterBandCalculator.go

RasterClip.go

RasterColor.go

RasterMosaic.go

RasterReader.go

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2024 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Copyright (C) 2024 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

gogeo/batch_sync.go

Copyright (C) 2025 [GrainArc]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Gogeo/tiff_writer.go

Index

Constants

View Source
const (
	GDBFieldTypeOID      = "esriFieldTypeOID"
	GDBFieldTypeString   = "esriFieldTypeString"
	GDBFieldTypeInteger  = "esriFieldTypeInteger"
	GDBFieldTypeSmallInt = "esriFieldTypeSmallInteger"
	GDBFieldTypeDouble   = "esriFieldTypeDouble"
	GDBFieldTypeSingle   = "esriFieldTypeSingle"
	GDBFieldTypeDate     = "esriFieldTypeDate"
	GDBFieldTypeGeometry = "esriFieldTypeGeometry"
	GDBFieldTypeBlob     = "esriFieldTypeBlob"
	GDBFieldTypeGlobalID = "esriFieldTypeGlobalID"
	GDBFieldTypeGUID     = "esriFieldTypeGUID"
)

GDB字段类型常量

View Source
const (
	GDBGeometryPoint      = "esriGeometryPoint"
	GDBGeometryMultipoint = "esriGeometryMultipoint"
	GDBGeometryPolyline   = "esriGeometryPolyline"
	GDBGeometryPolygon    = "esriGeometryPolygon"
)

GDB几何类型常量

View Source
const (
	GDBDatasetTypeFeatureClass = "esriDTFeatureClass"
	GDBDatasetTypeTable        = "esriDTTable"
)

GDB数据集类型常量

View Source
const (
	GDBFeatureTypeSimple     = "esriFTSimple"
	GDBFeatureTypeAnnotation = "esriFTAnnotation"
)

GDB要素类型常量

View Source
const (
	// DatasetInFolder - 数据集在文件夹中的关系
	GDBRelTypeDatasetInFolder = "{dc78f1ab-34e4-43ac-ba81-bc99dbe3e549}"
	// DatasetInFeatureDataset - 要素类在要素数据集中的关系
	GDBRelTypeDatasetInFeatureDataset = "{a1633a59-46ba-4448-8706-d8abe2b2b02e}"
	// ItemInFolder - 项目在文件夹中的关系
	GDBRelTypeItemInFolder = "{5dd0c1af-cb3d-4fea-8c51-cb3ba8d77cdb}"
)

GDB关系类型UUID常量

View Source
const (
	GDBItemTypeFeatureDataset = "{74737149-DCB5-4257-8904-B9724E32A530}"
	GDBItemTypeFeatureClass   = "{70737809-852C-4A03-9E22-2CECEA5B9BFA}"
	GDBItemTypeTable          = "{CD06BC3B-789D-4C51-AAFA-A467912B8965}"
	GDBItemTypeWorkspace      = "{C673FE0F-7280-404F-8532-20755DD8FC06}"
)

GDB_Items类型UUID常量

View Source
const (
	GDBCLSIDFeatureClass = "{52353152-891A-11D0-BEC6-00805F7C4268}"
)

GDB CLSID常量

Variables

View Source
var (
	// WGS84 地理坐标系
	SRS_WGS84 = &GDBSpatialReference{
		EPSG:        4326,
		Name:        "WGS 84",
		Type:        SRSTypeGeographic,
		Description: "WGS 84 地理坐标系"}
	// CGCS2000 地理坐标系
	SRS_CGCS2000 = &GDBSpatialReference{
		EPSG:        4490,
		Name:        "China Geodetic Coordinate System 2000",
		Type:        SRSTypeGeographic,
		Description: "中国2000国家大地坐标系(地理坐标系)",
	}
)

===================================================== 预定义坐标系常量 ===================================================== 地理坐标系

View Source
var (
	// 25带 中央经线75°
	SRS_CGCS2000_3_25 = &GDBSpatialReference{
		EPSG:        4513,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 25",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 25带 (中央经线75°)",
	}
	// 26带 中央经线78°
	SRS_CGCS2000_3_26 = &GDBSpatialReference{
		EPSG:        4514,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 26",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 26带 (中央经线78°)",
	}
	// 27带 中央经线81°
	SRS_CGCS2000_3_27 = &GDBSpatialReference{
		EPSG:        4515,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 27",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 27带 (中央经线81°)",
	}
	// 28带 中央经线84°
	SRS_CGCS2000_3_28 = &GDBSpatialReference{
		EPSG:        4516,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 28",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 28带 (中央经线84°)",
	}
	// 29带 中央经线87°
	SRS_CGCS2000_3_29 = &GDBSpatialReference{
		EPSG:        4517,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 29",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 29带 (中央经线87°)",
	}
	// 30带 中央经线90°
	SRS_CGCS2000_3_30 = &GDBSpatialReference{
		EPSG:        4518,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 30",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 30带 (中央经线90°)",
	}
	// 31带 中央经线93°
	SRS_CGCS2000_3_31 = &GDBSpatialReference{
		EPSG:        4519,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 31",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 31带 (中央经线93°)",
	}
	// 32带 中央经线96°
	SRS_CGCS2000_3_32 = &GDBSpatialReference{
		EPSG:        4520,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 32",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 32带 (中央经线96°)",
	}
	// 33带 中央经线99°
	SRS_CGCS2000_3_33 = &GDBSpatialReference{
		EPSG:        4521,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 33",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 33带 (中央经线99°)",
	}
	// 34带 中央经线102°
	SRS_CGCS2000_3_34 = &GDBSpatialReference{
		EPSG:        4522,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 34",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 34带 (中央经线102°)",
	}
	// 35带 中央经线105°
	SRS_CGCS2000_3_35 = &GDBSpatialReference{
		EPSG:        4523,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 35",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 35带 (中央经线105°)",
	}
	// 36带 中央经线108°
	SRS_CGCS2000_3_36 = &GDBSpatialReference{
		EPSG:        4524,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 36",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 36带 (中央经线108°)",
	}
	// 37带 中央经线111°
	SRS_CGCS2000_3_37 = &GDBSpatialReference{
		EPSG:        4525,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 37",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 37带 (中央经线111°)",
	}
	// 38带 中央经线114°
	SRS_CGCS2000_3_38 = &GDBSpatialReference{
		EPSG:        4526,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 38",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 38带 (中央经线114°)",
	}
	// 39带 中央经线117°
	SRS_CGCS2000_3_39 = &GDBSpatialReference{
		EPSG:        4527,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 39",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 39带 (中央经线117°)",
	}
	// 40带 中央经线120°
	SRS_CGCS2000_3_40 = &GDBSpatialReference{
		EPSG:        4528,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 40",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 40带 (中央经线120°)",
	}
	// 41带 中央经线123°
	SRS_CGCS2000_3_41 = &GDBSpatialReference{
		EPSG:        4529,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 41",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 41带 (中央经线123°)",
	}
	// 42带 中央经线126°
	SRS_CGCS2000_3_42 = &GDBSpatialReference{
		EPSG:        4530,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 42",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 42带 (中央经线126°)",
	}
	// 43带 中央经线129°
	SRS_CGCS2000_3_43 = &GDBSpatialReference{
		EPSG:        4531,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 43",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 43带 (中央经线129°)",
	}
	// 44带 中央经线132°
	SRS_CGCS2000_3_44 = &GDBSpatialReference{
		EPSG:        4532,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 44",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 44带 (中央经线132°)",
	}
	// 45带 中央经线135°
	SRS_CGCS2000_3_45 = &GDBSpatialReference{
		EPSG:        4533,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger zone 45",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 45带 (中央经线135°)",
	}
)

CGCS2000 3度带投影坐标系 (EPSG: 4513-4533) 中央经线从75°到135°,每3度一个带

View Source
var (
	// 25带 中央经线75° (带带号前缀)
	SRS_CGCS2000_3_CM_75E = &GDBSpatialReference{
		EPSG:        4534,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 75E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线75° (带带号前缀)",
	}
	// 26带 中央经线78° (带带号前缀)
	SRS_CGCS2000_3_CM_78E = &GDBSpatialReference{
		EPSG:        4535,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 78E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线78° (带带号前缀)",
	}
	// 27带 中央经线81° (带带号前缀)
	SRS_CGCS2000_3_CM_81E = &GDBSpatialReference{
		EPSG:        4536,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 81E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线81° (带带号前缀)",
	}
	// 28带 中央经线84° (带带号前缀)
	SRS_CGCS2000_3_CM_84E = &GDBSpatialReference{
		EPSG:        4537,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 84E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线84° (带带号前缀)",
	}
	// 29带 中央经线87° (带带号前缀)
	SRS_CGCS2000_3_CM_87E = &GDBSpatialReference{
		EPSG:        4538,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 87E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线87° (带带号前缀)",
	}
	// 30带 中央经线90° (带带号前缀)
	SRS_CGCS2000_3_CM_90E = &GDBSpatialReference{
		EPSG:        4539,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 90E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线90° (带带号前缀)",
	}
	// 31带 中央经线93° (带带号前缀)
	SRS_CGCS2000_3_CM_93E = &GDBSpatialReference{
		EPSG:        4540,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 93E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线93° (带带号前缀)",
	}
	// 32带 中央经线96° (带带号前缀)
	SRS_CGCS2000_3_CM_96E = &GDBSpatialReference{
		EPSG:        4541,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 96E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线96° (带带号前缀)",
	}
	// 33带 中央经线99° (带带号前缀)
	SRS_CGCS2000_3_CM_99E = &GDBSpatialReference{
		EPSG:        4542,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 99E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线99° (带带号前缀)",
	}
	// 34带 中央经线102° (带带号前缀)
	SRS_CGCS2000_3_CM_102E = &GDBSpatialReference{
		EPSG:        4543,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 102E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线102° (带带号前缀)",
	}
	// 35带 中央经线105° (带带号前缀)
	SRS_CGCS2000_3_CM_105E = &GDBSpatialReference{
		EPSG:        4544,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 105E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线105° (带带号前缀)",
	}
	// 36带 中央经线108° (带带号前缀)
	SRS_CGCS2000_3_CM_108E = &GDBSpatialReference{
		EPSG:        4545,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 108E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线108° (带带号前缀)",
	}
	// 37带 中央经线111° (带带号前缀)
	SRS_CGCS2000_3_CM_111E = &GDBSpatialReference{
		EPSG:        4546,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 111E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线111° (带带号前缀)",
	}
	// 38带 中央经线114° (带带号前缀)
	SRS_CGCS2000_3_CM_114E = &GDBSpatialReference{
		EPSG:        4547,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 114E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线114° (带带号前缀)",
	}
	// 39带 中央经线117° (带带号前缀)
	SRS_CGCS2000_3_CM_117E = &GDBSpatialReference{
		EPSG:        4548,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 117E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线117° (带带号前缀)",
	}
	// 40带 中央经线120° (带带号前缀)
	SRS_CGCS2000_3_CM_120E = &GDBSpatialReference{
		EPSG:        4549,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 120E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线120° (带带号前缀)",
	}
	// 41带 中央经线123° (带带号前缀)
	SRS_CGCS2000_3_CM_123E = &GDBSpatialReference{
		EPSG:        4550,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 123E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线123° (带带号前缀)",
	}
	// 42带 中央经线126° (带带号前缀)
	SRS_CGCS2000_3_CM_126E = &GDBSpatialReference{
		EPSG:        4551,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 126E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线126° (带带号前缀)",
	}
	// 43带 中央经线129° (带带号前缀)
	SRS_CGCS2000_3_CM_129E = &GDBSpatialReference{
		EPSG:        4552,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 129E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线129° (带带号前缀)",
	}
	// 44带 中央经线132° (带带号前缀)
	SRS_CGCS2000_3_CM_132E = &GDBSpatialReference{
		EPSG:        4553,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 132E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线132° (带带号前缀)",
	}
	// 45带 中央经线135° (带带号前缀)
	SRS_CGCS2000_3_CM_135E = &GDBSpatialReference{
		EPSG:        4554,
		Name:        "CGCS2000 / 3-degree Gauss-Kruger CM 135E",
		Type:        SRSTypeProjected,
		Description: "CGCS2000 3度带 中央经线135° (带带号前缀)",
	}
)

CGCS2000 3度带投影坐标系(带带号前缀)(EPSG: 4534-4554)

CGCS2000_3DegreeCMMap CGCS2000 3度带(带带号前缀)按中央经线映射表

===================================================== 坐标系辅助函数 ===================================================== CGCS2000_3DegreeZoneMap CGCS2000 3度带映射表

Functions

func AddField added in v1.3.9

func AddField(gdbPath string, layerName string, fieldDef FieldDefinition) error

AddField 向GDB图层添加字段 gdbPath: GDB文件路径 layerName: 图层名称 fieldDef: 字段定义

func AddGDBItemRelationship added in v1.4.3

func AddGDBItemRelationship(gdbPath string, originUUID string, destUUID string, relationType string) error

AddGDBItemRelationship 在GDB_ItemRelationships表中添加关系

func BatchConvertBinToGDB

func BatchConvertBinToGDB(rootFolderPath string, outputGDBPath string, includeSubfolders bool) error

BatchConvertBinToGDB 批量转换bin文件到GDB(支持子文件夹)

func BatchCreateFeatureDatasets added in v1.4.3

func BatchCreateFeatureDatasets(gdbPath string, datasetNames []string, srs *GDBSpatialReference) error

BatchCreateFeatureDatasets 批量创建要素数据集

func BatchDeserializeFromFiles

func BatchDeserializeFromFiles(filePaths []string) (map[string]*GDALLayer, []error)

BatchDeserializeFromFiles 批量从bin文件反序列化图层(修复版本)

func BatchProcessTilesOptimized

func BatchProcessTilesOptimized(layers []*GDALLayer, tiles []*TileInfo, baseOutputDir string, config *TileProcessingConfig) (map[int][]*TileClipResultM, error)

BatchProcessTilesOptimized 批量优化处理多个图层的瓦片

func BatchUpdateGDBMetadata added in v1.4.3

func BatchUpdateGDBMetadata(gdbPath string, metadataList map[string]*GDBLayerMetadataWrite) error

BatchUpdateGDBMetadata 批量更新多个图层的元数据 gdbPath: GDB文件路径 metadataList: 元数据列表 (图层名 -> 元数据)

func BatchUpdateGDBMetadataFromConfig added in v1.4.3

func BatchUpdateGDBMetadataFromConfig(gdbPath string, configs []GDBMetadataUpdateConfig) error

BatchUpdateGDBMetadataFromConfig 根据配置批量更新元数据

func BoundaryGeometry added in v1.3.2

func BoundaryGeometry(geometry C.OGRGeometryH) C.OGRGeometryH

BoundaryGeometry 计算几何体的边界

func BoundingBoxLayerGeometry added in v1.3.13

func BoundingBoxLayerGeometry(sourceLayer *GDALLayer) (orb.Geometry, error)

func BufferFeature added in v1.3.2

func BufferFeature(feature C.OGRFeatureH, distance float64, quadSegs int) C.OGRGeometryH

BufferFeature 对单个要素进行缓冲区分析 返回缓冲后的几何体

func BufferGeometry added in v1.3.2

func BufferGeometry(geometry C.OGRGeometryH, distance float64, quadSegs int) C.OGRGeometryH

BufferGeometry 对几何体进行缓冲区分析

func CentroidGeometry added in v1.3.2

func CentroidGeometry(geometry C.OGRGeometryH) C.OGRGeometryH

CentroidGeometry 计算几何体的质心

func CleanupGDAL

func CleanupGDAL()

CleanupGDAL 清理GDAL资源,程序退出前调用

func CleanupTileFiles added in v1.5.6

func CleanupTileFiles(taskid string) error

CleanupTileFiles 清理临时瓦片文件

func CloneGeometry added in v1.3.2

func CloneGeometry(geometry C.OGRGeometryH) C.OGRGeometryH

CloneGeometry 克隆几何体

func CloseRings added in v1.3.2

func CloseRings(geometry C.OGRGeometryH) C.OGRGeometryH

CloseRings 闭合环

func Contains added in v1.3.2

func Contains(geom1, geom2 C.OGRGeometryH) bool

Contains 判断geom1是否包含geom2

func ConvertFile

func ConvertFile(sourceFilePath string, targetFilePath string, sourceLayerName string, targetLayerName string, overwrite bool) error

ConvertFile 文件格式转换

func ConvertPostGISToShapefile

func ConvertPostGISToShapefile(data []map[string]interface{}, outputPath string) error

将PostGIS数据直接转换为Shapefile

func ConvertPostGISToShapefileWithStructure

func ConvertPostGISToShapefileWithStructure(DB *gorm.DB, data []map[string]interface{}, outputPath string, tableName string) error

func ConvexHullGeometry added in v1.3.2

func ConvexHullGeometry(geometry C.OGRGeometryH) C.OGRGeometryH

ConvexHullGeometry 对几何体计算凸包

func CopyAllFeatures added in v1.3.15

func CopyAllFeatures(srcLayer, dstLayer *GDALLayer) (int, error)

CopyAllFeatures 复制所有要素从源图层到目标图层

func CopyFieldDefinitions added in v1.3.15

func CopyFieldDefinitions(srcLayer, dstLayer *GDALLayer) error

CopyFieldDefinitions 复制字段定义

func CopyLayerToFile

func CopyLayerToFile(sourceLayer *GDALLayer, targetFilePath string, targetLayerName string, overwrite bool) error

CopyLayerToFile 复制图层到文件

func CountValidGeometries added in v1.3.2

func CountValidGeometries(layer *GDALLayer) (valid, invalid int)

CountValidGeometries 统计图层中有效几何体的数量

func CreateFeatureDataset added in v1.4.3

func CreateFeatureDataset(gdbPath string, metadata *GDBFeatureDatasetMetadata) error

CreateFeatureDataset 在GDB中创建要素数据集

func CreateFeatureDatasetWithSRS added in v1.4.3

func CreateFeatureDatasetWithSRS(gdbPath string, datasetName string, srs *GDBSpatialReference) error

CreateFeatureDatasetWithSRS 使用GDBSpatialReference创建要素数据集

func CreateFeatureDatasetWithSRSWrite added in v1.4.3

func CreateFeatureDatasetWithSRSWrite(gdbPath string, datasetName string, sr *GDBSpatialReferenceWrite) error

CreateFeatureDatasetWithSRSWrite 使用GDBSpatialReferenceWrite创建要素数据集

func CreateLineStringGeometry added in v1.3.2

func CreateLineStringGeometry(points [][2]float64) C.OGRGeometryH

CreateLineStringGeometry 创建线几何体

func CreatePoint3DGeometry added in v1.3.2

func CreatePoint3DGeometry(x, y, z float64) C.OGRGeometryH

CreatePoint3DGeometry 创建3D点几何体

func CreatePointGeometry added in v1.3.2

func CreatePointGeometry(x, y float64) C.OGRGeometryH

CreatePointGeometry 创建点几何体

func CreatePolygonGeometry added in v1.3.2

func CreatePolygonGeometry(rings [][][2]float64) C.OGRGeometryH

CreatePolygonGeometry 创建多边形几何体

func CreateSpatialReferenceFromEPSG added in v1.3.2

func CreateSpatialReferenceFromEPSG(epsgCode int) C.OGRSpatialReferenceH

CreateSpatialReferenceFromEPSG 从EPSG代码创建空间参考

func CreateSpatialReferenceFromProj4 added in v1.3.2

func CreateSpatialReferenceFromProj4(proj4 string) C.OGRSpatialReferenceH

CreateSpatialReferenceFromProj4 从Proj4字符串创建空间参考

func CreateSpatialReferenceFromWKT added in v1.3.2

func CreateSpatialReferenceFromWKT(wkt string) C.OGRSpatialReferenceH

CreateSpatialReferenceFromWKT 从WKT创建空间参考

func Crosses added in v1.3.2

func Crosses(geom1, geom2 C.OGRGeometryH) bool

Crosses 判断两个几何体是否交叉

func DecodeTerrainRGB added in v1.3.17

func DecodeTerrainRGB(r, g, b uint8, encoding string) float64

DecodeTerrainRGB 解码Terrain-RGB值为高程(辅助函数,用于验证)

func DeleteFeatureByObjectID added in v1.3.6

func DeleteFeatureByObjectID(gdbPath string, layerName string, objectID int64) error

DeleteFeatureByObjectID 删除GDB图层中指定ObjectID的要素 gdbPath: GDB文件路径 layerName: 图层名称 objectID: 要删除的ObjectID

func DeleteFeatureDataset added in v1.4.3

func DeleteFeatureDataset(gdbPath string, datasetName string) error

DeleteFeatureDataset 删除要素数据集 注意:这只会删除GDB_Items中的记录,不会删除数据集中的要素类

func DeleteFeaturesByFilter added in v1.3.6

func DeleteFeaturesByFilter(gdbPath string, layerName string, whereClause string) (int, error)

DeleteFeaturesByFilter 根据SQL过滤条件删除多个要素 gdbPath: GDB文件路径 layerName: 图层名称 whereClause: SQL WHERE条件,如 "OBJECTID = 0" 或 "OBJECTID IN (0, 1, 2)"

func DeleteField added in v1.3.9

func DeleteField(gdbPath string, layerName string, fieldName string) error

DeleteField 从GDB图层删除字段 gdbPath: GDB文件路径 layerName: 图层名称 fieldName: 要删除的字段名称

func DeleteFieldFromLayer added in v1.5.8

func DeleteFieldFromLayer(layer *GDALLayer, fieldName string) error

DeleteFieldFromLayer 从图层中删除指定字段

func DeleteFieldFromLayerFuzzy added in v1.5.6

func DeleteFieldFromLayerFuzzy(layer *GDALLayer, fieldName string) error

DeleteFieldFromLayerFuzzy 从图层中模糊匹配删除包含指定字段名的所有字段

func DeleteLayer added in v1.4.9

func DeleteLayer(gdbPath string, layerName string) error

DeleteLayer 删除GDB文件中的指定图层 gdbPath: GDB文件路径 layerName: 要删除的图层名称

func DeleteLayerByIndex added in v1.4.9

func DeleteLayerByIndex(gdbPath string, layerIndex int) error

DeleteLayerByIndex 通过索引删除GDB文件中的图层 gdbPath: GDB文件路径 layerIndex: 图层索引(从0开始)

func DeleteMultipleLayers added in v1.4.9

func DeleteMultipleLayers(gdbPath string, layerNames []string, continueOnError bool) (int, []error)

DeleteMultipleLayers 批量删除GDB文件中的多个图层 gdbPath: GDB文件路径 layerNames: 要删除的图层名称列表 continueOnError: 遇到错误是否继续删除其他图层

func DeleteShapeFeatureByFID added in v1.3.6

func DeleteShapeFeatureByFID(shpPath string, fid int64) error

DeleteShapeFeatureByFID 删除Shapefile图层中指定FID的要素 shpPath: Shapefile文件路径(.shp文件) fid: 要删除的要素ID

func DeleteShapeFeaturesByFilter added in v1.3.6

func DeleteShapeFeaturesByFilter(shpPath string, whereClause string) (int, error)

DeleteShapeFeaturesByFilter 根据SQL过滤条件删除Shapefile中的多个要素 shpPath: Shapefile文件路径 whereClause: SQL WHERE条件,如 "ID > 100" 或 "NAME = 'test'"

func DestroyGeometry added in v1.3.2

func DestroyGeometry(geometry C.OGRGeometryH)

DestroyGeometry 销毁几何体

func DestroySpatialReference added in v1.3.2

func DestroySpatialReference(srs C.OGRSpatialReferenceH)

DestroySpatialReference 销毁空间参考

func DifferenceGeometry added in v1.3.2

func DifferenceGeometry(geom1, geom2 C.OGRGeometryH) C.OGRGeometryH

DifferenceGeometry 计算两个几何体的差集

func Disjoint added in v1.3.2

func Disjoint(geom1, geom2 C.OGRGeometryH) bool

Disjoint 判断两个几何体是否不相交

func Distance added in v1.3.2

func Distance(geom1, geom2 C.OGRGeometryH) float64

Distance 计算两个几何体之间的距离

func EncodeTerrainRGB added in v1.3.17

func EncodeTerrainRGB(height float64, encoding string) (r, g, b uint8)

EncodeTerrainRGB 编码高程为Terrain-RGB值(辅助函数)

func EnsureFeatureDatasetExists added in v1.4.3

func EnsureFeatureDatasetExists(gdbPath string, datasetName string, srs *GDBSpatialReference) error

EnsureFeatureDatasetExists 确保要素数据集存在,如果不存在则创建

func EnsureObjectIDField added in v1.3.7

func EnsureObjectIDField(shpPath string) (bool, error)

EnsureObjectIDField 确保shp文件包含objectid字段(不区分大小写) 如果不存在,则创建该字段并填充唯一值 shpPath: Shapefile文件路径 返回: 是否创建了新字段, error

func Equals added in v1.3.2

func Equals(geom1, geom2 C.OGRGeometryH) bool

Equals 判断两个几何体是否相等

func EstimateMosaicSize added in v1.6.5

func EstimateMosaicSize(datasets []*RasterDataset, options *MosaicOptions) (int64, error)

EstimateMosaicSize 估算镶嵌结果大小(字节)

func ExecuteConcurrentClipAnalysisPG added in v1.5.8

func ExecuteConcurrentClipAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig) error

ExecuteConcurrentClipAnalysisPG PG优化版本的并发裁剪分析

func ExecuteConcurrentEraseAnalysisPG added in v1.5.8

func ExecuteConcurrentEraseAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig) error

ExecuteConcurrentEraseAnalysisPG PG优化版本的并发擦除分析

func ExecuteConcurrentIdentityAnalysisPG added in v1.5.8

func ExecuteConcurrentIdentityAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig, strategy FieldMergeStrategy) error

ExecuteConcurrentIdentityAnalysisPG PG优化版本的并发Identity分析

func ExecuteConcurrentIntersectionAnalysisPG added in v1.5.8

func ExecuteConcurrentIntersectionAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig, strategy FieldMergeStrategy) error

修改ExecuteConcurrentIntersectionAnalysis以支持优化版本

func ExecuteConcurrentSymDifferenceAnalysisPG added in v1.5.8

func ExecuteConcurrentSymDifferenceAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig) error

ExecuteConcurrentSymDifferenceAnalysisPG PG优化版本的并发对称差异分析

func ExecuteConcurrentUpdateAnalysisPG added in v1.5.8

func ExecuteConcurrentUpdateAnalysisPG(tileGroups []GroupTileFiles, resultLayer *GDALLayer, config *ParallelGeosConfig) error

ExecuteConcurrentUpdateAnalysisPG PG优化版本的并发更新分析

func FeatureDatasetExists added in v1.4.3

func FeatureDatasetExists(gdbPath string, datasetName string) (bool, error)

FeatureDatasetExists 检查要素数据集是否存在

func GenerateTiles

func GenerateTiles(inputLayer, methodLayer *GDALLayer, TileCount int, uuid string)

func GenerateTilesFromPG added in v1.5.6

func GenerateTilesFromPG(db *gorm.DB, table1, table2 string, tileCount int, uuid string) error

PG

func GeometryFromWKT added in v1.3.2

func GeometryFromWKT(wkt string) C.OGRGeometryH

GeometryFromWKT 从WKT格式创建几何体

func GeometryToGeoJSON added in v1.3.2

func GeometryToGeoJSON(geometry C.OGRGeometryH) string

GeometryToGeoJSON 将几何体转换为GeoJSON格式

func GeometryToWKT added in v1.3.2

func GeometryToWKT(geometry C.OGRGeometryH) string

GeometryToWKT 将几何体转换为WKT格式

func GetAllSupportedTypeMappings added in v1.4.14

func GetAllSupportedTypeMappings() []map[string]interface{}

GetAllSupportedTypeMappings 获取所有支持的类型映射

func GetArea added in v1.3.2

func GetArea(geometry C.OGRGeometryH) float64

GetArea 计算几何体面积

func GetCoordinateDimension added in v1.3.2

func GetCoordinateDimension(geometry C.OGRGeometryH) int

GetCoordinateDimension 获取坐标维度

func GetDimension added in v1.3.2

func GetDimension(geometry C.OGRGeometryH) int

GetDimension 获取几何体维度

func GetEnvelope added in v1.3.2

func GetEnvelope(geometry C.OGRGeometryH) (minX, minY, maxX, maxY float64, err error)

GetEnvelope 获取几何体的外接矩形

func GetGDALLayerInfo

func GetGDALLayerInfo(gdalLayer *GDALLayer) (map[string]interface{}, error)

GetGDALLayerInfo 获取GDALLayer的基本信息

func GetGDBItemUUID added in v1.4.3

func GetGDBItemUUID(gdbPath string, itemName string) (string, error)

GetGDBItemUUID 获取GDB_Items表中指定项目的UUID

func GetGDBRootUUID added in v1.4.3

func GetGDBRootUUID(gdbPath string) (string, error)

GetGDBRootUUID 获取GDB根目录的UUID

func GetGeometryName added in v1.3.2

func GetGeometryName(geometry C.OGRGeometryH) string

GetGeometryName 获取几何体名称

func GetGeometryType added in v1.3.2

func GetGeometryType(geometry C.OGRGeometryH) string

GetGeometryType 获取几何体类型名称

func GetGeometryTypeFromWKBData

func GetGeometryTypeFromWKBData(wkbData []byte) uint32

GetGeometryTypeFromWKBData 从WKB数据中提取几何类型 wkbData: WKB二进制数据 返回几何类型代码

func GetLayerExtent added in v1.3.2

func GetLayerExtent(layer *GDALLayer) (minX, minY, maxX, maxY float64, err error)

GetLayerExtent 获取图层范围

func GetLayerNames added in v1.4.9

func GetLayerNames(gdbPath string) ([]string, error)

GetLayerNames 获取GDB文件中所有图层的名称 gdbPath: GDB文件路径

func GetLayersInFeatureDataset added in v1.4.3

func GetLayersInFeatureDataset(gdbPath string, datasetName string) ([]string, error)

GetLayersInFeatureDataset 获取要素数据集中的所有图层

func GetLength added in v1.3.2

func GetLength(geometry C.OGRGeometryH) float64

GetLength 计算几何体长度

func GetNextDSID added in v1.4.3

func GetNextDSID(gdbPath string) (int, error)

GetNextDSID 获取下一个可用的DSID

func GetPointCount added in v1.3.2

func GetPointCount(geometry C.OGRGeometryH) int

GetPointCount 获取几何体点数

func GetProjectionWKT added in v1.6.5

func GetProjectionWKT(epsgCode int) (string, error)

GetProjectionWKT 获取EPSG代码对应的WKT投影定义

func GetSHPEPSGCode added in v1.4.8

func GetSHPEPSGCode(shpPath string) (int, error)

GetSHPEPSGCode 读取SHP文件的投影信息并返回EPSG代码 shpPath: SHP文件路径 返回: EPSG代码(如果无法识别则返回0), 错误信息

func GetWKTFromEPSG added in v1.4.3

func GetWKTFromEPSG(epsg int) (string, error)

GetWKTFromEPSG 从EPSG代码获取WKT字符串

func HSLToRGB added in v1.6.5

func HSLToRGB(h, s, l float64) (r, g, b float64)

HSLToRGB HSL转RGB

func HSVToRGB added in v1.6.5

func HSVToRGB(h, s, v float64) (r, g, b float64)

HSVToRGB HSV转RGB

func InitializeGDAL

func InitializeGDAL() error

shapeEncoding: Shapefile编码,为空时使用默认编码

func InitializeGDALSHPCoding added in v1.5.8

func InitializeGDALSHPCoding(shapeEncoding string) error

func InsertLayerToGDB added in v1.3.6

func InsertLayerToGDB(sourceLayer *GDALLayer, gdbPath string, targetLayerName string, options *InsertOptions) error

InsertLayerToGDB 将GDALLayer插入到GDB文件的对应图层中,并进行坐标转换 sourceLayer: 源图层(4326坐标系) gdbPath: 目标GDB文件路径 targetLayerName: 目标图层名称 options: 插入选项(可选)

func InsertLayerToShapefile added in v1.3.6

func InsertLayerToShapefile(sourceLayer *GDALLayer, shpPath string, options *InsertOptions) error

InsertLayerToShapefile 将GDALLayer插入到Shapefile中,并进行坐标转换 sourceLayer: 源图层(4326坐标系) shpPath: 目标Shapefile文件路径 options: 插入选项(可选)

func IntersectionGeometry added in v1.3.2

func IntersectionGeometry(geom1, geom2 C.OGRGeometryH) C.OGRGeometryH

IntersectionGeometry 计算两个几何体的交集

func Intersects added in v1.3.2

func Intersects(geom1, geom2 C.OGRGeometryH) bool

Intersects 判断两个几何体是否相交

func IsEmpty added in v1.3.2

func IsEmpty(geometry C.OGRGeometryH) bool

IsEmpty 检查几何体是否为空

func IsRing added in v1.3.2

func IsRing(geometry C.OGRGeometryH) bool

IsRing 检查几何体是否为环

func IsSimple added in v1.3.2

func IsSimple(geometry C.OGRGeometryH) bool

IsSimple 检查几何体是否简单

func IsValid added in v1.3.2

func IsValid(geometry C.OGRGeometryH) bool

IsValid 检查几何体是否有效

func IsValidBinFile added in v1.5.6

func IsValidBinFile(filePath string) bool

IsValidBinFile 检查bin文件是否有效(存在且非空)

func LatLonToWebMercator added in v1.2.11

func LatLonToWebMercator(lon, lat float64) (x, y float64)

LatLonToWebMercator 经纬度转Web墨卡托(符合Mapbox规范)

func LayerExists added in v1.4.9

func LayerExists(gdbPath string, layerName string) (bool, error)

LayerExists 检查GDB文件中是否存在指定图层 gdbPath: GDB文件路径 layerName: 图层名称

func LayerToGeoJSON added in v1.3.11

func LayerToGeoJSON(gdal *GDALLayer) (*geojson.FeatureCollection, error)

func LayerToGeoJSONWithTransform added in v1.3.4

func LayerToGeoJSONWithTransform(hLayer C.OGRLayerH, hTargetSRS C.OGRSpatialReferenceH) (*geojson.FeatureCollection, error)

func ListFeatureDatasets added in v1.4.3

func ListFeatureDatasets(gdbPath string) ([]string, error)

ListFeatureDatasets 列出GDB中的所有要素数据集

func LonLatToTile added in v1.2.13

func LonLatToTile(lon, lat float64, zoom int) (x, y int)

LonLatToTile 经纬度转瓦片坐标(符合Mapbox规范)

func MakeValidFeature added in v1.3.2

func MakeValidFeature(feature C.OGRFeatureH) C.OGRGeometryH

MakeValidFeature 对单个要素进行几何修复

func MakeValidGeometry added in v1.3.2

func MakeValidGeometry(geometry C.OGRGeometryH) C.OGRGeometryH

MakeValidGeometry 对几何体进行修复

func MosaicFilesToFile added in v1.6.5

func MosaicFilesToFile(inputPaths []string, outputPath string, format string, options *MosaicOptions) error

MosaicFilesToFile 从文件镶嵌并保存

func MosaicToFile added in v1.6.5

func MosaicToFile(datasets []*RasterDataset, outputPath string, format string, options *MosaicOptions) error

MosaicToFile 镶嵌并直接保存到文件

func MoveLayerToFeatureDataset added in v1.4.3

func MoveLayerToFeatureDataset(gdbPath string, layerName string, datasetName string, srs *GDBSpatialReference) error

MoveLayerToFeatureDataset 将图层移动到指定的要素数据集

func Overlaps added in v1.3.2

func Overlaps(geom1, geom2 C.OGRGeometryH) bool

Overlaps 判断两个几何体是否重叠

func PackShapefile added in v1.3.6

func PackShapefile(shpPath string) error

PackShapefile 压缩Shapefile以回收删除要素后的空间 shpPath: Shapefile文件路径 注意:此操作会重建Shapefile,FID可能会改变

func PerformSpatialIntersectionTest

func PerformSpatialIntersectionTest(shpFile1, shpFile2, outputFile string) error

func PrintAllFeatureDatasets added in v1.4.3

func PrintAllFeatureDatasets(gdbPath string) error

PrintAllFeatureDatasets 打印GDB中所有要素数据集

func PrintFeatureDatasetInfo added in v1.4.3

func PrintFeatureDatasetInfo(gdbPath string, datasetName string) error

PrintFeatureDatasetInfo 打印要素数据集信息

func ProcessBinFolderToGDB

func ProcessBinFolderToGDB(binFolderPath string, outputGDBPath string) error

ProcessBinFolderToGDB 处理bin文件夹并转换为GDB的便捷函数

func QuickCreateFeatureDataset added in v1.4.3

func QuickCreateFeatureDataset(gdbPath string, datasetName string) error

QuickCreateFeatureDataset 快速创建要素数据集(使用CGCS2000坐标系)

func QuickCreateFeatureDatasetWithEPSG added in v1.4.3

func QuickCreateFeatureDatasetWithEPSG(gdbPath string, datasetName string, epsg int) error

QuickCreateFeatureDatasetWithEPSG 使用EPSG代码快速创建要素数据集

func RGBToHSL added in v1.6.5

func RGBToHSL(r, g, b float64) (h, s, l float64)

RGBToHSL RGB转HSL

func RGBToHSV added in v1.6.5

func RGBToHSV(r, g, b float64) (h, s, v float64)

RGBToHSV RGB转HSV

func ReadBinFilesAndConvertToGDB

func ReadBinFilesAndConvertToGDB(folderPath string, outputGDBPath string) error

ReadBinFilesAndConvertToGDB 读取文件夹内所有bin文件并转换为GDB

func ReadTerrainTileDirect added in v1.4.16

func ReadTerrainTileDirect(imagePath string, z, x, y, tileSize int, encoding string) ([]byte, error)

ReadTerrainTileDirect 直接读取地形瓦片

func ReadTileDirect added in v1.4.16

func ReadTileDirect(imagePath string, z, x, y, tileSize int) ([]byte, error)

ReadTileDirect 直接读取瓦片(一次性使用,每次打开关闭数据集) 适用于低频请求场景

func RemoveDuplicatePoints added in v1.3.2

func RemoveDuplicatePoints(geometry C.OGRGeometryH, tolerance float64) C.OGRGeometryH

RemoveDuplicatePoints 移除重复点

func RemoveGDBItemRelationship added in v1.4.3

func RemoveGDBItemRelationship(gdbPath string, destUUID string) error

RemoveGDBItemRelationship 删除指定目标项的所有父级关系

func RemoveLinePolygonBoundaryOverlapAndReturnLongest added in v1.3.10

func RemoveLinePolygonBoundaryOverlapAndReturnLongest(lineFeature C.OGRFeatureH, polygonFeature C.OGRFeatureH, tolerance float64) C.OGRGeometryH

RemoveLinePolygonBoundaryOverlapAndReturnLongest 移除线要素与面要素边界的重叠部分,返回最长的线段 lineFeature: 输入的线要素 polygonFeature: 输入的面要素 返回:处理后最长的线几何体

func RemoveLinePolygonBoundaryOverlapFromGeoJSON added in v1.3.10

func RemoveLinePolygonBoundaryOverlapFromGeoJSON(lineFeature, polygonFeature *geojson.Feature, tolerance float64) (*geojson.Feature, error)

RemoveLinePolygonBoundaryOverlapFromGeoJSON 使用geojson feature处理线与面的边界重叠 lineFeature: 输入的线geojson要素 polygonFeature: 输入的面geojson要素 返回:处理后最长线段的geojson要素

func RemoveLinePolygonBoundaryOverlapGeometryAndReturnLongest added in v1.3.10

func RemoveLinePolygonBoundaryOverlapGeometryAndReturnLongest(lineGeom C.OGRGeometryH, polygonGeom C.OGRGeometryH, tolerance float64) C.OGRGeometryH

RemoveLinePolygonBoundaryOverlapGeometryAndReturnLongest 移除线几何体与面几何体边界的重叠部分,返回最长的线段 lineGeom: 输入的线几何体 polygonGeom: 输入的面几何体 返回:处理后最长的线几何体

func ResampleFile added in v1.6.6

func ResampleFile(inputPath, outputPath, format string, options *ResampleOptions) error

ResampleFile 从文件重采样并保存

func SaveGDALLayerToPG

func SaveGDALLayerToPG(DB *gorm.DB, gdalLayer *GDALLayer, tableName string, schema string, srid int) error

SaveGDALLayerToPG 将GDALLayer保存到PostgreSQL数据库

func SaveGDALLayerToPGBatch

func SaveGDALLayerToPGBatch(DB *gorm.DB, gdalLayer *GDALLayer, tableName string, schema string, srid int, batchSize int) error

SaveGDALLayerToPGBatch 批量保存GDALLayer到PostgreSQL(优化版本)

func SaveGDBDefinitionsToFile added in v1.4.3

func SaveGDBDefinitionsToFile(gdbPath string, outputPath string) (string, error)

SaveGDBDefinitionsToFile 读取GDB_Items表中的Definition字段并保存到本地txt文件 gdbPath: GDB文件路径 outputPath: 输出文件路径(如果为空,则在GDB同级目录生成) 返回: 保存的文件路径和错误信息

func SegmentizeGeometry added in v1.3.2

func SegmentizeGeometry(geometry C.OGRGeometryH, maxLength float64) C.OGRGeometryH

SegmentizeGeometry 将几何体分段

func SimplifyFeature added in v1.3.2

func SimplifyFeature(feature C.OGRFeatureH, tolerance float64, preserveTopology bool) C.OGRGeometryH

SimplifyFeature 对单个要素进行简化

func SimplifyGeometry added in v1.3.2

func SimplifyGeometry(geometry C.OGRGeometryH, tolerance float64, preserveTopology bool) C.OGRGeometryH

SimplifyGeometry 对几何体进行简化

func SymDifferenceGeometry added in v1.3.2

func SymDifferenceGeometry(geom1, geom2 C.OGRGeometryH) C.OGRGeometryH

SymDifferenceGeometry 计算两个几何体的对称差集

func TileToWebMercatorBounds added in v1.2.13

func TileToWebMercatorBounds(x, y, zoom int) (minX, minY, maxX, maxY float64)

TileToWebMercatorBounds 瓦片坐标转Web墨卡托边界

func Touches added in v1.3.2

func Touches(geom1, geom2 C.OGRGeometryH) bool

Touches 判断两个几何体是否接触

func TransformGeometry added in v1.3.2

func TransformGeometry(geometry C.OGRGeometryH, sourceSRS, targetSRS C.OGRSpatialReferenceH) C.OGRGeometryH

TransformGeometry 对几何体进行坐标转换

func UnionGeometry added in v1.3.2

func UnionGeometry(geom1, geom2 C.OGRGeometryH) C.OGRGeometryH

UnionGeometry 合并两个几何体

func UpdateGDBFieldAliases added in v1.4.3

func UpdateGDBFieldAliases(gdbPath string, layerName string, fieldAliases map[string]string) error

UpdateGDBFieldAliases 批量更新字段别名 gdbPath: GDB文件路径 layerName: 图层名称 fieldAliases: 字段别名映射 (字段名 -> 别名)

func UpdateGDBItemRelationship added in v1.4.3

func UpdateGDBItemRelationship(gdbPath string, featureClassName string, datasetName string) error

UpdateGDBItemRelationship 更新要素类的父级关系 将要素类从当前位置移动到指定的数据集中

func UpdateGDBLayerAlias added in v1.4.3

func UpdateGDBLayerAlias(gdbPath string, layerName string, aliasName string) error

UpdateGDBLayerAlias 更新图层别名 gdbPath: GDB文件路径 layerName: 图层名称 aliasName: 新的别名

func UpdateGDBLayerAndFieldAliases added in v1.4.3

func UpdateGDBLayerAndFieldAliases(gdbPath string, layerName string, layerAlias string, fieldAliases map[string]string) error

UpdateGDBLayerAndFieldAliases 同时更新图层别名和字段别名 gdbPath: GDB文件路径 layerName: 图层名称 layerAlias: 图层别名 fieldAliases: 字段别名映射 (字段名 -> 别名)

func ValidateBinaryFormat

func ValidateBinaryFormat(data []byte) error

ValidateBinaryFormat 验证二进制文件格式是否正确(修复版本)

func ValidateMosaicInputs added in v1.6.5

func ValidateMosaicInputs(datasets []*RasterDataset, options *MosaicOptions) error

ValidateMosaicInputs 验证镶嵌输入

func ValidateProjectionWKT added in v1.6.5

func ValidateProjectionWKT(wkt string) bool

ValidateProjectionWKT 验证WKT投影定义是否有效

func WebMercatorToLatLon added in v1.2.11

func WebMercatorToLatLon(x, y float64) (lon, lat float64)

WebMercatorToLatLon Web墨卡托转经纬度(符合Mapbox规范)

func Within added in v1.3.2

func Within(geom1, geom2 C.OGRGeometryH) bool

Within 判断geom1是否在geom2内

func WriteDXFLayer added in v1.3.0

func WriteDXFLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteDXFLayer 直接写入DXF图层

func WriteGDBLayer

func WriteGDBLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteGDBLayer 直接写入GDB图层

func WriteGDBLayerMetadata added in v1.4.3

func WriteGDBLayerMetadata(gdbPath string, layerName string, metadata *GDBLayerMetadataWrite) error

func WriteGeoJSONLayer added in v1.3.0

func WriteGeoJSONLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteGeoJSONLayer 直接写入GeoJSON图层

func WriteGeospatialFile

func WriteGeospatialFile(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteGeospatialFile 通用写入地理空间文件

func WriteKMLLayer added in v1.3.0

func WriteKMLLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteKMLLayer 直接写入KML图层

func WriteKMZLayer added in v1.3.0

func WriteKMZLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteKMZLayer 直接写入KMZ图层

func WriteShapeFileLayer

func WriteShapeFileLayer(sourceLayer *GDALLayer, filePath string, layerName string, overwrite bool) error

WriteShapeFileLayer 直接写入Shapefile图层

Types

type AffineParams added in v1.6.5

type AffineParams struct {
	// 七参数
	Tx    float64 // X平移(米)
	Ty    float64 // Y平移(米)
	Tz    float64 // Z平移(米)
	Rx    float64 // X旋转(度)
	Ry    float64 // Y旋转(度)
	Rz    float64 // Z旋转(度)
	Scale float64 // 缩放因子

	// 四参数
	Dx     float64 // X平移(米)
	Dy     float64 // Y平移(米)
	DScale float64 // 缩放因子
	Angle  float64 // 旋转角度(度)
}

AffineParams 仿射变换参数

type AreaOfInterest added in v1.4.3

type AreaOfInterest struct {
	WestLongitude float64
	SouthLatitude float64
	EastLongitude float64
	NorthLatitude float64
}

AreaOfInterest 感兴趣区域

type BandCalculator added in v1.6.5

type BandCalculator struct {
	// contains filtered or unexported fields
}

BandCalculator 高性能波段计算器

func (*BandCalculator) Calculate added in v1.6.5

func (bc *BandCalculator) Calculate(expression string) ([]float64, error)

Calculate 执行表达式计算 支持格式: "b1", "b2", "B1", "band1" 表示波段引用 支持运算符: +, -, *, /, ^ (幂运算) 支持函数: sqrt, abs, sin, cos, tan, log, log10, exp, floor, ceil, round, min, max, pow 支持比较: >, >=, <, <=, ==, != 支持逻辑: &&, || 示例: "(b1 - b2) / (b1 + b2)", "sqrt(b1^2 + b2^2)", "max(b1, b2) * 0.5"

func (*BandCalculator) CalculateAndSave added in v1.6.10

func (bc *BandCalculator) CalculateAndSave(expression string, filePath string, compress string) error

CalculateAndSave 计算表达式并直接保存为文件(一步到位)

func (*BandCalculator) CalculateAndWrite added in v1.6.5

func (bc *BandCalculator) CalculateAndWrite(expression string, targetBand int) error

CalculateAndWrite 计算并写入到指定波段

func (*BandCalculator) CalculateBatch added in v1.6.5

func (bc *BandCalculator) CalculateBatch(expressions []string) []BatchExpressionResult

CalculateBatch 批量计算多个表达式

func (*BandCalculator) CalculateEVI added in v1.6.5

func (bc *BandCalculator) CalculateEVI(nirBand, redBand, blueBand int) ([]float64, error)

CalculateEVI 计算增强植被指数 EVI = 2.5 * (NIR - Red) / (NIR + 6*Red - 7.5*Blue + 1)

func (*BandCalculator) CalculateLAI added in v1.6.5

func (bc *BandCalculator) CalculateLAI(nirBand, redBand int) ([]float64, error)

CalculateLAI 计算叶面积指数(基于NDVI的经验公式) LAI = -ln((0.69 - NDVI) / 0.59) / 0.91

func (*BandCalculator) CalculateMNDWI added in v1.6.5

func (bc *BandCalculator) CalculateMNDWI(greenBand, swirBand int) ([]float64, error)

CalculateMNDWI 计算改进的归一化水体指数 MNDWI = (Green - SWIR) / (Green + SWIR)

func (*BandCalculator) CalculateNDBI added in v1.6.5

func (bc *BandCalculator) CalculateNDBI(swirBand, nirBand int) ([]float64, error)

CalculateNDBI 计算归一化建筑指数 NDBI = (SWIR - NIR) / (SWIR + NIR)

func (*BandCalculator) CalculateNDSI added in v1.6.5

func (bc *BandCalculator) CalculateNDSI(greenBand, swirBand int) ([]float64, error)

CalculateNDSI 计算归一化雪指数 NDSI = (Green - SWIR) / (Green + SWIR)

func (*BandCalculator) CalculateNDVI added in v1.6.5

func (bc *BandCalculator) CalculateNDVI(nirBand, redBand int) ([]float64, error)

CalculateNDVI 计算归一化植被指数 (NIR - Red) / (NIR + Red)

func (*BandCalculator) CalculateNDVIAndSave added in v1.6.10

func (bc *BandCalculator) CalculateNDVIAndSave(nirBand, redBand int, filePath string, compress string) error

CalculateNDVIAndSave NDVI计算并直接保存

func (*BandCalculator) CalculateNDWI added in v1.6.5

func (bc *BandCalculator) CalculateNDWI(greenBand, nirBand int) ([]float64, error)

CalculateNDWI 计算归一化水体指数 (Green - NIR) / (Green + NIR)

func (*BandCalculator) CalculateSAVI added in v1.6.5

func (bc *BandCalculator) CalculateSAVI(nirBand, redBand int, L float64) ([]float64, error)

CalculateSAVI 计算土壤调节植被指数 SAVI = ((NIR - Red) / (NIR + Red + L)) * (1 + L), L通常取0.5

func (*BandCalculator) CalculateWithCondition added in v1.6.5

func (bc *BandCalculator) CalculateWithCondition(expression, condition string, noDataValue float64) ([]float64, error)

CalculateWithCondition 带条件的计算 expression: 计算表达式 condition: 条件表达式(满足条件才计算,否则返回noDataValue) 示例: expression="(b1-b2)/(b1+b2)", condition="b1 > 0 && b2 > 0"

func (*BandCalculator) CalculateWithConditionAndSave added in v1.6.10

func (bc *BandCalculator) CalculateWithConditionAndSave(
	expression, condition string,
	noDataValue float64,
	filePath string,
	compress string,
) error

CalculateWithConditionAndSave 带条件计算并直接保存

func (*BandCalculator) CalculateWithConditionAndWrite added in v1.6.9

func (bc *BandCalculator) CalculateWithConditionAndWrite(
	expression, condition string,
	noDataValue float64,
	targetBand int,
	setNoData bool,
) error

CalculateWithConditionAndWrite 带条件计算并直接写入目标波段(零拷贝,C层直接完成) expression: 计算表达式,如 "(b1-b2)/(b1+b2)" condition: 条件表达式,如 "b1+b2 > 0"(空字符串表示无条件) noDataValue: 不满足条件时的填充值 targetBand: 写入的目标波段(1-based) setNoData: 是否将noDataValue设置为该波段的NoData元数据

func (*BandCalculator) ConditionalReplace added in v1.6.5

func (bc *BandCalculator) ConditionalReplace(bandIndex int, minVal, maxVal, newValue float64) ([]float64, error)

ConditionalReplace 简单条件替换

func (*BandCalculator) ConditionalReplaceMulti added in v1.6.5

func (bc *BandCalculator) ConditionalReplaceMulti(bandIndex int, conditions []ReplaceCondition) ([]float64, error)

ConditionalReplaceMulti 多条件替换

func (*BandCalculator) ValidateExpression added in v1.6.5

func (bc *BandCalculator) ValidateExpression(expression string) error

ValidateExpression 验证表达式是否合法

type BandDataType added in v1.6.5

type BandDataType int

BandDataType 波段数据类型

const (
	BandGray8   BandDataType = C.BAND_Gray8
	BandGray16  BandDataType = C.BAND_Gray16
	BandRed8    BandDataType = C.BAND_Red8
	BandRed16   BandDataType = C.BAND_Red16
	BandGreen8  BandDataType = C.BAND_Green8
	BandGreen16 BandDataType = C.BAND_Green16
	BandBlue8   BandDataType = C.BAND_Blue8
	BandBlue16  BandDataType = C.BAND_Blue16
	BandAlpha8  BandDataType = C.BAND_Alpha8
	BandAlpha16 BandDataType = C.BAND_Alpha16
	BandInt8    BandDataType = C.BAND_Int8
	BandInt16   BandDataType = C.BAND_Int16
	BandInt32   BandDataType = C.BAND_Int32
	BandInt64   BandDataType = C.BAND_Int64
	BandUInt8   BandDataType = C.BAND_UInt8
	BandUInt16  BandDataType = C.BAND_UInt16
	BandUInt32  BandDataType = C.BAND_UInt32
	BandUInt64  BandDataType = C.BAND_UInt64
	BandReal32  BandDataType = C.BAND_Real32
	BandReal64  BandDataType = C.BAND_Real64
)

func (BandDataType) GetBytesPerPixel added in v1.6.5

func (dt BandDataType) GetBytesPerPixel() int

GetBytesPerPixel 获取每像素字节数

func (BandDataType) String added in v1.6.5

func (dt BandDataType) String() string

GetDataTypeName 获取数据类型名称

type BandInfo added in v1.6.5

type BandInfo struct {
	BandIndex   int
	DataType    BandDataType
	ColorInterp ColorInterpretation
	NoDataValue float64
	HasNoData   bool
	MinValue    float64
	MaxValue    float64
	HasStats    bool
}

BandInfo 波段信息

type BandMathOp added in v1.6.5

type BandMathOp int

BandMath 波段数学运算

const (
	BandMathAdd BandMathOp = iota
	BandMathSubtract
	BandMathMultiply
	BandMathDivide
	BandMathMin
	BandMathMax
	BandMathPow
)

type BandMetaStatistics added in v1.6.5

type BandMetaStatistics struct {
	Min       float64
	Max       float64
	Mean      float64
	Stddev    float64
	Histogram []int
}

BandMetaStatistics 波段统计信息

type BandOperation added in v1.6.5

type BandOperation struct {
	Type        string              // "add", "remove", "modify"
	BandIndex   int                 // 目标波段索引
	DataType    BandDataType        // 新波段数据类型
	ColorInterp ColorInterpretation // 颜色解释
	NoDataValue float64             // NoData值
}

BandOperation 波段操作配置

type BandStatistics added in v1.6.5

type BandStatistics struct {
	Min    float64
	Max    float64
	Mean   float64
	StdDev float64
}

BandStatistics 波段统计信息

type BatchExpressionResult added in v1.6.5

type BatchExpressionResult struct {
	Expression string
	Data       []float64
	Error      error
}

BatchExpressionResult 批量表达式计算结果

type BlendingOptions added in v1.6.5

type BlendingOptions struct {
	MosaicOptions
	BlendDistance int  // 融合距离(像素)
	BlendMode     int  // 融合模式: 0=线性, 1=余弦
	UseFeathering bool // 是否使用羽化
}

MosaicWithBlending 带融合的镶嵌(重叠区域渐变过渡)

func DefaultBlendingOptions added in v1.6.5

func DefaultBlendingOptions() *BlendingOptions

DefaultBlendingOptions 默认融合选项

type BlockCalculator added in v1.6.5

type BlockCalculator struct {
	// contains filtered or unexported fields
}

BlockCalculator 分块计算器

func (*BlockCalculator) CalculateAllBlocks added in v1.6.5

func (bc *BlockCalculator) CalculateAllBlocks() ([]float64, error)

CalculateAllBlocks 计算所有块并合并结果

func (*BlockCalculator) CalculateBlock added in v1.6.5

func (bc *BlockCalculator) CalculateBlock(blockX, blockY int) ([]float64, int, int, error)

CalculateBlock 计算指定块

func (*BlockCalculator) Close added in v1.6.5

func (bc *BlockCalculator) Close()

func (*BlockCalculator) GetBlockCount added in v1.6.5

func (bc *BlockCalculator) GetBlockCount() (x, y int)

GetBlockCount 获取块数量

type BorderFeatureInfo

type BorderFeatureInfo struct {
	Feature     C.OGRFeatureH
	TileIndices []int  // 该要素出现在哪些分块中
	GeometryWKT string // 几何体的WKT表示,用于去重比较
}

BorderFeatureInfo 边界要素信息

type ClipOptions added in v1.3.0

type ClipOptions struct {
	OutputDir         string  // 输出目录
	NameField         string  // 名称字段(默认 "NAME")
	JPEGQuality       int     // JPEG质量 (1-100,默认85)
	TileSize          int     // 输出瓦片大小(像素,0表示原始分辨率)
	BufferDist        float64 // 缓冲距离(单位:米,0表示不缓冲)
	OverwriteExisting bool    // 是否覆盖已存在的文件
	ImageFormat       string
}

ClipOptions 裁剪选项

type ClipResult added in v1.3.0

type ClipResult struct {
	Name       string
	OutputPath string
	Bounds     [4]float64 // minX, minY, maxX, maxY
	Width      int
	Height     int
	Error      error
}

ClipResult 裁剪结果

type ClipResultByte added in v1.3.0

type ClipResultByte struct {
	Name      string
	ImageData []byte     // 图片二进制数据
	Bounds    [4]float64 // minX, minY, maxX, maxY
	Width     int
	Height    int
	Error     error
}

ClipResultByte 裁剪结果(二进制数据版本)

type ColorAdjustParams added in v1.6.5

type ColorAdjustParams struct {
	Brightness float64 // 亮度调整 [-1.0, 1.0]
	Contrast   float64 // 对比度调整 [-1.0, 1.0]
	Saturation float64 // 饱和度调整 [-1.0, 1.0]
	Gamma      float64 // Gamma校正 [0.1, 10.0]
	Hue        float64 // 色相调整 [-180, 180]
}

ColorAdjustParams 调色参数

type ColorBalanceMethod added in v1.6.5

type ColorBalanceMethod int

ColorBalanceMethod 匀色方法

type ColorBalanceParams added in v1.6.5

type ColorBalanceParams struct {
	Method        ColorBalanceMethod
	Strength      float64          // 匀色强度 [0, 1]
	OverlapRegion *ReferenceRegion // 重叠区域
	WallisC       float64          // Wallis对比度参数 [0, 1]
	WallisB       float64          // Wallis亮度参数 [0, 1]
	TargetMean    float64          // 目标均值
	TargetStd     float64          // 目标标准差
}

ColorBalanceParams 匀色参数

type ColorInterpretation added in v1.6.5

type ColorInterpretation int

ColorInterpretation 颜色解释

func (ColorInterpretation) String added in v1.6.5

func (ci ColorInterpretation) String() string

GetColorInterpName 获取颜色解释名称

type ColorPipeline added in v1.6.5

type ColorPipeline struct {
	// contains filtered or unexported fields
}

ColorPipeline 调色管道

func (*ColorPipeline) AutoLevels added in v1.6.5

func (cp *ColorPipeline) AutoLevels(clipPercent float64) *ColorPipeline

AutoLevels 自动色阶

func (*ColorPipeline) AutoWhiteBalance added in v1.6.5

func (cp *ColorPipeline) AutoWhiteBalance() *ColorPipeline

AutoWhiteBalance 自动白平衡

func (*ColorPipeline) Brightness added in v1.6.5

func (cp *ColorPipeline) Brightness(value float64) *ColorPipeline

Brightness 调整亮度

func (*ColorPipeline) CLAHE added in v1.6.5

func (cp *ColorPipeline) CLAHE(tileSize int, clipLimit float64) *ColorPipeline

CLAHE CLAHE均衡化

func (*ColorPipeline) Contrast added in v1.6.5

func (cp *ColorPipeline) Contrast(value float64) *ColorPipeline

Contrast 调整对比度

func (*ColorPipeline) Export added in v1.6.5

func (cp *ColorPipeline) Export(outputPath string, format string) error

Export 导出结果

func (*ColorPipeline) Gamma added in v1.6.5

func (cp *ColorPipeline) Gamma(value float64) *ColorPipeline

Gamma Gamma校正

func (*ColorPipeline) Hue added in v1.6.5

func (cp *ColorPipeline) Hue(value float64) *ColorPipeline

Hue 调整色相

func (*ColorPipeline) Result added in v1.6.5

func (cp *ColorPipeline) Result() (*RasterDataset, error)

Result 获取结果

func (*ColorPipeline) Saturation added in v1.6.5

func (cp *ColorPipeline) Saturation(value float64) *ColorPipeline

Saturation 调整饱和度

type ColorStatistics added in v1.6.5

type ColorStatistics struct {
	MeanR, MeanG, MeanB float64
	StdR, StdG, StdB    float64
	MinR, MinG, MinB    float64
	MaxR, MaxG, MaxB    float64
}

ColorStatistics 颜色统计信息

type ColorTable added in v1.6.5

type ColorTable struct {
	// contains filtered or unexported fields
}

ColorTable 调色板句柄

func CreateCustomPalette added in v1.6.5

func CreateCustomPalette(colors []PaletteEntry) *ColorTable

CreateCustomPalette 从颜色数组创建自定义调色板

func CreateGrayscalePalette added in v1.6.5

func CreateGrayscalePalette() *ColorTable

CreateGrayscalePalette 创建灰度调色板

func CreateHeatmapPalette added in v1.6.5

func CreateHeatmapPalette() *ColorTable

CreateHeatmapPalette 创建热力图调色板

func CreateRainbowPalette added in v1.6.5

func CreateRainbowPalette() *ColorTable

CreateRainbowPalette 创建彩虹调色板

func NewColorTable added in v1.6.5

func NewColorTable(interpType PaletteInterpretation) *ColorTable

NewColorTable 创建新调色板

func (*ColorTable) AddEntry added in v1.6.5

func (ct *ColorTable) AddEntry(index int, r, g, b, a int16) error

AddEntry 添加调色板条目

func (*ColorTable) AddRGBEntry added in v1.6.5

func (ct *ColorTable) AddRGBEntry(index int, r, g, b int16) error

AddRGBEntry 添加RGB调色板条目(Alpha默认255)

func (*ColorTable) Destroy added in v1.6.5

func (ct *ColorTable) Destroy()

Destroy 销毁调色板

type CurveParams added in v1.6.5

type CurveParams struct {
	Points  []CurvePoint // 控制点数组
	Channel int          // 通道: 0=全部, 1=R, 2=G, 3=B
}

CurveParams 曲线调整参数

type CurvePoint added in v1.6.5

type CurvePoint struct {
	Input  float64 // 输入值 [0, 255]
	Output float64 // 输出值 [0, 255]
}

CurvePoint 曲线控制点

type DEFeatureClassInfo added in v1.4.2

type DEFeatureClassInfo struct {
	XMLName           xml.Name             `xml:"DEFeatureClassInfo"`
	CatalogPath       string               `xml:"CatalogPath"`
	Name              string               `xml:"Name"`
	DatasetType       string               `xml:"DatasetType"`
	DSID              string               `xml:"DSID"`
	HasOID            string               `xml:"HasOID"`
	OIDFieldName      string               `xml:"OIDFieldName"`
	AliasName         string               `xml:"AliasName"`
	HasGlobalID       string               `xml:"HasGlobalID"`
	GlobalIDFieldName string               `xml:"GlobalIDFieldName"`
	FeatureType       string               `xml:"FeatureType"`
	ShapeType         string               `xml:"ShapeType"`
	ShapeFieldName    string               `xml:"ShapeFieldName"`
	HasM              string               `xml:"HasM"`
	HasZ              string               `xml:"HasZ"`
	HasSpatialIndex   string               `xml:"HasSpatialIndex"`
	GPFieldInfoExs    GPFieldInfoExs       `xml:"GPFieldInfoExs"`
	SpatialReference  *SpatialReferenceXML `xml:"SpatialReference"` // 新增:空间参考
}

DEFeatureClassInfo XML解析结构 - 用于解析definition字段

type DatasetInfo added in v1.2.11

type DatasetInfo struct {
	Width        int
	Height       int
	BandCount    int
	GeoTransform [6]float64
	Projection   string
	HasGeoInfo   bool
}

DatasetInfo 数据集信息

type DeserializeResult

type DeserializeResult struct {
	Layer        *GDALLayer
	Success      bool
	ErrorMessage string
}

DeserializeResult 反序列化结果

func DeserializeLayerFromBinary

func DeserializeLayerFromBinary(data []byte) (*DeserializeResult, error)

DeserializeLayerFromBinary 从二进制数据反序列化图层(修复版本)

type DonutBuilderOptions added in v1.3.3

type DonutBuilderOptions struct {
	// MinAreaRatio 最小面积比例,小于此比例的洞将被忽略(相对于外部多边形)
	MinAreaRatio float64

	// MaxHoleCount 单个多边形最大洞数量,0表示无限制
	MaxHoleCount int

	// SimplifyTolerance 简化容差,0表示不简化
	SimplifyTolerance float64

	// MergeThreshold 合并阈值,距离小于此值的多边形将被合并
	MergeThreshold float64
}

DonutBuilderOptions 环岛构建选项

type Extent

type Extent struct {
	MinX, MinY, MaxX, MaxY float64
}

Extent 表示空间范围

type FastTileServer added in v1.4.16

type FastTileServer struct {
	// contains filtered or unexported fields
}

FastTileServer 高性能瓦片服务器(使用内存缓存)

func NewFastTileServer added in v1.4.16

func NewFastTileServer(imagePath string, options *FastTileServerOptions) (*FastTileServer, error)

NewFastTileServer 创建高性能瓦片服务器

func (*FastTileServer) ClearCache added in v1.4.16

func (fs *FastTileServer) ClearCache()

ClearCache 清空缓存

func (*FastTileServer) Close added in v1.4.16

func (fs *FastTileServer) Close()

Close 关闭服务器

func (*FastTileServer) GetBounds added in v1.4.16

func (fs *FastTileServer) GetBounds() (minLon, minLat, maxLon, maxLat float64)

GetBounds 获取边界

func (*FastTileServer) GetTile added in v1.4.16

func (fs *FastTileServer) GetTile(z, x, y int) ([]byte, error)

GetTile 获取瓦片(带缓存)

func (*FastTileServer) GetTileNoCache added in v1.4.16

func (fs *FastTileServer) GetTileNoCache(z, x, y int) ([]byte, error)

GetTileNoCache 获取瓦片(不使用缓存,最快)

type FastTileServerOptions added in v1.4.16

type FastTileServerOptions struct {
	TileSize  int // 瓦片大小
	CacheSize int // 缓存瓦片数量
}

FastTileServerOptions 高性能服务器选项

type FeatureAnalysisResult

type FeatureAnalysisResult struct {
	Properties map[string]interface{}
	WKBHex     string
}

FeatureAnalysisResult 要素分析结果

type FeatureData

type FeatureData struct {
	Properties map[string]interface{}
	WKBHex     string // 几何数据的WKB十六进制表示
}

FeatureData 要素数据

type FeatureGroup

type FeatureGroup struct {
	GroupKey string
	Features []C.OGRFeatureH
	Fields   map[string]string
}

type FieldAnalysisResult

type FieldAnalysisResult struct {
	Name      string
	Type      string
	Width     int
	Precision int
	DBType    string
}

FieldAnalysisResult 字段分析结果

type FieldDefinition added in v1.3.9

type FieldDefinition struct {
	Name      string      // 字段名称
	Type      FieldType   // 字段类型
	Width     int         // 字段宽度
	Precision int         // 精度(用于数值类型)
	Nullable  bool        // 是否允许NULL
	Default   interface{} // 默认值
}

FieldDefinition 字段定义结构

type FieldInfo

type FieldInfo struct {
	Name   string
	Type   string
	DBType string // 数据库对应类型
}

FieldInfo 字段信息

type FieldMapping added in v1.3.6

type FieldMapping struct {
	SourceIndex int
	TargetIndex int
	FieldName   string
}

FieldMapping 字段映射结构

type FieldMergeStrategy

type FieldMergeStrategy int

FieldMergeStrategy 字段合并策略枚举

const (
	// UseTable1Fields 只使用第一个表的字段
	UseTable1Fields FieldMergeStrategy = iota
	// UseTable2Fields 只使用第二个表的字段
	UseTable2Fields
	// MergePreferTable1 合并字段,冲突时优先使用table1
	MergePreferTable1
	// MergePreferTable2 合并字段,冲突时优先使用table2
	MergePreferTable2
	// MergeWithPrefix 合并字段,使用前缀区分来源
	MergeWithPrefix
)

func (FieldMergeStrategy) String

func (s FieldMergeStrategy) String() string

type FieldType added in v1.3.9

type FieldType int

FieldType 字段类型枚举

const (
	FieldTypeInteger   FieldType = C.OFTInteger
	FieldTypeInteger64 FieldType = C.OFTInteger64
	FieldTypeReal      FieldType = C.OFTReal
	FieldTypeString    FieldType = C.OFTString
	FieldTypeDate      FieldType = C.OFTDate
	FieldTypeTime      FieldType = C.OFTTime
	FieldTypeDateTime  FieldType = C.OFTDateTime
	FieldTypeBinary    FieldType = C.OFTBinary
)

type FieldTypeCompatibility added in v1.4.14

type FieldTypeCompatibility struct {
	IsCompatible    bool   // 是否兼容
	SourceType      string // 源类型
	TargetType      string // 目标类型
	ConversionNotes string // 转换说明
	DataLossRisk    bool   // 是否有数据丢失风险
}

FieldTypeCompatibility 字段类型兼容性检查结果

func CheckFieldTypeCompatibility added in v1.4.14

func CheckFieldTypeCompatibility(pgType string) FieldTypeCompatibility

CheckFieldTypeCompatibility 检查字段类型在PostgreSQL和GDB之间的兼容性

type FieldValue added in v1.3.9

type FieldValue struct {
	Values map[string]interface{} // 字段名 -> 值
}

FieldValue 字段值结构

type FieldsInfo

type FieldsInfo struct {
	Name      string
	Type      C.OGRFieldType
	FromTable string // 标记字段来源表
}

FieldsInfo 字段信息结构

type FileGeoReader

type FileGeoReader struct {
	FilePath string
	FileType string // "shp", "gdb"
}

FileGeoReader 文件地理数据读取器

func MakeGDBReader

func MakeGDBReader(filePath string) (*FileGeoReader, error)

MakeGDBReader 创建GDB读取器

func MakeShapeFileReader

func MakeShapeFileReader(filePath string) (*FileGeoReader, error)

MakeShapeFileReader 创建Shapefile读取器

func NewFileGeoReader

func NewFileGeoReader(filePath string) (*FileGeoReader, error)

NewFileGeoReader 创建新的文件地理数据读取器

func (*FileGeoReader) GetLayerInfo

func (r *FileGeoReader) GetLayerInfo(layerName ...string) (map[string]interface{}, error)

GetLayerInfo 获取图层信息

func (*FileGeoReader) ListLayers

func (r *FileGeoReader) ListLayers() ([]string, error)

ListLayers 列出所有图层

func (*FileGeoReader) ReadDXFFile added in v1.3.0

func (r *FileGeoReader) ReadDXFFile(layerName ...string) (*GDALLayer, error)

ReadDXFFile 读取DXF文件

func (*FileGeoReader) ReadGDBFile

func (r *FileGeoReader) ReadGDBFile(layerName ...string) (*GDALLayer, error)

ReadGDBFile 读取GDB文件

func (*FileGeoReader) ReadGeoJSONFile added in v1.3.0

func (r *FileGeoReader) ReadGeoJSONFile(layerName ...string) (*GDALLayer, error)

ReadGeoJSONFile 读取GeoJSON文件

func (*FileGeoReader) ReadKMLFile added in v1.3.0

func (r *FileGeoReader) ReadKMLFile(layerName ...string) (*GDALLayer, error)

ReadKMLFile 读取KML文件

func (*FileGeoReader) ReadKMZFile added in v1.3.0

func (r *FileGeoReader) ReadKMZFile(layerName ...string) (*GDALLayer, error)

ReadKMZFile 读取KMZ文件(压缩的KML)

func (*FileGeoReader) ReadLayer

func (r *FileGeoReader) ReadLayer(layerName ...string) (*GDALLayer, error)

ReadLayer 通用读取图层方法

func (*FileGeoReader) ReadShapeFile

func (r *FileGeoReader) ReadShapeFile(layerName ...string) (*GDALLayer, error)

ReadShapeFile 读取Shapefile

type FileGeoWriter

type FileGeoWriter struct {
	FilePath  string
	FileType  string // "shp", "gdb"
	Overwrite bool   // 是否覆盖已存在的文件
}

FileGeoWriter 文件地理数据写入器

func NewFileGeoWriter

func NewFileGeoWriter(filePath string, overwrite bool) (*FileGeoWriter, error)

NewFileGeoWriter 创建新的文件地理数据写入器

func (*FileGeoWriter) WriteDXFFile added in v1.3.0

func (w *FileGeoWriter) WriteDXFFile(sourceLayer *GDALLayer, layerName string) error

WriteDXFFile 写入DXF文件

func (*FileGeoWriter) WriteGDBFile

func (w *FileGeoWriter) WriteGDBFile(sourceLayer *GDALLayer, layerName string) error

WriteGDBFile 写入GDB文件

func (*FileGeoWriter) WriteGeoJSONFile added in v1.3.0

func (w *FileGeoWriter) WriteGeoJSONFile(sourceLayer *GDALLayer, layerName string) error

WriteGeoJSONFile 写入GeoJSON文件

func (*FileGeoWriter) WriteKMLFile added in v1.3.0

func (w *FileGeoWriter) WriteKMLFile(sourceLayer *GDALLayer, layerName string) error

WriteKMLFile 写入KML文件

func (*FileGeoWriter) WriteKMZFile added in v1.3.0

func (w *FileGeoWriter) WriteKMZFile(sourceLayer *GDALLayer, layerName string) error

WriteKMZFile 写入KMZ文件(压缩的KML)

func (*FileGeoWriter) WriteLayer

func (w *FileGeoWriter) WriteLayer(sourceLayer *GDALLayer, layerName string) error

WriteLayer 通用写入图层方法

func (*FileGeoWriter) WriteShapeFile

func (w *FileGeoWriter) WriteShapeFile(sourceLayer *GDALLayer, layerName string) error

WriteShapeFile 写入Shapefile

type FilterType added in v1.6.5

type FilterType int

FilterType 滤波类型

const (
	FilterMean     FilterType = iota // 均值滤波
	FilterMedian                     // 中值滤波
	FilterGaussian                   // 高斯滤波
	FilterSobel                      // Sobel边缘检测
	FilterLaplace                    // 拉普拉斯滤波
	FilterMin                        // 最小值滤波
	FilterMax                        // 最大值滤波
)

type GDALFeature added in v1.3.14

type GDALFeature struct {
	Feature C.OGRFeatureH
}

GDALFeature 要素包装结构

func WrapFeature added in v1.3.15

func WrapFeature(Feature C.OGRFeatureH) *GDALFeature

WrapFeature 将C类型要素包装为Go类型

func (*GDALFeature) Clone added in v1.3.15

func (f *GDALFeature) Clone() *GDALFeature

Clone 克隆要素

func (*GDALFeature) Destroy added in v1.3.14

func (f *GDALFeature) Destroy()

Destroy 销毁要素,释放内存

func (*GDALFeature) GetFeature added in v1.3.15

func (f *GDALFeature) GetFeature() C.OGRFeatureH

GetFeature 获取底层C句柄(用于需要直接操作C类型的场景)

func (*GDALFeature) GetFieldAsDouble added in v1.3.15

func (f *GDALFeature) GetFieldAsDouble(fieldName string) float64

GetFieldAsDouble 获取浮点字段值

func (*GDALFeature) GetFieldAsInteger added in v1.3.15

func (f *GDALFeature) GetFieldAsInteger(fieldName string) int

GetFieldAsInteger 获取整数字段值

func (*GDALFeature) GetFieldAsString added in v1.3.15

func (f *GDALFeature) GetFieldAsString(fieldName string) string

GetFieldAsString 获取字符串字段值

func (*GDALFeature) GetFieldAsStringByIndex added in v1.3.15

func (f *GDALFeature) GetFieldAsStringByIndex(index int) string

GetFieldAsStringByIndex 通过索引获取字符串字段值

func (*GDALFeature) GetFieldCount added in v1.3.15

func (f *GDALFeature) GetFieldCount() int

GetFieldCount 获取字段数量

func (*GDALFeature) GetFieldIndex added in v1.3.15

func (f *GDALFeature) GetFieldIndex(fieldName string) int

GetFieldIndex 获取字段索引

func (*GDALFeature) GetGeometry added in v1.3.14

func (f *GDALFeature) GetGeometry() C.OGRGeometryH

GetGeometry 获取几何对象

func (*GDALFeature) GetGeometryCopy added in v1.3.15

func (f *GDALFeature) GetGeometryCopy() C.OGRGeometryH

GetGeometryCopy 获取几何对象的副本(调用者需要负责释放)

func (*GDALFeature) IsValid added in v1.3.15

func (f *GDALFeature) IsValid() bool

IsValid 检查要素是否有效

func (*GDALFeature) SetFieldDouble added in v1.3.15

func (f *GDALFeature) SetFieldDouble(fieldName string, value float64) error

SetFieldDouble 设置浮点字段值

func (*GDALFeature) SetFieldInteger added in v1.3.15

func (f *GDALFeature) SetFieldInteger(fieldName string, value int) error

SetFieldInteger 设置整数字段值

func (*GDALFeature) SetFieldString added in v1.3.14

func (f *GDALFeature) SetFieldString(fieldName, value string) error

SetFieldString 设置字符串字段值

func (*GDALFeature) SetFieldStringByIndex added in v1.3.15

func (f *GDALFeature) SetFieldStringByIndex(index int, value string)

SetFieldStringByIndex 通过索引设置字符串字段值

func (*GDALFeature) SetGeometry added in v1.3.14

func (f *GDALFeature) SetGeometry(geom C.OGRGeometryH) error

SetGeometry 设置几何对象

func (*GDALFeature) SetGeometryDirectly added in v1.3.15

func (f *GDALFeature) SetGeometryDirectly(geom C.OGRGeometryH) error

SetGeometryDirectly 设置几何对象(转移所有权,不复制)

type GDALLayer

type GDALLayer struct {
	// contains filtered or unexported fields
}

func AreaOnAreaAnalysis added in v1.3.12

func AreaOnAreaAnalysis(layer *GDALLayer, tolerance float64) (*GDALLayer, error)

func BatchBuffer added in v1.3.2

func BatchBuffer(sourceLayer *GDALLayer, distanceField string, quadSegs int) (*GDALLayer, error)

BatchBuffer 批量缓冲区分析(支持不同的缓冲距离)

func BoundaryLayer added in v1.3.2

func BoundaryLayer(sourceLayer *GDALLayer) (*GDALLayer, error)

BoundaryLayer 计算图层中每个要素的边界

func BufferLayer added in v1.3.2

func BufferLayer(sourceLayer *GDALLayer, distance float64, quadSegs int) (*GDALLayer, error)

BufferLayer 对整个图层进行缓冲区分析 distance: 缓冲距离(单位与数据坐标系一致) quadSegs: 圆弧的四分之一段数,默认30,值越大越平滑

func BufferLayerAuto added in v1.3.2

func BufferLayerAuto(sourceLayer *GDALLayer, targetRatio float64, quadSegs int) (*GDALLayer, error)

BufferLayerAuto 根据图形的面积和周长自动计算缓冲距离并创建缓冲区 对于带环岛的面要素,只缓冲外环,内环保持不变

func CentroidLayer added in v1.3.2

func CentroidLayer(sourceLayer *GDALLayer) (*GDALLayer, error)

CentroidLayer 计算图层中每个要素的质心

func ConvertGeoJSONToGDALLayer added in v1.3.0

func ConvertGeoJSONToGDALLayer(fc *geojson.FeatureCollection, layerName string) (*GDALLayer, error)

func ConvexHullLayer added in v1.3.2

func ConvexHullLayer(sourceLayer *GDALLayer) (*GDALLayer, error)

ConvexHullLayer 对整个图层计算凸包

func CreateIntersectionResultLayer added in v1.5.6

func CreateIntersectionResultLayer(layer1, layer2 *GDALLayer, strategy FieldMergeStrategy) (*GDALLayer, error)

func CreateMemoryLayer added in v1.3.14

func CreateMemoryLayer(layerName string, geomType GeomType) (*GDALLayer, error)

CreateMemoryLayer 创建内存图层

func DeserializeLayerFromFile

func DeserializeLayerFromFile(filePath string) (*GDALLayer, error)

func DifferenceLayer added in v1.3.2

func DifferenceLayer(layer1, layer2 *GDALLayer) (*GDALLayer, error)

DifferenceLayer 计算两个图层的差集(layer1 - layer2)

func DissolveLayer added in v1.3.2

func DissolveLayer(sourceLayer *GDALLayer, dissolveField string) (*GDALLayer, error)

DissolveLayer 融合图层(按字段融合)

func DonutBuilder added in v1.3.3

func DonutBuilder(sourceLayer *GDALLayer) (*GDALLayer, error)

func DonutBuilderWithOptions added in v1.3.3

func DonutBuilderWithOptions(sourceLayer *GDALLayer, options *DonutBuilderOptions) (*GDALLayer, error)

DonutBuilderWithOptions 带选项的环岛构建函数

func FilterByExtent added in v1.3.2

func FilterByExtent(sourceLayer *GDALLayer, minX, minY, maxX, maxY float64) (*GDALLayer, error)

FilterByExtent 按范围过滤图层

func FilterByGeometry added in v1.3.2

func FilterByGeometry(sourceLayer *GDALLayer, filterGeom C.OGRGeometryH) (*GDALLayer, error)

FilterByGeometry 按几何体过滤图层

func IntersectionLayer added in v1.3.2

func IntersectionLayer(layer1, layer2 *GDALLayer) (*GDALLayer, error)

IntersectionLayer 计算两个图层的交集

func MakeValidLayer added in v1.3.2

func MakeValidLayer(sourceLayer *GDALLayer) (*GDALLayer, error)

MakeValidLayer 对整个图层进行几何修复

func MergeFeaturesToLayer added in v1.3.2

func MergeFeaturesToLayer(features []C.OGRFeatureH, layerName string, srs C.OGRSpatialReferenceH) (*GDALLayer, error)

MergeFeaturesToLayer 将多个要素合并到一个新图层

func ReadDXFLayer added in v1.3.0

func ReadDXFLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadDXFLayer 直接读取DXF图层

func ReadGDBLayer

func ReadGDBLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadGDBLayer 直接读取GDB图层

func ReadGeoJSONLayer added in v1.3.0

func ReadGeoJSONLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadGeoJSONLayer 直接读取GeoJSON图层

func ReadGeospatialFile

func ReadGeospatialFile(filePath string, layerName ...string) (*GDALLayer, error)

ReadGeospatialFile 通用读取地理空间文件

func ReadKMLLayer added in v1.3.0

func ReadKMLLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadKMLLayer 直接读取KML图层

func ReadKMZLayer added in v1.3.0

func ReadKMZLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadKMZLayer 直接读取KMZ图层

func ReadShapeFileLayer

func ReadShapeFileLayer(filePath string, layerName ...string) (*GDALLayer, error)

ReadShapeFileLayer 直接读取Shapefile图层

func SafeDeserializeLayerFromFile

func SafeDeserializeLayerFromFile(filePath string) (*GDALLayer, error)

SafeDeserializeLayerFromFile 安全版本的文件反序列化

func SimplifyLayer added in v1.3.2

func SimplifyLayer(sourceLayer *GDALLayer, tolerance float64, preserveTopology bool) (*GDALLayer, error)

SimplifyLayer 对整个图层进行简化 tolerance: 简化容差 preserveTopology: 是否保持拓扑关系

func TransformLayer added in v1.3.2

func TransformLayer(sourceLayer *GDALLayer, targetSRS C.OGRSpatialReferenceH) (*GDALLayer, error)

TransformLayer 对图层进行坐标转换

func UnionAllLayer added in v1.3.2

func UnionAllLayer(sourceLayer *GDALLayer) (*GDALLayer, error)

UnionAllLayer 将图层中所有要素合并为一个几何体

func (*GDALLayer) CleanupDeserializedLayer

func (layer *GDALLayer) CleanupDeserializedLayer()

CleanupDeserializedLayer 清理反序列化的图层资源(修复版本)

func (*GDALLayer) Close

func (gl *GDALLayer) Close()

Close 手动关闭资源

func (*GDALLayer) CreateEmptyFeature added in v1.3.14

func (gl *GDALLayer) CreateEmptyFeature() *GDALFeature

CreateEmptyFeature 创建空要素

func (*GDALLayer) CreateFeature added in v1.3.14

func (gl *GDALLayer) CreateFeature(f *GDALFeature) error

CreateFeature 将要素添加到图层

func (*GDALLayer) CreateFeatureFromHandle added in v1.3.15

func (gl *GDALLayer) CreateFeatureFromHandle(handle C.OGRFeatureH) error

CreateFeatureFromHandle 从C句柄创建要素到图层

func (*GDALLayer) CreateField added in v1.3.14

func (l *GDALLayer) CreateField(fieldDefn C.OGRFieldDefnH) error

CreateField 创建字段

func (*GDALLayer) GetEPSGCode added in v1.6.7

func (gl *GDALLayer) GetEPSGCode() int

GetEPSGCode 获取图层的EPSG代码

func (*GDALLayer) GetFeatureCount

func (gl *GDALLayer) GetFeatureCount() int

GetFeatureCount 获取要素数量

func (*GDALLayer) GetFieldCount

func (gl *GDALLayer) GetFieldCount() int

GetFieldCount 获取字段数量

func (*GDALLayer) GetFieldDefn added in v1.3.14

func (l *GDALLayer) GetFieldDefn(index int) C.OGRFieldDefnH

GetFieldDefn 获取字段定义

func (*GDALLayer) GetFieldName

func (gl *GDALLayer) GetFieldName(index int) string

GetFieldName 获取字段名称

func (*GDALLayer) GetFieldType

func (gl *GDALLayer) GetFieldType(index int) string

GetFieldType 获取字段类型

func (*GDALLayer) GetGeometryType

func (gl *GDALLayer) GetGeometryType() string

GetGeometryType 获取几何类型

func (*GDALLayer) GetLayerDefn

func (gl *GDALLayer) GetLayerDefn() C.OGRFeatureDefnH

GetLayerDefn 获取图层定义

func (*GDALLayer) GetLayerName

func (gl *GDALLayer) GetLayerName() string

GetLayerName 获取图层名称

func (*GDALLayer) GetNextFeature

func (gl *GDALLayer) GetNextFeature() *GDALFeature

GetNextFeature 获取下一个要素(返回Go包装类型)

func (*GDALLayer) GetNextFeatureRow added in v1.3.15

func (gl *GDALLayer) GetNextFeatureRow() C.OGRFeatureH

GetNextFeature 获取下一个要素

func (*GDALLayer) GetSpatialRef

func (gl *GDALLayer) GetSpatialRef() C.OGRSpatialReferenceH

GetSpatialRef 获取空间参考系统

func (*GDALLayer) IterateFeatures

func (gl *GDALLayer) IterateFeatures(callback func(feature C.OGRFeatureH))

IterateFeatures 遍历所有要素

func (*GDALLayer) PrintFieldsInfo

func (gl *GDALLayer) PrintFieldsInfo()

PrintFieldsInfo 仅打印字段信息

func (*GDALLayer) PrintLayerInfo

func (gl *GDALLayer) PrintLayerInfo()

PrintLayerInfo 打印图层信息(增强版)

func (*GDALLayer) PrintLayerSummary

func (gl *GDALLayer) PrintLayerSummary()

PrintLayerSummary 打印图层摘要信息(简化版)

func (*GDALLayer) ReprojectLayer added in v1.6.7

func (gl *GDALLayer) ReprojectLayer(targetEPSG int) (*GDALLayer, error)

ReprojectLayer 将图层投影到新的坐标系(返回新的内存图层)

func (*GDALLayer) ResetReading

func (gl *GDALLayer) ResetReading()

ResetReading 重置读取位置

type GDBExtentInfo added in v1.4.3

type GDBExtentInfo struct {
	XMin float64
	YMin float64
	XMax float64
	YMax float64
}

GDBExtentInfo 范围信息

type GDBFeatureDatasetMetadata added in v1.4.3

type GDBFeatureDatasetMetadata struct {
	Name             string                    // 数据集名称
	DSID             int                       // 数据集ID
	SpatialReference *GDBSpatialReferenceWrite // 空间参考
}

GDBFeatureDatasetMetadata 要素数据集元数据

func GetFeatureDatasetInfo added in v1.4.3

func GetFeatureDatasetInfo(gdbPath string, datasetName string) (*GDBFeatureDatasetMetadata, error)

GetFeatureDatasetInfo 获取要素数据集的详细信息

func NewGDBFeatureDatasetMetadata added in v1.4.3

func NewGDBFeatureDatasetMetadata(name string) *GDBFeatureDatasetMetadata

NewGDBFeatureDatasetMetadata 创建新的要素数据集元数据

func (*GDBFeatureDatasetMetadata) GenerateFeatureDatasetDefinitionXML added in v1.4.3

func (m *GDBFeatureDatasetMetadata) GenerateFeatureDatasetDefinitionXML() string

GenerateFeatureDatasetDefinitionXML 生成要素数据集的Definition XML

func (*GDBFeatureDatasetMetadata) WithSpatialReference added in v1.4.3

WithSpatialReference 设置空间参考

func (*GDBFeatureDatasetMetadata) WithSpatialReferenceFromGDB added in v1.4.3

func (m *GDBFeatureDatasetMetadata) WithSpatialReferenceFromGDB(srs *GDBSpatialReference) *GDBFeatureDatasetMetadata

WithSpatialReferenceFromGDB 从GDBSpatialReference设置空间参考

type GDBFieldMetadata added in v1.4.3

type GDBFieldMetadata struct {
	Name       string // 字段名称
	AliasName  string // 字段别名(中文名)
	ModelName  string // 模型名称
	FieldType  string // 字段类型 (esriFieldTypeString, esriFieldTypeInteger, esriFieldTypeDouble等)
	IsNullable bool   // 是否可空
	Length     int    // 字段长度(字符串类型)
	Precision  int    // 精度(数值类型)
	Scale      int    // 小数位数
	Required   bool   // 是否必需
	Editable   bool   // 是否可编辑
}

GDBFieldMetadata 字段元数据(用于写入)

type GDBItemRelationship added in v1.4.3

type GDBItemRelationship struct {
	ObjectID   int    // 对象ID
	UUID       string // 关系UUID
	Type       string // 关系类型UUID
	OriginID   string // 源项UUID (父级,如数据集)
	DestID     string // 目标项UUID (子级,如要素类)
	Attributes string // 属性
	Properties int    // 属性值
}

GDBItemRelationship 表示GDB_ItemRelationships表中的一条记录

type GDBLayerFieldInfo added in v1.4.2

type GDBLayerFieldInfo struct {
	Name       string `json:"name" xml:"Name"`                     // 字段名称
	AliasName  string `json:"alias_name" xml:"AliasName"`          // 字段别名(中文名)
	FieldType  string `json:"field_type" xml:"FieldType"`          // 字段类型
	IsNullable bool   `json:"is_nullable" xml:"IsNullable"`        // 是否可空
	Length     int    `json:"length,omitempty" xml:"Length"`       // 字段长度(字符串类型)
	Precision  int    `json:"precision,omitempty" xml:"Precision"` // 精度(数值类型)
	Scale      int    `json:"scale,omitempty" xml:"Scale"`         // 小数位数
}

GDBLayerFieldInfo 图层字段信息

type GDBLayerInfo

type GDBLayerInfo struct {
	LayerName   string
	GeoType     string
	FieldInfos  []FieldInfo
	FeatureData []FeatureData
}

GDBLayerInfo 直接从GDB获取的图层信息

func GDBToPostGIS

func GDBToPostGIS(gdbPath string, targetLayers []string) ([]GDBLayerInfo, error)

GDBToPostGIS 直接将GDB转换为PostGIS可用的数据结构 targetLayers: 指定要导入的图层名称列表,如果为空或nil则导入所有图层

type GDBLayerMetaData added in v1.4.2

type GDBLayerMetaData struct {
	// 基本信息
	Name        string `json:"name"`         // 图层名称
	AliasName   string `json:"alias_name"`   // 图层别名
	Path        string `json:"path"`         // 图层路径
	CatalogPath string `json:"catalog_path"` // 目录路径
	UUID        string `json:"uuid"`         // 唯一标识
	TypeUUID    string `json:"type_uuid"`    // 类型UUID
	EPSG        int    `json:"epsg"`         // EPSG代码
	// 数据集信息
	DatasetName string `json:"dataset_name"` // 所属要素数据集名称
	DatasetType string `json:"dataset_type"` // 数据集类型 (esriDTFeatureClass等)
	DSID        int    `json:"dsid"`         // 数据集ID
	FeatureType string `json:"feature_type"` // 要素类型 (esriFTSimple等)
	// 几何信息
	ShapeType       string `json:"shape_type"`        // 几何类型 (esriGeometryPoint/Polygon/Polyline等)
	ShapeFieldName  string `json:"shape_field_name"`  // 几何字段名
	HasM            bool   `json:"has_m"`             // 是否有M值
	HasZ            bool   `json:"has_z"`             // 是否有Z值
	HasSpatialIndex bool   `json:"has_spatial_index"` // 是否有空间索引
	// OID信息
	HasOID       bool   `json:"has_oid"`        // 是否有OID
	OIDFieldName string `json:"oid_field_name"` // OID字段名
	// GlobalID信息
	HasGlobalID       bool   `json:"has_global_id"`        // 是否有GlobalID
	GlobalIDFieldName string `json:"global_id_field_name"` // GlobalID字段名
	// 字段信息
	Fields []GDBLayerFieldInfo `json:"fields"` // 字段列表
}

GDBLayerMetaData 图层元数据

func ReadGDBLayerMetadataByName added in v1.4.2

func ReadGDBLayerMetadataByName(gdbPath string, layerName string) (*GDBLayerMetaData, error)

ReadGDBLayerMetadataByName 读取指定图层的元数据

func (*GDBLayerMetaData) GetFieldAliasMap added in v1.4.2

func (m *GDBLayerMetaData) GetFieldAliasMap() map[string]string

GetFieldAliasMap 获取字段别名映射 (字段名 -> 别名)

func (*GDBLayerMetaData) GetFieldByAlias added in v1.4.2

func (m *GDBLayerMetaData) GetFieldByAlias(aliasName string) *GDBLayerFieldInfo

GetFieldByAlias 根据别名获取字段信息

func (*GDBLayerMetaData) GetFieldByName added in v1.4.2

func (m *GDBLayerMetaData) GetFieldByName(fieldName string) *GDBLayerFieldInfo

GetFieldByName 根据字段名获取字段信息

func (*GDBLayerMetaData) PrintMetadata added in v1.4.2

func (m *GDBLayerMetaData) PrintMetadata()

PrintMetadata 打印图层元数据信息

type GDBLayerMetadataCollection added in v1.4.2

type GDBLayerMetadataCollection struct {
	GDBPath string              `json:"gdb_path"` // GDB路径
	GDBName string              `json:"gdb_name"` // GDB名称
	Layers  []*GDBLayerMetaData `json:"layers"`   // 图层列表
	// 按数据集分组
	DatasetGroups map[string][]*GDBLayerMetaData `json:"dataset_groups"` // 数据集名称 -> 图层列表
	// 统计信息
	TotalLayers int `json:"total_layers"` // 总图层数
}

GDBLayerMetadataCollection GDB图层元数据集合

func ReadGDBLayerMetadata added in v1.4.2

func ReadGDBLayerMetadata(gdbPath string) (*GDBLayerMetadataCollection, error)

ReadGDBLayerMetadata 读取GDB文件的所有图层元数据 gdbPath: GDB文件路径 返回: GDBLayerMetadataCollection 包含所有图层的元数据信息

func (*GDBLayerMetadataCollection) GetAllFieldAliases added in v1.4.2

func (c *GDBLayerMetadataCollection) GetAllFieldAliases() map[string]map[string]string

GetAllFieldAliases 获取所有图层的字段别名映射 返回: map[图层名]map[字段名]别名

func (*GDBLayerMetadataCollection) GetLayerByAlias added in v1.4.2

func (c *GDBLayerMetadataCollection) GetLayerByAlias(aliasName string) *GDBLayerMetaData

GetLayerByAlias 根据图层别名获取图层元数据

func (*GDBLayerMetadataCollection) GetLayerByName added in v1.4.2

func (c *GDBLayerMetadataCollection) GetLayerByName(layerName string) *GDBLayerMetaData

GetLayerByName 根据图层名获取图层元数据

func (*GDBLayerMetadataCollection) GetLayersByDataset added in v1.4.2

func (c *GDBLayerMetadataCollection) GetLayersByDataset(datasetName string) []*GDBLayerMetaData

GetLayersByDataset 获取指定数据集下的所有图层

func (*GDBLayerMetadataCollection) PrintCollection added in v1.4.2

func (c *GDBLayerMetadataCollection) PrintCollection()

PrintCollection 打印元数据集合信息

type GDBLayerMetadataWrite added in v1.4.3

type GDBLayerMetadataWrite struct {
	// 基本信息
	Name        string // 图层名称
	AliasName   string // 图层别名
	LayerPath   string // 图层路径(用于GDB_Items的Path字段,不包含图层名)
	CatalogPath string // 目录路径DSID        int    // 数据集ID
	FeatureType string
	DSID        int
	// 数据集信息
	DatasetType                      string // 数据集类型 (esriDTFeatureClass)FeatureType                    string // 要素类型 (esriFTSimple)
	Versioned                        bool   // 是否版本化
	CanVersion                       bool   // 是否可版本化
	ConfigurationKeyword             string // 配置关键字
	RequiredGeodatabaseClientVersion string // 所需地理数据库客户端版本

	// 几何信息
	ShapeType       string // 几何类型 (esriGeometryPoint/Polygon/Polyline等)
	ShapeFieldName  string // 几何字段名 (默认SHAPE)
	HasM            bool   // 是否有M值
	HasZ            bool   // 是否有Z值
	HasSpatialIndex bool   // 是否有空间索引

	// OID信息
	HasOID       bool   // 是否有OID
	OIDFieldName string // OID字段名 (默认OBJECTID)

	// GlobalID信息
	HasGlobalID       bool   // 是否有GlobalID
	GlobalIDFieldName string // GlobalID字段名

	// CLSID信息
	CLSID    string // 类ID
	EXTCLSID string // 扩展类ID

	// 字段信息
	Fields []GDBFieldMetadata // 字段列表

	// 空间参考
	SpatialReference *GDBSpatialReferenceWrite // 空间参考系统

	// 范围信息
	Extent *GDBExtentInfo // 数据范围

	// 面积和长度字段
	AreaFieldName   string // 面积字段名
	LengthFieldName string // 长度字段名

	// 编辑追踪
	EditorTrackingEnabled bool   // 是否启用编辑追踪
	CreatorFieldName      string // 创建者字段名
	CreatedAtFieldName    string // 创建时间字段名
	EditorFieldName       string // 编辑者字段名
	EditedAtFieldName     string // 编辑时间字段名
	IsTimeInUTC           bool   // 时间是否为UTC

	// 其他
	ChangeTracked         bool   // 是否追踪变更
	FieldFilteringEnabled bool   // 是否启用字段过滤
	RasterFieldName       string // 栅格字段名
}

GDBLayerMetadataWrite 图层元数据(用于写入)

func CreateMetadataWriteFromLayer added in v1.4.3

func CreateMetadataWriteFromLayer(gdbPath string, layerName string) (*GDBLayerMetadataWrite, error)

CreateMetadataWriteFromLayer 从GDB图层读取信息创建元数据写入对象

func NewGDBLayerMetadataWrite added in v1.4.3

func NewGDBLayerMetadataWrite(layerName string) *GDBLayerMetadataWrite

NewGDBLayerMetadataWrite 创建新的图层元数据写入对象

func (*GDBLayerMetadataWrite) AddDateField added in v1.4.3

func (m *GDBLayerMetadataWrite) AddDateField(name, alias string, nullable bool) *GDBLayerMetadataWrite

AddDateField 添加日期字段

func (*GDBLayerMetadataWrite) AddDoubleField added in v1.4.3

func (m *GDBLayerMetadataWrite) AddDoubleField(name, alias string, precision, scale int, nullable bool) *GDBLayerMetadataWrite

AddDoubleField 添加双精度浮点字段

func (*GDBLayerMetadataWrite) AddField added in v1.4.3

AddField 添加字段

func (*GDBLayerMetadataWrite) AddIntegerField added in v1.4.3

func (m *GDBLayerMetadataWrite) AddIntegerField(name, alias string, nullable bool) *GDBLayerMetadataWrite

AddIntegerField 添加整数字段

func (*GDBLayerMetadataWrite) AddStringField added in v1.4.3

func (m *GDBLayerMetadataWrite) AddStringField(name, alias string, length int, nullable bool) *GDBLayerMetadataWrite

AddStringField 添加字符串字段

func (*GDBLayerMetadataWrite) Clone added in v1.4.3

Clone 克隆元数据对象

func (*GDBLayerMetadataWrite) GenerateDefinitionXML added in v1.4.3

func (m *GDBLayerMetadataWrite) GenerateDefinitionXML() (string, error)

GenerateDefinitionXML 生成Definition字段的XML内容

func (*GDBLayerMetadataWrite) GenerateDefinitionXMLFormatted added in v1.4.3

func (m *GDBLayerMetadataWrite) GenerateDefinitionXMLFormatted() (string, error)

GenerateDefinitionXMLFormatted 生成格式化的XML(用于调试)

func (*GDBLayerMetadataWrite) PrintMetadataInfo added in v1.4.3

func (m *GDBLayerMetadataWrite) PrintMetadataInfo()

PrintMetadataInfo 打印元数据信息(用于调试)

func (*GDBLayerMetadataWrite) ValidateMetadata added in v1.4.3

func (m *GDBLayerMetadataWrite) ValidateMetadata() []string

ValidateMetadata 验证元数据完整性

func (*GDBLayerMetadataWrite) WithAliasName added in v1.4.3

func (m *GDBLayerMetadataWrite) WithAliasName(alias string) *GDBLayerMetadataWrite

WithAliasName 设置图层别名

func (*GDBLayerMetadataWrite) WithAreaAndLengthFields added in v1.4.3

func (m *GDBLayerMetadataWrite) WithAreaAndLengthFields(areaField, lengthField string) *GDBLayerMetadataWrite

WithAreaAndLengthFields 设置面积和长度字段名

func (*GDBLayerMetadataWrite) WithDSID added in v1.4.3

func (m *GDBLayerMetadataWrite) WithDSID(dsid int) *GDBLayerMetadataWrite

WithDSID 设置数据集ID

func (*GDBLayerMetadataWrite) WithExtent added in v1.4.3

func (m *GDBLayerMetadataWrite) WithExtent(xMin, yMin, xMax, yMax float64) *GDBLayerMetadataWrite

WithExtent 设置范围

func (*GDBLayerMetadataWrite) WithHasM added in v1.4.3

WithHasM 设置是否有M值

func (*GDBLayerMetadataWrite) WithHasZ added in v1.4.3

WithHasZ 设置是否有Z值

func (*GDBLayerMetadataWrite) WithLayerPath added in v1.4.3

func (m *GDBLayerMetadataWrite) WithLayerPath(path string) *GDBLayerMetadataWrite

func (*GDBLayerMetadataWrite) WithOIDFieldName added in v1.4.3

func (m *GDBLayerMetadataWrite) WithOIDFieldName(name string) *GDBLayerMetadataWrite

WithOIDFieldName 设置OID字段名

func (*GDBLayerMetadataWrite) WithShapeFieldName added in v1.4.3

func (m *GDBLayerMetadataWrite) WithShapeFieldName(name string) *GDBLayerMetadataWrite

WithShapeFieldName 设置几何字段名

func (*GDBLayerMetadataWrite) WithShapeType added in v1.4.3

func (m *GDBLayerMetadataWrite) WithShapeType(shapeType string) *GDBLayerMetadataWrite

WithShapeType 设置几何类型

func (*GDBLayerMetadataWrite) WithSpatialReference added in v1.4.3

WithSpatialReference 设置空间参考

type GDBMetadataUpdateConfig added in v1.4.3

type GDBMetadataUpdateConfig struct {
	LayerName    string            // 图层名称
	LayerAlias   string            // 图层别名(可选,为空则不更新)
	FieldAliases map[string]string // 字段别名映射(可选)
}

GDBMetadataUpdateConfig 元数据更新配置

type GDBSpatialReference added in v1.4.3

type GDBSpatialReference struct {
	EPSG        int                     // EPSG代码
	Name        string                  // 坐标系名称
	Type        GDBSpatialReferenceType // 坐标系类型
	Description string                  // 描述信息
	WKT         string                  // WKT定义(可选,用于自定义坐标系)
	Proj4       string                  // Proj4定义(可选)
}

GDBSpatialReference 空间参考系统结构

func GetAllCGCS2000_3DegreeCMZones added in v1.4.3

func GetAllCGCS2000_3DegreeCMZones() []*GDBSpatialReference

GetAllCGCS2000_3DegreeCMZones 获取所有CGCS2000 3度带(带带号前缀)坐标系列表

func GetAllCGCS2000_3DegreeZones added in v1.4.3

func GetAllCGCS2000_3DegreeZones() []*GDBSpatialReference

GetAllCGCS2000_3DegreeZones 获取所有CGCS2000 3度带坐标系列表

func GetCGCS2000_3DegreeByCentralMeridian added in v1.4.3

func GetCGCS2000_3DegreeByCentralMeridian(centralMeridian int) (*GDBSpatialReference, error)

GetCGCS2000_3DegreeByCentralMeridian 根据中央经线获取CGCS2000 3度带坐标系(带带号前缀) centralMeridian: 中央经线 (75, 78, 81, ..., 135)

func GetCGCS2000_3DegreeByLongitude added in v1.4.3

func GetCGCS2000_3DegreeByLongitude(longitude float64, withZonePrefix bool) (*GDBSpatialReference, error)

GetCGCS2000_3DegreeByLongitude 根据经度自动计算并获取对应的CGCS2000 3度带坐标系 longitude: 经度值 withZonePrefix: 是否使用带带号前缀的坐标系

func GetCGCS2000_3DegreeZone added in v1.4.3

func GetCGCS2000_3DegreeZone(zone int) (*GDBSpatialReference, error)

GetCGCS2000_3DegreeZone 根据带号获取CGCS2000 3度带坐标系 zone: 带号 (25-45)

func GetSHPSpatialReference added in v1.4.8

func GetSHPSpatialReference(shpPath string) (*GDBSpatialReference, error)

GetSHPSpatialReference 读取SHP文件的完整空间参考信息 shpPath: SHP文件路径 返回: GDBSpatialReference结构体, 错误信息

func NewGDBSpatialReferenceFromEPSG added in v1.4.3

func NewGDBSpatialReferenceFromEPSG(epsg int) *GDBSpatialReference

NewGDBSpatialReferenceFromEPSG 根据EPSG代码创建空间参考

func NewGDBSpatialReferenceFromProj4 added in v1.4.3

func NewGDBSpatialReferenceFromProj4(proj4 string, name string) *GDBSpatialReference

NewGDBSpatialReferenceFromProj4 根据Proj4创建空间参考

func NewGDBSpatialReferenceFromWKT added in v1.4.3

func NewGDBSpatialReferenceFromWKT(wkt string, name string) *GDBSpatialReference

NewGDBSpatialReferenceFromWKT 根据WKT创建空间参考

func (*GDBSpatialReference) String added in v1.4.3

func (srs *GDBSpatialReference) String() string

String 返回坐标系的字符串表示

func (*GDBSpatialReference) ToOGRGDBSpatialReference added in v1.4.3

func (srs *GDBSpatialReference) ToOGRGDBSpatialReference() (C.OGRSpatialReferenceH, error)

ToOGRGDBSpatialReference 将GDBSpatialReference转换为GDAL的OGRSpatialReferenceH

type GDBSpatialReferenceType added in v1.4.3

type GDBSpatialReferenceType int
const (
	SRSTypeGeographic GDBSpatialReferenceType = iota // 地理坐标系
	SRSTypeProjected                                 // 投影坐标系
)

type GDBSpatialReferenceWrite added in v1.4.3

type GDBSpatialReferenceWrite struct {
	WKT           string  // WKT字符串
	WKID          int     // 空间参考ID
	LatestWKID    int     // 最新WKID
	XOrigin       float64 // X原点
	YOrigin       float64 // Y原点
	XYScale       float64 // XY比例
	ZOrigin       float64 // Z原点
	ZScale        float64 // Z比例
	MOrigin       float64 // M原点
	MScale        float64 // M比例
	XYTolerance   float64 // XY容差
	ZTolerance    float64 // Z容差
	MTolerance    float64 // M容差
	HighPrecision bool    // 是否高精度
	IsProjected   bool    // 是否为投影坐标系
}

GDBSpatialReferenceWrite 空间参考写入结构

func ConvertGDBSpatialReferenceToWrite added in v1.4.3

func ConvertGDBSpatialReferenceToWrite(srs *GDBSpatialReference) *GDBSpatialReferenceWrite

ConvertGDBSpatialReferenceToWrite 将GDBSpatialReference转换为GDBSpatialReferenceWrite

func NewCGCS2000SpatialReference added in v1.4.3

func NewCGCS2000SpatialReference() *GDBSpatialReferenceWrite

NewCGCS2000SpatialReference 创建CGCS2000地理坐标系空间参考

func NewCGCS2000_3DegreeGK_Zone added in v1.4.3

func NewCGCS2000_3DegreeGK_Zone(zone int) *GDBSpatialReferenceWrite

NewCGCS2000_3DegreeGK_Zone 创建CGCS2000 3度带高斯克吕格投影坐标系 zone: 带号 (如35表示中央经线105度)

func NewCGCS2000_6DegreeGK_Zone added in v1.4.3

func NewCGCS2000_6DegreeGK_Zone(zone int) *GDBSpatialReferenceWrite

NewCGCS2000_6DegreeGK_Zone 创建CGCS2000 6度带高斯克吕格投影坐标系 zone: 带号 (如18表示中央经线105度)

func NewGDBSpatialReferenceWrite added in v1.4.3

func NewGDBSpatialReferenceWrite() *GDBSpatialReferenceWrite

NewGDBSpatialReferenceWrite 创建新的空间参考写入对象

func NewSpatialReferenceFromEPSG added in v1.4.3

func NewSpatialReferenceFromEPSG(epsg int) (*GDBSpatialReferenceWrite, error)

NewSpatialReferenceFromEPSG 从EPSG代码创建空间参考

func NewSpatialReferenceFromWKT added in v1.4.3

func NewSpatialReferenceFromWKT(wkt string) (*GDBSpatialReferenceWrite, error)

NewSpatialReferenceFromWKT 从WKT创建空间参考

func NewUTMSpatialReference added in v1.4.3

func NewUTMSpatialReference(zone int, isNorth bool) *GDBSpatialReferenceWrite

NewUTMSpatialReference 创建UTM投影坐标系空间参考 zone: UTM带号 (1-60) isNorth: 是否为北半球

func NewWGS84SpatialReference added in v1.4.3

func NewWGS84SpatialReference() *GDBSpatialReferenceWrite

NewWGS84SpatialReference 创建WGS84地理坐标系空间参考

func NewWebMercatorSpatialReference added in v1.4.3

func NewWebMercatorSpatialReference() *GDBSpatialReferenceWrite

NewWebMercatorSpatialReference 创建Web墨卡托投影坐标系空间参考

func (*GDBSpatialReferenceWrite) WithIsProjected added in v1.4.3

func (sr *GDBSpatialReferenceWrite) WithIsProjected(isProjected bool) *GDBSpatialReferenceWrite

WithIsProjected 设置是否为投影坐标系

func (*GDBSpatialReferenceWrite) WithMParams added in v1.4.3

func (sr *GDBSpatialReferenceWrite) WithMParams(origin, scale, tolerance float64) *GDBSpatialReferenceWrite

WithMParams 设置M参数

func (*GDBSpatialReferenceWrite) WithOrigin added in v1.4.3

func (sr *GDBSpatialReferenceWrite) WithOrigin(xOrigin, yOrigin float64) *GDBSpatialReferenceWrite

WithOrigin 设置原点

func (*GDBSpatialReferenceWrite) WithWKID added in v1.4.3

WithWKID 设置WKID

func (*GDBSpatialReferenceWrite) WithWKT added in v1.4.3

WithWKT 设置WKT

func (*GDBSpatialReferenceWrite) WithXYScale added in v1.4.3

WithXYScale 设置XY比例

func (*GDBSpatialReferenceWrite) WithXYTolerance added in v1.4.3

func (sr *GDBSpatialReferenceWrite) WithXYTolerance(tolerance float64) *GDBSpatialReferenceWrite

WithXYTolerance 设置XY容差

func (*GDBSpatialReferenceWrite) WithZParams added in v1.4.3

func (sr *GDBSpatialReferenceWrite) WithZParams(origin, scale, tolerance float64) *GDBSpatialReferenceWrite

WithZParams 设置Z参数

type GPFieldInfoEx added in v1.4.2

type GPFieldInfoEx struct {
	Name       string `xml:"Name"`
	AliasName  string `xml:"AliasName"`
	ModelName  string `xml:"ModelName"`
	FieldType  string `xml:"FieldType"`
	IsNullable string `xml:"IsNullable"`
	Length     string `xml:"Length"`
	Precision  string `xml:"Precision"`
	Scale      string `xml:"Scale"`
	Required   string `xml:"Required"`
	Editable   string `xml:"Editable"`
}

GPFieldInfoEx 单个字段信息

type GPFieldInfoExs added in v1.4.2

type GPFieldInfoExs struct {
	GPFieldInfoEx []GPFieldInfoEx `xml:"GPFieldInfoEx"`
}

GPFieldInfoExs 字段信息数组

type GeoJsonLayers

type GeoJsonLayers struct {
	Layer     *geojson.FeatureCollection
	LayerName string
	GeoType   string
}

func GDBToGeoJSON

func GDBToGeoJSON(gdbPath string) ([]GeoJsonLayers, error)

type GeoTiffWriter added in v1.4.15

type GeoTiffWriter struct {
	// contains filtered or unexported fields
}

GeoTiffWriter GeoTIFF写入器

func NewGeoTiffWriter added in v1.4.15

func NewGeoTiffWriter(width, height, bands, tileSize int, geoTransform [6]float64) (*GeoTiffWriter, error)

NewGeoTiffWriter 创建GeoTIFF写入器

func NewGeoTiffWriterWithSRS added in v1.4.17

func NewGeoTiffWriterWithSRS(width, height, bands, tileSize int, geoTransform [6]float64, epsgCode int) (*GeoTiffWriter, error)

func (*GeoTiffWriter) Close added in v1.4.15

func (w *GeoTiffWriter) Close()

Close 关闭写入器

func (*GeoTiffWriter) ExportToFile added in v1.4.15

func (w *GeoTiffWriter) ExportToFile(filename string) error

ExportToFile 导出为GeoTIFF文件

func (*GeoTiffWriter) ExportToMemory added in v1.4.15

func (w *GeoTiffWriter) ExportToMemory() ([]byte, error)

ExportToMemory 导出为内存中的GeoTIFF

func (*GeoTiffWriter) GetDimensions added in v1.4.15

func (w *GeoTiffWriter) GetDimensions() (width, height, bands int)

GetDimensions 获取尺寸

func (*GeoTiffWriter) WriteTile added in v1.4.15

func (w *GeoTiffWriter) WriteTile(tileData []byte, format string, dstX, dstY int) error

WriteTile 写入瓦片到指定位置

type GeomType added in v1.3.14

type GeomType int
const (
	GeomUnknown         GeomType = 0
	GeomPoint           GeomType = 1
	GeomLineString      GeomType = 2
	GeomPolygon         GeomType = 3
	GeomMultiPoint      GeomType = 4
	GeomMultiLineString GeomType = 5
	GeomMultiPolygon    GeomType = 6
	GeomCollection      GeomType = 7
)

type Geometry

type Geometry struct {
	// contains filtered or unexported fields
}

Geometry 表示几何对象的Go包装器

func CreateGeometryFromWKBHex

func CreateGeometryFromWKBHex(wkbHex string) (*Geometry, error)

CreateGeometryFromWKBHex 从十六进制WKB字符串创建几何对象 wkbHex: 十六进制格式的WKB字符串 返回几何对象和可能的错误

func (*Geometry) Destroy

func (geom *Geometry) Destroy()

Destroy 手动销毁几何对象资源

type GeometryPrecisionConfig

type GeometryPrecisionConfig struct {
	GridSize      float64 // 精度网格大小,0表示浮点精度
	PreserveTopo  bool    // 是否保持拓扑结构
	KeepCollapsed bool    // 是否保留折叠的元素
	Enabled       bool    // 是否启用精度设置
}

type GeosAnalysisResult

type GeosAnalysisResult struct {
	OutputLayer *GDALLayer
	ResultCount int
}

GeosAnalysisResult 相交分析结果

func PerformUnionByFields added in v1.5.7

func PerformUnionByFields(inputLayer *GDALLayer,
	precisionConfig *GeometryPrecisionConfig, progressCallback ProgressCallback) (*GeosAnalysisResult, error)

func PerformUnionByFieldsPG added in v1.5.8

func PerformUnionByFieldsPG(inputLayer *GDALLayer,
	precisionConfig *GeometryPrecisionConfig, progressCallback ProgressCallback) (*GeosAnalysisResult, error)

func SpatialClipAnalysis

func SpatialClipAnalysis(inputLayer, methodlayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

SpatialClipAnalysis并行空间裁剪分析

func SpatialClipAnalysisParallelPG added in v1.5.8

func SpatialClipAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

pg版本 SpatialClipAnalysisParallelPG PostgreSQL版本的并行空间裁剪分析

func SpatialEraseAnalysis

func SpatialEraseAnalysis(inputLayer, methodlayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

SpatialEraseAnalysis执行并行空间擦除分析

func SpatialEraseAnalysisParallelPG added in v1.5.8

func SpatialEraseAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

SpatialEraseAnalysisParallelPG PostgreSQL版本的并行空间擦除分析

func SpatialIdentityAnalysis

func SpatialIdentityAnalysis(inputLayer, methodLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

func SpatialIdentityAnalysisParallelPG added in v1.5.8

func SpatialIdentityAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

SpatialIdentityAnalysisParallelPG PostgreSQL版本的并行空间Identity分析

func SpatialIntersectionAnalysis

func SpatialIntersectionAnalysis(inputLayer, methodLayer *GDALLayer, config *ParallelGeosConfig, strategy FieldMergeStrategy) (*GeosAnalysisResult, error)

并行空间相交分析

func SpatialIntersectionAnalysisParallelPG added in v1.5.8

func SpatialIntersectionAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	strategy FieldMergeStrategy,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

func SpatialSymDifferenceAnalysis

func SpatialSymDifferenceAnalysis(inputLayer, methodLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

func SpatialSymDifferenceAnalysisParallelPG added in v1.5.8

func SpatialSymDifferenceAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

PG优化版本的对称差异分析

func SpatialUpdateAnalysis

func SpatialUpdateAnalysis(inputLayer, methodLayer *GDALLayer, config *ParallelGeosConfig) (*GeosAnalysisResult, error)

SpatialUpdateAnalysisParallel 执行并行空间更新分析

func SpatialUpdateAnalysisParallelPG added in v1.5.8

func SpatialUpdateAnalysisParallelPG(
	db *gorm.DB,
	table1, table2 string,
	config *ParallelGeosConfig,
) (*GeosAnalysisResult, error)

PG优化版本的更新分析

func UnionAnalysis

func UnionAnalysis(inputLayer *GDALLayer, groupFields []string, outputTableName string,
	precisionConfig *GeometryPrecisionConfig, progressCallback ProgressCallback) (*GeosAnalysisResult, error)

func UnionByFieldsWithPrecision

func UnionByFieldsWithPrecision(inputLayer *GDALLayer, groupFields []string, outputLayerName string,
	precisionConfig *GeometryPrecisionConfig, progressCallback ProgressCallback) (*GeosAnalysisResult, error)

func (*GeosAnalysisResult) Close

func (ur *GeosAnalysisResult) Close()

func (*GeosAnalysisResult) PrintIntersectionSummary

func (result *GeosAnalysisResult) PrintIntersectionSummary()

打印相交分析摘要

type GroupBin

type GroupBin struct {
	Layer1 string
	Layer2 string
}

type GroupTileFiles

type GroupTileFiles struct {
	Index int
	GPBin GroupBin
	Size  float64
}

func ReadAndGroupBinFiles

func ReadAndGroupBinFiles(uuid string) ([]GroupTileFiles, error)

ReadAndGroupBinFiles 读取layer1和layer2文件夹中的bin文件并按文件名分组

type ImageProcessor added in v1.3.18

type ImageProcessor struct {
	// contains filtered or unexported fields
}

ImageProcessor GDAL图像处理器

func NewImageProcessor added in v1.3.18

func NewImageProcessor(width, height, bands int) (*ImageProcessor, error)

func NewImageProcessorRGB added in v1.4.0

func NewImageProcessorRGB(width, height int) (*ImageProcessor, error)

NewImageProcessorRGB 创建RGB图像处理器(3通道)

func NewImageProcessorRGBA added in v1.4.0

func NewImageProcessorRGBA(width, height int) (*ImageProcessor, error)

NewImageProcessorRGBA 创建RGBA图像处理器(4通道)

func (*ImageProcessor) AddTileFromBuffer added in v1.3.18

func (p *ImageProcessor) AddTileFromBuffer(data []byte, format string, dstX, dstY int) error

func (*ImageProcessor) AddTileFromBufferWithSize added in v1.4.0

func (p *ImageProcessor) AddTileFromBufferWithSize(data []byte, format string,
	srcX, srcY, srcWidth, srcHeight int,
	dstX, dstY int) error

AddTileFromBufferWithSize 从内存缓冲区添加瓦片,支持指定源区域

func (*ImageProcessor) Clear added in v1.4.0

func (p *ImageProcessor) Clear() error

Clear 清空画布(填充透明)

func (*ImageProcessor) Close added in v1.3.18

func (p *ImageProcessor) Close()

func (*ImageProcessor) CropAndExport added in v1.3.18

func (p *ImageProcessor) CropAndExport(cropX, cropY, cropWidth, cropHeight int, format string) ([]byte, error)

func (*ImageProcessor) CropScaleAndExport added in v1.4.1

func (p *ImageProcessor) CropScaleAndExport(
	cropX, cropY, cropWidth, cropHeight int,
	outputWidth, outputHeight int,
	format string,
) ([]byte, error)

CropScaleAndExport 裁剪、缩放并导出

func (*ImageProcessor) Export added in v1.4.0

func (p *ImageProcessor) Export(format string) ([]byte, error)

Export 导出整个画布

func (*ImageProcessor) ExportToFile added in v1.4.0

func (p *ImageProcessor) ExportToFile(filename string, quality int) error

ExportToFile 导出到文件

func (*ImageProcessor) GetDimensions added in v1.4.0

func (p *ImageProcessor) GetDimensions() (width, height, bands int)

GetDimensions 获取画布尺寸

type ImportFieldMapping added in v1.4.2

type ImportFieldMapping struct {
	SourceIndex int
	TargetIndex int
	SourceName  string
	TargetName  string
	SourceType  C.OGRFieldType
	TargetType  C.OGRFieldType
}

ImportFieldMapping 导入字段映射结构

type ImportResult added in v1.4.2

type ImportResult struct {
	TotalCount    int      // 总记录数
	InsertedCount int      // 成功插入数
	FailedCount   int      // 失败数
	SkippedCount  int      // 跳过数
	Errors        []string // 错误信息列表
}

ImportResult 导入结果

func ImportGDALLayerToGDB added in v1.4.2

func ImportGDALLayerToGDB(sourceLayer *GDALLayer, gdbPath string, gdbLayerName string, options *ImportToGDBOptions) (*ImportResult, error)

ImportGDALLayerToGDB 将GDALLayer直接导入到GDB(通用方法) 这个函数可以处理任何来源的GDALLayer,不仅限于PostGIS

func ImportGDALLayerToGDBV2 added in v1.4.3

func ImportGDALLayerToGDBV2(sourceLayer *GDALLayer, gdbPath string, gdbLayerName string, options *ImportToGDBOptionsV2) (*ImportResult, error)

ImportGDALLayerToGDBV2 将GDALLayer直接导入到GDB(支持目标坐标系)

func ImportPostGISToGDB added in v1.4.2

func ImportPostGISToGDB(postGISConfig *PostGISConfig, gdbPath string, gdbLayerName string, options *ImportToGDBOptions) (*ImportResult, error)

ImportPostGISToGDB 将PostGIS数据表导入到GDB文件的指定图层 postGISConfig: PostGIS配置 gdbPath: GDB文件路径 gdbLayerName: GDB目标图层名称 options: 导入选项(可选)

func ImportPostGISToGDBV2 added in v1.4.3

func ImportPostGISToGDBV2(postGISConfig *PostGISConfig, gdbPath string, gdbLayerName string, options *ImportToGDBOptionsV2) (*ImportResult, error)

ImportPostGISToGDBV2 将PostGIS数据表导入到GDB文件的指定图层(支持目标坐标系)

func ImportPostGISToGDBV3 added in v1.4.3

func ImportPostGISToGDBV3(postGISConfig *PostGISConfig, gdbPath string, gdbLayerName string, options *ImportToGDBOptionsV3) (*ImportResult, error)

ImportPostGISToGDBV3 将PostGIS数据表导入到GDB文件(V3版本,支持元数据设置)

func ImportPostGISToGDBV3Auto added in v1.4.3

func ImportPostGISToGDBV3Auto(postGISConfig *PostGISConfig, gdbPath string, layerName string, options *ImportToGDBOptionsV3) (*ImportResult, error)

ImportPostGISToGDBV3Auto 自动处理要素数据集的导入函数

func ImportPostGISToNewGDBLayer added in v1.4.2

func ImportPostGISToNewGDBLayer(postGISConfig *PostGISConfig, gdbPath string, layerName string, options *ImportToGDBOptions) (*ImportResult, error)

ImportPostGISToNewGDBLayer 将PostGIS数据表导入到GDB文件,创建新图层 如果图层已存在,根据选项决定是覆盖还是追加

func ImportPostGISToNewGDBLayerV2 added in v1.4.3

func ImportPostGISToNewGDBLayerV2(postGISConfig *PostGISConfig, gdbPath string, layerName string, options *ImportToGDBOptionsV2) (*ImportResult, error)

===================================================== 优化后的导入函数 ===================================================== ImportPostGISToNewGDBLayerV2 将PostGIS数据表导入到GDB文件,创建新图层(支持目标坐标系)

func ImportPostGISToNewGDBLayerV3 added in v1.4.3

func ImportPostGISToNewGDBLayerV3(postGISConfig *PostGISConfig, gdbPath string, layerName string, options *ImportToGDBOptionsV3) (*ImportResult, error)

ImportPostGISToNewGDBLayerV3 将PostGIS数据表导入到GDB文件,创建新图层(V3版本)

func ImportPostGISToNewGDBLayerV3WithDataset added in v1.4.3

func ImportPostGISToNewGDBLayerV3WithDataset(postGISConfig *PostGISConfig, gdbPath string, layerName string, options *ImportToGDBOptionsV3) (*ImportResult, error)

ImportPostGISToNewGDBLayerV3WithDataset 将PostGIS数据表导入到GDB文件,自动创建要素数据集

type ImportToGDBOptions added in v1.4.2

type ImportToGDBOptions struct {
	GeomField           string            // PostGIS几何字段名(默认"geom")
	BatchSize           int               // 批处理大小(默认1000)
	UseTransaction      bool              // 是否使用事务(默认false)
	StrictMode          bool              // 严格模式,遇到错误立即停止
	SkipInvalidGeometry bool              // 跳过无效几何(默认false)
	ValidateGeometry    bool              // 验证几何有效性(默认false)
	AllowNullGeometry   bool              // 允许空几何(默认false)
	FieldMapping        map[string]string // 字段映射(源字段->目标字段),为空则自动匹配同名字段
	ExcludeFields       []string          // 排除的字段列表
	IncludeFields       []string          // 仅包含的字段列表(优先级高于ExcludeFields)
}

ImportToGDBOptions 导入选项

type ImportToGDBOptionsV2 added in v1.4.3

type ImportToGDBOptionsV2 struct {
	// 基础选项
	GeomField           string            // PostGIS几何字段名(默认"geom")
	BatchSize           int               // 批处理大小(默认1000)
	UseTransaction      bool              // 是否使用事务(默认false)
	StrictMode          bool              // 严格模式,遇到错误立即停止
	SkipInvalidGeometry bool              // 跳过无效几何(默认false)
	ValidateGeometry    bool              // 验证几何有效性(默认false)
	AllowNullGeometry   bool              // 允许空几何(默认false)
	FieldMapping        map[string]string // 字段映射(源字段->目标字段)
	ExcludeFields       []string          // 排除的字段列表
	IncludeFields       []string          // 仅包含的字段列表
	// 坐标系选项(新增)
	TargetSRS        *GDBSpatialReference // 目标坐标系(如果为nil,则使用源坐标系或图层默认坐标系)
	SourceSRS        *GDBSpatialReference // 源坐标系(如果源数据没有坐标系信息时使用)
	ForceTransform   bool                 // 强制进行坐标转换(即使源和目标坐标系相同)
	TransformOptions *TransformOptions    // 坐标转换选项
}

ImportToGDBOptionsV2 导入选项(增强版,支持目标坐标系)

func NewImportToGDBOptionsV2 added in v1.4.3

func NewImportToGDBOptionsV2() *ImportToGDBOptionsV2

NewImportToGDBOptionsV2 创建默认的导入选项

func (*ImportToGDBOptionsV2) WithCGCS2000_3DegreeByCM added in v1.4.3

func (opts *ImportToGDBOptionsV2) WithCGCS2000_3DegreeByCM(centralMeridian int) (*ImportToGDBOptionsV2, error)

WithCGCS2000_3DegreeByCM 设置目标坐标系为CGCS2000 3度带(按中央经线)

func (*ImportToGDBOptionsV2) WithCGCS2000_3DegreeZone added in v1.4.3

func (opts *ImportToGDBOptionsV2) WithCGCS2000_3DegreeZone(zone int) (*ImportToGDBOptionsV2, error)

WithCGCS2000_3DegreeZone 设置目标坐标系为CGCS2000 3度带

func (*ImportToGDBOptionsV2) WithSourceSRS added in v1.4.3

WithSourceSRS 设置源坐标系

func (*ImportToGDBOptionsV2) WithTargetSRS added in v1.4.3

WithTargetSRS 设置目标坐标系

type ImportToGDBOptionsV3 added in v1.4.3

type ImportToGDBOptionsV3 struct {
	ImportToGDBOptionsV2     // 继承V2选项
	LayerPath                string
	LayerAlias               string                    // 图层别名
	FieldAliases             map[string]string         // 字段别名映射
	AutoUpdateMetadata       bool                      // 导入后自动更新元数据
	SpatialReferenceOverride *GDBSpatialReferenceWrite // 空间参考覆盖设置
}

ImportToGDBOptionsV3 导入选项(V3版本,支持元数据设置)

func NewImportToGDBOptionsV3 added in v1.4.3

func NewImportToGDBOptionsV3() *ImportToGDBOptionsV3

NewImportToGDBOptionsV3 创建默认的V3导入选项

func (*ImportToGDBOptionsV3) WithAutoUpdateMetadata added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithAutoUpdateMetadata(auto bool) *ImportToGDBOptionsV3

WithAutoUpdateMetadata 设置是否自动更新元数据

func (*ImportToGDBOptionsV3) WithFieldAlias added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithFieldAlias(fieldName, alias string) *ImportToGDBOptionsV3

WithFieldAlias 添加字段别名

func (*ImportToGDBOptionsV3) WithFieldAliases added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithFieldAliases(aliases map[string]string) *ImportToGDBOptionsV3

WithFieldAliases 批量设置字段别名

func (*ImportToGDBOptionsV3) WithLayerAlias added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithLayerAlias(alias string) *ImportToGDBOptionsV3

WithLayerAlias 设置图层别名

func (*ImportToGDBOptionsV3) WithLayerPath added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithLayerPath(path string) *ImportToGDBOptionsV3

func (*ImportToGDBOptionsV3) WithSpatialReferenceOverride added in v1.4.3

func (opts *ImportToGDBOptionsV3) WithSpatialReferenceOverride(sr *GDBSpatialReferenceWrite) *ImportToGDBOptionsV3

WithSpatialReferenceOverride 设置空间参考覆盖

func (*ImportToGDBOptionsV3) WithTargetSRS added in v1.4.3

WithTargetSRS 设置目标空间参考(继承方法)

type InsertOptions added in v1.3.6

type InsertOptions struct {
	StrictMode          bool // 严格模式,遇到错误立即停止
	SyncInterval        int  // 同步间隔(每插入多少条要素同步一次)
	SkipInvalidGeometry bool // 跳过无效几何
	CreateMissingFields bool // 创建缺失的字段(如果目标图层支持)
}

InsertOptions 插入选项

type LayerAnalysisResult

type LayerAnalysisResult struct {
	LayerName    string
	GeomType     string
	Fields       []FieldAnalysisResult
	Features     []FeatureAnalysisResult
	FeatureCount int
}

LayerAnalysisResult 图层分析结果

type LayerMetadata

type LayerMetadata struct {
	GeometryType int
	SRSWKT       string
	SRSSize      int
	FieldCount   int
}

LayerMetadata 图层元数据

func GetBinaryMetadata

func GetBinaryMetadata(data []byte) (*LayerMetadata, error)

GetBinaryMetadata 获取二进制文件的元数据信息(修复版本)

type LevelsParams added in v1.6.5

type LevelsParams struct {
	InputMin  float64 // 输入最小值
	InputMax  float64 // 输入最大值
	OutputMin float64 // 输出最小值
	OutputMax float64 // 输出最大值
	Midtone   float64 // 中间调 [0.1, 9.9], 1.0为不变
}

LevelsParams 色阶调整参数

type MBTilesGenerator added in v1.2.11

type MBTilesGenerator struct {
	// contains filtered or unexported fields
}

MBTilesGenerator MBTiles生成器

func NewMBTilesGenerator added in v1.2.11

func NewMBTilesGenerator(imagePath string, options *MBTilesOptions) (*MBTilesGenerator, error)

NewMBTilesGenerator 创建MBTiles生成器

func (*MBTilesGenerator) Close added in v1.2.11

func (gen *MBTilesGenerator) Close()

Close 关闭生成器

func (*MBTilesGenerator) EstimateTileCount added in v1.2.11

func (gen *MBTilesGenerator) EstimateTileCount() int

EstimateTileCount 估算瓦片数量

func (*MBTilesGenerator) Generate added in v1.2.11

func (gen *MBTilesGenerator) Generate(outputPath string, metadata map[string]string) error

Generate 生成MBTiles文件

func (*MBTilesGenerator) GenerateTerrainMBTiles added in v1.3.17

func (gen *MBTilesGenerator) GenerateTerrainMBTiles(outputPath string, options *TerrainOptions) error

GenerateTerrainMBTiles 生成Mapbox规范的地形瓦片MBTiles文件 demPath: DEM高程数据文件路径 outputPath: 输出MBTiles文件路径 options: 生成选项

func (*MBTilesGenerator) GenerateWithConcurrency added in v1.2.12

func (gen *MBTilesGenerator) GenerateWithConcurrency(outputPath string, metadata map[string]string, concurrency int) error

GenerateWithConcurrency 并发生成MBTiles文件

func (*MBTilesGenerator) GetBounds added in v1.2.11

func (gen *MBTilesGenerator) GetBounds() (minLon, minLat, maxLon, maxLat float64)

GetBounds 获取边界(经纬度)

func (*MBTilesGenerator) GetDatasetInfo added in v1.2.11

func (gen *MBTilesGenerator) GetDatasetInfo() DatasetInfo

GetDatasetInfo 获取数据集信息

type MBTilesOptions added in v1.2.11

type MBTilesOptions struct {
	TileSize int               // 瓦片大小,默认256
	MinZoom  int               // 最小缩放级别,默认0
	MaxZoom  int               // 最大缩放级别,默认18
	Metadata map[string]string // 自定义元数据

	Concurrency      int              // 并发数,默认为CPU核心数
	ProgressCallback ProgressCallback // 进度回调函数
	BatchSize        int              // 批量插入大小,默认1000
}

MBTilesOptions MBTiles生成选项

type MosaicBatchConfig added in v1.6.5

type MosaicBatchConfig struct {
	InputGroups  [][]string     // 输入文件组
	OutputPaths  []string       // 输出路径
	OutputFormat string         // 输出格式
	Options      *MosaicOptions // 镶嵌选项
	MaxParallel  int            // 最大并行数
}

MosaicBatchConfig 批量镶嵌配置

type MosaicBatchResult added in v1.6.5

type MosaicBatchResult struct {
	OutputPath string
	Error      error
}

MosaicBatch 批量镶嵌结果

func MosaicBatch added in v1.6.5

func MosaicBatch(config *MosaicBatchConfig) []MosaicBatchResult

MosaicBatch 批量执行镶嵌

type MosaicInfo added in v1.6.5

type MosaicInfo struct {
	MinX, MinY, MaxX, MaxY float64
	ResX, ResY             float64
	Width, Height          int
	BandCount              int
	DataType               string
	Projection             string
}

MosaicInfo 镶嵌信息

func GetMosaicInfo added in v1.6.5

func GetMosaicInfo(datasets []*RasterDataset, options *MosaicOptions) (*MosaicInfo, error)

GetMosaicInfo 获取镶嵌预览信息(不执行实际镶嵌)

type MosaicOptions added in v1.6.5

type MosaicOptions struct {
	ForceBandMatch bool           // 强制波段匹配(删除多余波段)
	ResampleMethod ResampleMethod // 重采样方法
	NoDataValue    float64        // 输出NoData值
	HasNoData      bool           // 是否设置NoData
	NumThreads     int            // 并行线程数,0表示自动
}

MosaicOptions 镶嵌选项

func DefaultMosaicOptions added in v1.6.5

func DefaultMosaicOptions() *MosaicOptions

DefaultMosaicOptions 默认镶嵌选项

type OptimizedTileProcessor

type OptimizedTileProcessor struct {
	// contains filtered or unexported fields
}

OptimizedTileProcessor 优化的瓦片处理器

func NewOptimizedTileProcessor

func NewOptimizedTileProcessor(sourceLayer *GDALLayer, tiles []*TileInfo, config *TileProcessingConfig) (*OptimizedTileProcessor, error)

NewOptimizedTileProcessor 创建优化的瓦片处理器

func (*OptimizedTileProcessor) Cleanup

func (p *OptimizedTileProcessor) Cleanup()

Cleanup 清理资源

func (*OptimizedTileProcessor) GroupAndExportByTiles

func (p *OptimizedTileProcessor) GroupAndExportByTiles(outputDir string) ([]*TileClipResultM, error)

GroupAndExportByTiles 使用优化的方法按瓦片分组并导出为bin文件

type PGConfig

type PGConfig struct {
	XMLName  xml.Name `xml:"config"`
	Dbname   string   `xml:"dbname"`
	Host     string   `xml:"host"`
	Port     string   `xml:"port"`
	Username string   `xml:"user"`
	Password string   `xml:"password"`
}
var MainConfig PGConfig

type PaletteEntry added in v1.6.5

type PaletteEntry struct {
	C1 int16 // Red or Gray
	C2 int16 // Green
	C3 int16 // Blue
	C4 int16 // Alpha
}

PaletteEntry 调色板条目

type PaletteInfo added in v1.6.5

type PaletteInfo struct {
	EntryCount int
	InterpType PaletteInterpretation
	Entries    []PaletteEntry
}

PaletteInfo 调色板信息

type PaletteInterpretation added in v1.6.5

type PaletteInterpretation int

PaletteInterpretation 调色板解释类型

type ParallelGeosConfig

type ParallelGeosConfig struct {
	TileCount  int // 分块数量 (N*N)
	MaxWorkers int // 最大工作协程数

	IsMergeTile      bool                     // 是否合并瓦片
	ProgressCallback ProgressCallback         // 进度回调
	PrecisionConfig  *GeometryPrecisionConfig // 几何精度配置
}

ParallelGeosConfig 并行相交分析配置

type PostGISConfig

type PostGISConfig struct {
	Host     string
	Port     string
	Database string
	User     string
	Password string
	Schema   string
	Table    string
}

PostGISConfig PostGIS连接配置

type PostGISFieldInfo

type PostGISFieldInfo struct {
	Name         string
	Type         string
	Width        int
	Precision    int
	IsNullable   bool
	DefaultValue *string
	IsPrimaryKey bool
	IsGeometry   bool
	GeometryType string // POINT, LINESTRING, POLYGON等
	SRID         int
}

PostGISFieldInfo 字段信息

type PostGISLayer

type PostGISLayer struct {
	LayerName string
	Records   []PostGISRecord
	Fields    []PostGISFieldInfo
}

PostGISLayer 表示PostGIS图层数据

type PostGISReader

type PostGISReader struct {
	// contains filtered or unexported fields
}

PostGISReader PostGIS读取器

func MakePGReader

func MakePGReader(table string) *PostGISReader

func NewPostGISReader

func NewPostGISReader(config *PostGISConfig) *PostGISReader

NewPostGISReader 创建新的PostGIS读取器

func (*PostGISReader) ReadGeometryTable

func (r *PostGISReader) ReadGeometryTable() (*GDALLayer, error)

ReadGeometryTable 读取PostGIS几何表数据

type PostGISReaderFiltered added in v1.4.2

type PostGISReaderFiltered struct {
	// contains filtered or unexported fields
}

PostGISReaderFiltered 带过滤条件的PostGIS读取器

func (*PostGISReaderFiltered) ReadGeometryTable added in v1.4.2

func (r *PostGISReaderFiltered) ReadGeometryTable() (*GDALLayer, error)

ReadGeometryTable 读取带过滤条件的几何表

type PostGISRecord

type PostGISRecord struct {
	Properties map[string]interface{}
	WKBHex     string // 几何数据的WKB十六进制表示
}

PostGISRecord 表示从PostGIS查询得到的记录

type PriorityMosaicOptions added in v1.6.5

type PriorityMosaicOptions struct {
	MosaicOptions
	Priorities []int // 每个数据集的优先级,数值越大优先级越高
}

MosaicWithPriority 带优先级的镶嵌

type ProgressCallback

type ProgressCallback func(complete float64, message string) bool

ProgressCallback 进度回调函数类型 返回值:true继续执行,false取消执行

type ProgressData

type ProgressData struct {
	// contains filtered or unexported fields
}

ProgressData 进度数据结构,用于在C和Go之间传递信息

type RasterDataset added in v1.2.11

type RasterDataset struct {
	// contains filtered or unexported fields
}

RasterDataset 栅格数据集

func BatchColorBalance added in v1.6.5

func BatchColorBalance(datasets []*RasterDataset, refDS *RasterDataset, params *ColorBalanceParams) ([]*RasterDataset, error)

BatchColorBalance 批量匀色

func MosaicDatasets added in v1.6.5

func MosaicDatasets(datasets []*RasterDataset, options *MosaicOptions) (*RasterDataset, error)

MosaicDatasets 镶嵌多个栅格数据集

func MosaicDatasetsWithPriority added in v1.6.5

func MosaicDatasetsWithPriority(datasets []*RasterDataset, options *PriorityMosaicOptions) (*RasterDataset, error)

MosaicDatasetsWithPriority 按优先级镶嵌

func MosaicFiles added in v1.6.5

func MosaicFiles(filePaths []string, options *MosaicOptions) (*RasterDataset, error)

MosaicFiles 从文件路径镶嵌多个栅格

func OpenRasterDataset added in v1.2.11

func OpenRasterDataset(imagePath string, reProj bool) (*RasterDataset, error)

imagePath: 影像文件路径

func (*RasterDataset) AddBand added in v1.6.5

func (rd *RasterDataset) AddBand(dataType BandDataType, colorInterp ColorInterpretation, noDataValue float64, persist bool) error

func (*RasterDataset) AdjustBrightness added in v1.6.5

func (rd *RasterDataset) AdjustBrightness(brightness float64) (*RasterDataset, error)

AdjustBrightness 调整亮度

func (*RasterDataset) AdjustColors added in v1.6.5

func (rd *RasterDataset) AdjustColors(params *ColorAdjustParams) (*RasterDataset, error)

AdjustColors 综合调色

func (*RasterDataset) AdjustContrast added in v1.6.5

func (rd *RasterDataset) AdjustContrast(contrast float64) (*RasterDataset, error)

AdjustContrast 调整对比度

func (*RasterDataset) AdjustCurves added in v1.6.5

func (rd *RasterDataset) AdjustCurves(params *CurveParams) (*RasterDataset, error)

AdjustCurves 曲线调整

func (*RasterDataset) AdjustGamma added in v1.6.5

func (rd *RasterDataset) AdjustGamma(gamma float64) (*RasterDataset, error)

AdjustGamma Gamma校正

func (*RasterDataset) AdjustHue added in v1.6.5

func (rd *RasterDataset) AdjustHue(hue float64) (*RasterDataset, error)

AdjustHue 调整色相

func (*RasterDataset) AdjustLevels added in v1.6.5

func (rd *RasterDataset) AdjustLevels(params *LevelsParams, bandIndex int) (*RasterDataset, error)

AdjustLevels 色阶调整

func (*RasterDataset) AdjustSaturation added in v1.6.5

func (rd *RasterDataset) AdjustSaturation(saturation float64) (*RasterDataset, error)

AdjustSaturation 调整饱和度

func (*RasterDataset) ApplyBandOperations added in v1.6.5

func (rd *RasterDataset) ApplyBandOperations(operations []BandOperation, persist bool) error

ApplyBandOperations 批量应用波段操作

func (*RasterDataset) ApplyFilter added in v1.6.5

func (rd *RasterDataset) ApplyFilter(bandIndex int, filterType FilterType, kernelSize int) ([]float64, error)

ApplyFilter 应用滤波器到波段

func (*RasterDataset) ApplyMask added in v1.6.5

func (rd *RasterDataset) ApplyMask(bandIndex int, mask []bool, noDataValue float64) error

ApplyMask 应用掩膜到波段

func (*RasterDataset) AutoColorBalance added in v1.6.5

func (rd *RasterDataset) AutoColorBalance(refDS *RasterDataset) (*RasterDataset, error)

AutoColorBalance 自动匀色(基于参考图像)

func (*RasterDataset) AutoContrast added in v1.6.5

func (rd *RasterDataset) AutoContrast() (*RasterDataset, error)

AutoContrast 自动对比度

func (*RasterDataset) AutoLevels added in v1.6.5

func (rd *RasterDataset) AutoLevels(clipPercent float64) (*RasterDataset, error)

AutoLevels 自动色阶

func (*RasterDataset) AutoWhiteBalance added in v1.6.5

func (rd *RasterDataset) AutoWhiteBalance() (*RasterDataset, error)

AutoWhiteBalance 自动白平衡

func (*RasterDataset) BandMath added in v1.6.5

func (rd *RasterDataset) BandMath(band1, band2 int, op BandMathOp) ([]float64, error)

BandMath 对两个波段进行数学运算

func (*RasterDataset) BandMathScalar added in v1.6.5

func (rd *RasterDataset) BandMathScalar(bandIndex int, scalar float64, op BandMathOp) ([]float64, error)

BandMathScalar 波段与标量运算

func (*RasterDataset) BuildOverviews added in v1.6.12

func (rd *RasterDataset) BuildOverviews(levels []int, resampling ResampleOverview) error

BuildOverviews 构建金字塔(自定义层级) levels: 缩放因子数组,如 []int{2, 4, 8, 16, 32} resampling: 重采样方法

func (*RasterDataset) BuildOverviewsAuto added in v1.6.12

func (rd *RasterDataset) BuildOverviewsAuto(resampling ResampleOverview) error

BuildOverviewsAuto 自动构建金字塔(自动计算合适的层级) resampling: 重采样方法,传空则默认 NEAREST

func (*RasterDataset) CLAHEEqualization added in v1.6.5

func (rd *RasterDataset) CLAHEEqualization(tileSize int, clipLimit float64) (*RasterDataset, error)

CLAHEEqualization CLAHE均衡化

func (*RasterDataset) CalculateEVI added in v1.6.5

func (rd *RasterDataset) CalculateEVI(nirBand, redBand, blueBand int) ([]float64, error)

CalculateEVI 计算增强植被指数 EVI = 2.5 * (NIR - Red) / (NIR + 6*Red - 7.5*Blue + 1)

func (*RasterDataset) CalculateNDVI added in v1.6.5

func (rd *RasterDataset) CalculateNDVI(nirBand, redBand int) ([]float64, error)

CalculateNDVI 计算归一化植被指数 NDVI = (NIR - Red) / (NIR + Red)

func (*RasterDataset) CalculateNDWI added in v1.6.5

func (rd *RasterDataset) CalculateNDWI(greenBand, nirBand int) ([]float64, error)

CalculateNDWI 计算归一化水体指数 NDWI = (Green - NIR) / (Green + NIR)

func (*RasterDataset) ClipPixelRasterByLayerByte added in v1.3.2

func (rd *RasterDataset) ClipPixelRasterByLayerByte(layer *GDALLayer, options *ClipOptions) ([]ClipResultByte, error)

ClipPixelRasterByLayerByte 使用矢量图层裁剪像素坐标系栅格数据并返回二进制数据 此方法不使用gdalwarp,而是将矢量栅格化为掩膜后进行裁剪

func (*RasterDataset) ClipRasterByLayer added in v1.3.0

func (rd *RasterDataset) ClipRasterByLayer(layer *GDALLayer, options *ClipOptions) ([]ClipResult, error)

ClipRasterByLayer 使用矢量图层裁剪栅格数据

func (*RasterDataset) ClipRasterByLayerByte added in v1.3.0

func (rd *RasterDataset) ClipRasterByLayerByte(layer *GDALLayer, options *ClipOptions) ([]ClipResultByte, error)

ClipRasterByLayerByte 使用矢量图层裁剪栅格数据并返回二进制数据

func (*RasterDataset) Close added in v1.2.11

func (rd *RasterDataset) Close()

Close 关闭数据集

func (*RasterDataset) ColorBalance added in v1.6.5

func (rd *RasterDataset) ColorBalance(refDS *RasterDataset, params *ColorBalanceParams) (*RasterDataset, error)

ColorBalance 通用匀色接口

func (*RasterDataset) ColorCorrection added in v1.6.5

func (rd *RasterDataset) ColorCorrection(grayPointR, grayPointG, grayPointB float64) (*RasterDataset, error)

ColorCorrection 色彩校正(基于灰点)

func (*RasterDataset) ComputeBandStatistics added in v1.6.5

func (rd *RasterDataset) ComputeBandStatistics(bandIndex int, approxOK bool) (*BandStatistics, error)

ComputeBandStatistics 计算波段统计信息

func (*RasterDataset) ConvertBandDataType added in v1.6.5

func (rd *RasterDataset) ConvertBandDataType(bandIndex int, newType BandDataType, persist bool) error

func (*RasterDataset) CopyBandData added in v1.6.5

func (rd *RasterDataset) CopyBandData(srcBandIndex int, dstDataset *RasterDataset, dstBandIndex int, persist bool) error

func (*RasterDataset) CreateMaskFromNoData added in v1.6.5

func (rd *RasterDataset) CreateMaskFromNoData(bandIndex int) ([]bool, error)

CreateMaskFromNoData 从NoData值创建掩膜

func (*RasterDataset) CreateMaskFromThreshold added in v1.6.5

func (rd *RasterDataset) CreateMaskFromThreshold(bandIndex int, minVal, maxVal float64) ([]bool, error)

CreateMaskFromThreshold 从阈值创建掩膜

func (*RasterDataset) CreateSingleBandDataset added in v1.6.6

func (rd *RasterDataset) CreateSingleBandDataset(data []float64, dataType BandDataType) (*RasterDataset, error)

CreateSingleBandDataset 从计算结果创建单波段内存数据集

func (*RasterDataset) DefineProjection added in v1.6.5

func (rd *RasterDataset) DefineProjection(epsgCode int) error

DefineProjection 直接为栅格数据定义投影(修改原数据) epsgCode: EPSG代码 注意:此操作会直接修改原数据文件

func (*RasterDataset) DefineProjectionToMemory added in v1.6.5

func (rd *RasterDataset) DefineProjectionToMemory(epsgCode int) (*RasterDataset, error)

DefineProjectionToMemory 为栅格数据定义投影(创建内存副本) 用于没有坐标系的栅格数据,定义其投影后返回内存副本 返回的数据集支持ExportToFile导出

func (*RasterDataset) DefineProjectionWithGeoTransform added in v1.6.5

func (rd *RasterDataset) DefineProjectionWithGeoTransform(epsgCode int, geoTransform [6]float64) error

DefineProjectionWithGeoTransform 直接为栅格数据定义投影和地理变换 epsgCode: EPSG代码 geoTransform: 地理变换参数 [originX, pixelWidth, rotationX, originY, rotationY, pixelHeight] 注意:此操作会直接修改原数据文件

func (*RasterDataset) DefineProjectionWithWKT added in v1.6.5

func (rd *RasterDataset) DefineProjectionWithWKT(wkt string) error

DefineProjectionWithWKT 直接为栅格数据定义投影(使用自定义WKT) wkt: WKT投影定义 注意:此操作会直接修改原数据文件

func (*RasterDataset) DeleteBandColorTable added in v1.6.5

func (rd *RasterDataset) DeleteBandColorTable(bandIndex int, persist bool) error

DeleteBandColorTable 删除波段调色板

func (*RasterDataset) DeleteBandNoDataValue added in v1.6.5

func (rd *RasterDataset) DeleteBandNoDataValue(bandIndex int, persist bool) error

func (*RasterDataset) DodgingBalance added in v1.6.5

func (rd *RasterDataset) DodgingBalance(blockSize int, strength float64) (*RasterDataset, error)

DodgingBalance Dodging匀光

func (*RasterDataset) EstimateResampleSize added in v1.6.6

func (rd *RasterDataset) EstimateResampleSize(options *ResampleOptions) (int64, error)

EstimateResampleSize 估算重采样结果大小(字节)

func (*RasterDataset) ExportBandToFile added in v1.6.5

func (rd *RasterDataset) ExportBandToFile(bandIndex int, outputPath, format string) error

ExportBandToFile 导出波段到文件

func (*RasterDataset) ExportToFile added in v1.6.5

func (rd *RasterDataset) ExportToFile(outputPath, format string, options map[string]string) error

func (*RasterDataset) ExportWithColorAdjust added in v1.6.5

func (rd *RasterDataset) ExportWithColorAdjust(outputPath string, format string, params *ColorAdjustParams) error

ExportWithColorAdjust 导出时应用调色

func (*RasterDataset) GetActiveDataset added in v1.3.0

func (rd *RasterDataset) GetActiveDataset() C.GDALDatasetH

func (*RasterDataset) GetAllBandMetadata added in v1.6.5

func (rd *RasterDataset) GetAllBandMetadata(bandIndex int) (map[string]string, error)

GetAllBandMetadata 获取波段所有元数据

func (*RasterDataset) GetAllBandsInfo added in v1.6.5

func (rd *RasterDataset) GetAllBandsInfo() ([]BandInfo, error)

GetAllBandsInfo 获取所有波段信息

func (*RasterDataset) GetBandCount added in v1.6.5

func (rd *RasterDataset) GetBandCount() int

GetBandCount 获取波段数量

func (*RasterDataset) GetBandDescription added in v1.6.5

func (rd *RasterDataset) GetBandDescription(bandIndex int) (string, error)

GetBandDescription 获取波段描述

func (*RasterDataset) GetBandHistogram added in v1.6.5

func (rd *RasterDataset) GetBandHistogram(bandIndex int, buckets int, min, max float64) ([]uint64, error)

GetBandHistogram 获取波段直方图

func (*RasterDataset) GetBandInfo added in v1.6.5

func (rd *RasterDataset) GetBandInfo(bandIndex int) (*BandInfo, error)

GetBandInfo 获取指定波段信息

func (*RasterDataset) GetBandMetadata added in v1.6.5

func (rd *RasterDataset) GetBandMetadata(bandIndex int, key string) (string, error)

GetBandMetadata 获取波段元数据

func (*RasterDataset) GetBandOffset added in v1.6.5

func (rd *RasterDataset) GetBandOffset(bandIndex int) (float64, error)

GetBandOffset 获取波段偏移量

func (*RasterDataset) GetBandScale added in v1.6.5

func (rd *RasterDataset) GetBandScale(bandIndex int) (float64, error)

GetBandScale 获取波段缩放因子

func (*RasterDataset) GetBandStatistics added in v1.6.5

func (rd *RasterDataset) GetBandStatistics(bandIndex int, region *ReferenceRegion) (*BandMetaStatistics, error)

GetBandStatistics 获取波段统计信息

func (*RasterDataset) GetBandUnitType added in v1.6.5

func (rd *RasterDataset) GetBandUnitType(bandIndex int) (string, error)

GetBandUnitType 获取波段单位类型

func (*RasterDataset) GetBounds added in v1.2.11

func (rd *RasterDataset) GetBounds() (minX, minY, maxX, maxY float64)

GetBounds 获取边界(Web墨卡托坐标)

func (*RasterDataset) GetBoundsLatLon added in v1.2.11

func (rd *RasterDataset) GetBoundsLatLon() (minLon, minLat, maxLon, maxLat float64)

GetBoundsLatLon 获取边界(经纬度)

func (*RasterDataset) GetColorStatistics added in v1.6.5

func (rd *RasterDataset) GetColorStatistics(region *ReferenceRegion) (*ColorStatistics, error)

GetColorStatistics 获取颜色统计信息

func (*RasterDataset) GetEPSGCode added in v1.6.8

func (rd *RasterDataset) GetEPSGCode() int

GetEPSGCode 获取栅格数据的EPSG代码 如果无法获取或没有投影信息,返回0

func (*RasterDataset) GetHeight added in v1.6.5

func (rd *RasterDataset) GetHeight() int

GetHeight 获取数据集高度(像素)

func (*RasterDataset) GetInfo added in v1.2.11

func (rd *RasterDataset) GetInfo() DatasetInfo

GetInfo 获取数据集信息

func (*RasterDataset) GetOverviewCount added in v1.6.12

func (rd *RasterDataset) GetOverviewCount() int

GetOverviewCount 获取金字塔层级数

func (*RasterDataset) GetPaletteInfo added in v1.6.5

func (rd *RasterDataset) GetPaletteInfo(bandIndex int) (*PaletteInfo, error)

GetPaletteInfo 获取调色板信息

func (*RasterDataset) GetProjection added in v1.6.5

func (rd *RasterDataset) GetProjection() string

func (*RasterDataset) GetResampleInfo added in v1.6.6

func (rd *RasterDataset) GetResampleInfo(options *ResampleOptions) (*ResampleInfo, error)

GetResampleInfo 获取重采样预览信息(不执行实际重采样)

func (*RasterDataset) GetTileRange added in v1.2.11

func (rd *RasterDataset) GetTileRange(zoom int) (minTileX, minTileY, maxTileX, maxTileY int)

GetTileRange 获取指定缩放级别的瓦片范围(符合Mapbox规范)

func (*RasterDataset) GetWidth added in v1.6.5

func (rd *RasterDataset) GetWidth() int

func (*RasterDataset) GradientBlend added in v1.6.5

func (rd *RasterDataset) GradientBlend(ds2 *RasterDataset, overlapRegion *ReferenceRegion, blendWidth int) (*RasterDataset, error)

GradientBlend 渐变融合

func (*RasterDataset) HasOverviews added in v1.6.12

func (rd *RasterDataset) HasOverviews() bool

HasOverviews 检查是否已有金字塔

func (*RasterDataset) HistogramEqualization added in v1.6.5

func (rd *RasterDataset) HistogramEqualization(bandIndex int) (*RasterDataset, error)

HistogramEqualization 直方图均衡化

func (*RasterDataset) HistogramMatch added in v1.6.5

func (rd *RasterDataset) HistogramMatch(refDS *RasterDataset, srcRegion, refRegion *ReferenceRegion) (*RasterDataset, error)

HistogramMatch 直方图匹配

func (*RasterDataset) LinearRegressionBalance added in v1.6.5

func (rd *RasterDataset) LinearRegressionBalance(refDS *RasterDataset, overlapRegion *ReferenceRegion) (*RasterDataset, error)

LinearRegressionBalance 线性回归匀色

func (*RasterDataset) LocalContrastEnhancement added in v1.6.5

func (rd *RasterDataset) LocalContrastEnhancement(tileSize int, clipLimit float64) (*RasterDataset, error)

LocalContrastEnhancement 局部对比度增强

func (*RasterDataset) MeanStdMatch added in v1.6.5

func (rd *RasterDataset) MeanStdMatch(targetStats *ColorStatistics, region *ReferenceRegion, strength float64) (*RasterDataset, error)

MeanStdMatch 均值-标准差匹配

func (*RasterDataset) MergeBandsToNewDataset added in v1.6.5

func (rd *RasterDataset) MergeBandsToNewDataset(bandIndices []int) (*RasterDataset, error)

MergeBandsToNewDataset 合并多个波段到新数据集

func (*RasterDataset) ModifyPaletteEntry added in v1.6.5

func (rd *RasterDataset) ModifyPaletteEntry(bandIndex, entryIndex int, r, g, b, a int16, persist bool) error

ModifyPaletteEntry 修改调色板条目

func (*RasterDataset) MomentMatch added in v1.6.5

func (rd *RasterDataset) MomentMatch(refDS *RasterDataset, srcRegion, refRegion *ReferenceRegion) (*RasterDataset, error)

MomentMatch 矩匹配

func (*RasterDataset) NewBandCalculator added in v1.6.5

func (rd *RasterDataset) NewBandCalculator() *BandCalculator

NewBandCalculator 创建波段计算器

func (*RasterDataset) NewBlockCalculator added in v1.6.5

func (rd *RasterDataset) NewBlockCalculator(expression string, blockWidth, blockHeight int) (*BlockCalculator, error)

NewBlockCalculator 创建分块计算器

func (*RasterDataset) NewColorPipeline added in v1.6.5

func (rd *RasterDataset) NewColorPipeline() *ColorPipeline

NewColorPipeline 创建调色管道

func (*RasterDataset) NormalizeBand added in v1.6.5

func (rd *RasterDataset) NormalizeBand(bandIndex int, newMin, newMax float64) ([]float64, error)

NormalizeBand 归一化波段数据到指定范围

func (*RasterDataset) PaletteToRGB added in v1.6.5

func (rd *RasterDataset) PaletteToRGB() (*RasterDataset, error)

PaletteToRGB 将调色板图像转换为RGB图像

func (*RasterDataset) PresetBlackWhite added in v1.6.5

func (rd *RasterDataset) PresetBlackWhite() (*RasterDataset, error)

PresetBlackWhite 黑白预设

func (*RasterDataset) PresetCool added in v1.6.5

func (rd *RasterDataset) PresetCool() (*RasterDataset, error)

PresetCool 冷色调预设

func (*RasterDataset) PresetHighContrast added in v1.6.5

func (rd *RasterDataset) PresetHighContrast() (*RasterDataset, error)

PresetHighContrast 高对比度预设

func (*RasterDataset) PresetSepia added in v1.6.5

func (rd *RasterDataset) PresetSepia() (*RasterDataset, error)

PresetSepia 复古棕褐色预设

func (*RasterDataset) PresetSoft added in v1.6.5

func (rd *RasterDataset) PresetSoft() (*RasterDataset, error)

PresetSoft 柔和预设

func (*RasterDataset) PresetVivid added in v1.6.5

func (rd *RasterDataset) PresetVivid() (*RasterDataset, error)

PresetVivid 鲜艳预设

func (*RasterDataset) PresetWarm added in v1.6.5

func (rd *RasterDataset) PresetWarm() (*RasterDataset, error)

PresetWarm 暖色调预设

func (*RasterDataset) RGBToPalette added in v1.6.5

func (rd *RasterDataset) RGBToPalette(colorCount int) (*RasterDataset, error)

RGBToPalette 将RGB图像转换为调色板图像

func (*RasterDataset) ReadBandData added in v1.6.5

func (rd *RasterDataset) ReadBandData(bandIndex int) ([]float64, error)

ReadBandData 读取波段数据为float64数组

func (*RasterDataset) ReadBandDataRect added in v1.6.5

func (rd *RasterDataset) ReadBandDataRect(bandIndex, x, y, width, height int) ([]float64, error)

ReadBandDataRect 读取波段矩形区域数据

func (*RasterDataset) ReadTile added in v1.2.11

func (rd *RasterDataset) ReadTile(zoom, x, y, tileSize int) ([]byte, error)

ReadTile 读取瓦片数据(黑色背景转透明)

func (*RasterDataset) ReadTileRaw added in v1.3.17

func (rd *RasterDataset) ReadTileRaw(zoom, x, y, tileSize int) ([]float32, error)

ReadTileRaw 读取瓦片原始高程数据(返回float32数组,用于地形处理)

func (*RasterDataset) ReadTileRawWithNoData added in v1.3.17

func (rd *RasterDataset) ReadTileRawWithNoData(zoom, x, y, tileSize int) ([]float32, float32, error)

ReadTileRawWithNoData 读取瓦片原始高程数据,同时返回NoData值

func (*RasterDataset) ReclassifyBand added in v1.6.5

func (rd *RasterDataset) ReclassifyBand(bandIndex int, rules []ReclassifyRule, defaultValue float64) ([]float64, error)

ReclassifyBand 重分类波段

func (*RasterDataset) RemoveBand added in v1.6.5

func (rd *RasterDataset) RemoveBand(bandIndex int, persist bool) error

func (*RasterDataset) RemoveOverviews added in v1.6.12

func (rd *RasterDataset) RemoveOverviews() error

RemoveOverviews 删除金字塔

func (*RasterDataset) ReorderBands added in v1.6.5

func (rd *RasterDataset) ReorderBands(bandOrder []int, persist bool) error

func (*RasterDataset) ReprojectToEPSG added in v1.6.5

func (rd *RasterDataset) ReprojectToEPSG(srcEPSG, dstEPSG int, outputPath, format string, resampleMethod ResampleMethod) error

ReprojectToEPSG 将栅格数据重投影到指定的EPSG坐标系 srcEPSG: 源EPSG代码 dstEPSG: 目标EPSG代码 outputPath: 输出文件路径 format: 输出格式(如"GTiff"、"JP2OpenJPEG"等) resampleMethod: 重采样方法

func (*RasterDataset) ReprojectWithAffineParams added in v1.6.5

func (rd *RasterDataset) ReprojectWithAffineParams(srcEPSG int, params *AffineParams,
	paramType, outputPath, format string, resampleMethod ResampleMethod, mode string) error

ReprojectWithAffineParams 使用仿射参数进行重投影 mode: "geotransform" - 只修改地理变换(快速,不改变像素)

"resample" - 重采样(慢,像素会旋转/缩放)

func (*RasterDataset) ReprojectWithCustomWKT added in v1.6.5

func (rd *RasterDataset) ReprojectWithCustomWKT(srcEPSG int, customWKT, outputPath, format string, resampleMethod ResampleMethod) error

ReprojectWithCustomWKT 使用自定义WKT投影定义进行重投影 srcEPSG: 源EPSG代码 customWKT: 自定义WKT投影定义 outputPath: 输出文件路径 format: 输出格式 resampleMethod: 重采样方法

func (*RasterDataset) Resample added in v1.6.6

func (rd *RasterDataset) Resample(options *ResampleOptions) (*RasterDataset, error)

Resample 对栅格数据集进行重采样

func (*RasterDataset) ResampleByFactor added in v1.6.6

func (rd *RasterDataset) ResampleByFactor(factor float64, method ResampleMethod) (*RasterDataset, error)

ResampleByFactor 按缩放因子重采样

func (*RasterDataset) ResampleToFile added in v1.6.6

func (rd *RasterDataset) ResampleToFile(outputPath string, format string, options *ResampleOptions) error

ResampleToFile 重采样并保存到文件

func (*RasterDataset) ResampleToResolution added in v1.6.6

func (rd *RasterDataset) ResampleToResolution(resX, resY float64, method ResampleMethod) (*RasterDataset, error)

ResampleToResolution 重采样到指定分辨率

func (*RasterDataset) ResampleToSize added in v1.6.6

func (rd *RasterDataset) ResampleToSize(width, height int, method ResampleMethod) (*RasterDataset, error)

ResampleToSize 重采样到指定尺寸

func (*RasterDataset) SCurveContrast added in v1.6.5

func (rd *RasterDataset) SCurveContrast(strength float64) (*RasterDataset, error)

SCurveContrast S曲线对比度增强

func (*RasterDataset) SaveAsGeoTIFF added in v1.6.10

func (rd *RasterDataset) SaveAsGeoTIFF(filePath string, compress string) error

SaveAsGeoTIFF 快捷方法:导出为GeoTIFF compress: 压缩方式 "LZW", "DEFLATE", "ZSTD", "NONE" 等

func (*RasterDataset) SetBandColorInterpretation added in v1.6.5

func (rd *RasterDataset) SetBandColorInterpretation(bandIndex int, colorInterp ColorInterpretation, persist bool) error

func (*RasterDataset) SetBandColorTable added in v1.6.5

func (rd *RasterDataset) SetBandColorTable(bandIndex int, colorTable *ColorTable, persist bool) error

SetBandColorTable 设置波段调色板

func (*RasterDataset) SetBandDescription added in v1.6.5

func (rd *RasterDataset) SetBandDescription(bandIndex int, description string) error

SetBandDescription 设置波段描述

func (*RasterDataset) SetBandMetadata added in v1.6.5

func (rd *RasterDataset) SetBandMetadata(bandIndex int, key, value string) error

SetBandMetadata 设置波段元数据

func (*RasterDataset) SetBandNoDataValue added in v1.6.5

func (rd *RasterDataset) SetBandNoDataValue(bandIndex int, noDataValue float64, persist bool) error

func (*RasterDataset) SetBandOffset added in v1.6.5

func (rd *RasterDataset) SetBandOffset(bandIndex int, offset float64) error

SetBandOffset 设置波段偏移量

func (*RasterDataset) SetBandScale added in v1.6.5

func (rd *RasterDataset) SetBandScale(bandIndex int, scale float64) error

SetBandScale 设置波段缩放因子

func (*RasterDataset) SetBandUnitType added in v1.6.5

func (rd *RasterDataset) SetBandUnitType(bandIndex int, unitType string) error

SetBandUnitType 设置波段单位类型

func (*RasterDataset) SmartColorBalance added in v1.6.5

func (rd *RasterDataset) SmartColorBalance(refDS *RasterDataset, overlapRegion *ReferenceRegion) (*RasterDataset, error)

SmartColorBalance 智能匀色(自动选择最佳方法)

func (*RasterDataset) SplitBands added in v1.6.5

func (rd *RasterDataset) SplitBands() ([]*RasterDataset, error)

SplitBands 将多波段数据集拆分为单波段数据集数组

func (*RasterDataset) UnsharpMask added in v1.6.5

func (rd *RasterDataset) UnsharpMask(amount float64) (*RasterDataset, error)

UnsharpMask USM锐化(通过对比度增强模拟)

func (*RasterDataset) WallisFilter added in v1.6.5

func (rd *RasterDataset) WallisFilter(targetMean, targetStd, c, b float64, windowSize int) (*RasterDataset, error)

WallisFilter Wallis滤波匀色

func (*RasterDataset) WriteBandData added in v1.6.5

func (rd *RasterDataset) WriteBandData(bandIndex int, data []float64) error

func (*RasterDataset) WriteBandDataRect added in v1.6.5

func (rd *RasterDataset) WriteBandDataRect(bandIndex, x, y, width, height int, data []float64) error

WriteBandDataRect 写入波段矩形区域数据

type RasterTileResult added in v1.2.12

type RasterTileResult struct {
	Zoom  int
	X     int
	Y     int
	Data  []byte
	Error error
}

RasterTileResult 瓦片结果

type RasterTiler added in v1.3.6

type RasterTiler struct {
	// contains filtered or unexported fields
}

RasterTiler 栅格切片器

func NewRasterTiler added in v1.3.6

func NewRasterTiler(raster *RasterDataset, options *TileOptions) (*RasterTiler, error)

NewRasterTiler 创建栅格切片器

func (*RasterTiler) ClipByTiles added in v1.3.6

func (t *RasterTiler) ClipByTiles(clipOptions *ClipOptions) ([]ClipResultByte, error)

ClipByTiles 使用切片图层裁剪栅格并返回二进制数据

func (*RasterTiler) Close added in v1.3.6

func (t *RasterTiler) Close()

Close 关闭切片器并释放资源

func (*RasterTiler) CreateTileLayer added in v1.3.6

func (t *RasterTiler) CreateTileLayer() (*GDALLayer, error)

CreateTileLayer 创建切片矢量图层(内存图层)

func (*RasterTiler) GenerateTiles added in v1.3.6

func (t *RasterTiler) GenerateTiles() error

GenerateTiles 生成切片信息

func (*RasterTiler) GetGridInfo added in v1.3.6

func (t *RasterTiler) GetGridInfo() (rows, cols int)

GetGridInfo 获取网格信息

func (*RasterTiler) GetTileByIndex added in v1.3.6

func (t *RasterTiler) GetTileByIndex(index int) (*TileInfo2, error)

GetTileByIndex 根据索引获取切片信息

func (*RasterTiler) GetTileByRowCol added in v1.3.6

func (t *RasterTiler) GetTileByRowCol(row, col int) (*TileInfo2, error)

GetTileByRowCol 根据行列号获取切片信息

func (*RasterTiler) GetTileCount added in v1.3.6

func (t *RasterTiler) GetTileCount() int

GetTileCount 获取切片数量

func (*RasterTiler) GetTileLayer added in v1.3.6

func (t *RasterTiler) GetTileLayer() *GDALLayer

GetTileLayer 获取已创建的切片图层

func (*RasterTiler) GetTiles added in v1.3.6

func (t *RasterTiler) GetTiles() []TileInfo2

GetTiles 获取切片信息列表

type ReclassifyRule added in v1.6.5

type ReclassifyRule struct {
	MinValue float64 // 最小值(包含)
	MaxValue float64 // 最大值(不包含)
	NewValue float64 // 新值
}

ReclassifyRule 重分类规则

type ReferenceRegion added in v1.6.5

type ReferenceRegion struct {
	X      int
	Y      int
	Width  int
	Height int
}

ReferenceRegion 参考区域

type ReplaceCondition added in v1.6.5

type ReplaceCondition struct {
	MinValue   float64
	MaxValue   float64
	NewValue   float64
	IncludeMin bool
	IncludeMax bool
}

ReplaceCondition 替换条件

type ResampleBatchConfig added in v1.6.6

type ResampleBatchConfig struct {
	InputPaths   []string         // 输入文件路径
	OutputPaths  []string         // 输出文件路径
	OutputFormat string           // 输出格式
	Options      *ResampleOptions // 重采样选项
}

ResampleBatchConfig 批量重采样配置

type ResampleBatchResult added in v1.6.6

type ResampleBatchResult struct {
	InputPath  string
	OutputPath string
	Error      error
}

ResampleBatchResult 批量重采样结果

func ResampleBatch added in v1.6.6

func ResampleBatch(config *ResampleBatchConfig) []ResampleBatchResult

ResampleBatch 批量执行重采样

type ResampleInfo added in v1.6.6

type ResampleInfo struct {
	OriginalWidth  int
	OriginalHeight int
	OriginalResX   float64
	OriginalResY   float64
	TargetWidth    int
	TargetHeight   int
	TargetResX     float64
	TargetResY     float64
	BandCount      int
}

ResampleInfo 重采样结果信息

type ResampleMethod added in v1.6.5

type ResampleMethod int

ResampleMethod 重采样方法

const (
	ResampleNearest     ResampleMethod = 0
	ResampleBilinear    ResampleMethod = 1
	ResampleCubic       ResampleMethod = 2
	ResampleCubicSpline ResampleMethod = 3
	ResampleLanczos     ResampleMethod = 4
)

type ResampleOptions added in v1.6.6

type ResampleOptions struct {
	Method       ResampleMethod // 重采样方法
	TargetResX   float64        // 目标X分辨率(0表示使用缩放因子)
	TargetResY   float64        // 目标Y分辨率(0表示使用缩放因子)
	ScaleFactor  float64        // 缩放因子(当TargetRes为0时使用,>1放大,<1缩小)
	TargetWidth  int            // 目标宽度(0表示自动计算)
	TargetHeight int            // 目标高度(0表示自动计算)
	NoDataValue  float64        // NoData值
	HasNoData    bool           // 是否设置NoData
}

ResampleOptions 重采样选项

func DefaultResampleOptions added in v1.6.6

func DefaultResampleOptions() *ResampleOptions

DefaultResampleOptions 默认重采样选项

type ResampleOverview added in v1.6.12

type ResampleOverview string

ResampleOverview 金字塔重采样方法

const (
	OverviewNearest  ResampleOverview = "NEAREST"
	OverviewBilinear ResampleOverview = "BILINEAR"
	OverviewCubic    ResampleOverview = "CUBIC"
	OverviewAverage  ResampleOverview = "AVERAGE"
	OverviewGauss    ResampleOverview = "GAUSS"
	OverviewLanczos  ResampleOverview = "LANCZOS"
	OverviewMode     ResampleOverview = "MODE"
)

type SHPLayerInfo

type SHPLayerInfo struct {
	LayerName   string
	GeoType     string
	FieldInfos  []FieldInfo
	FeatureData []FeatureData
}

SHPLayerInfo SHP图层信息结构

func SHPToPostGIS

func SHPToPostGIS(shpPath string) (SHPLayerInfo, error)

SHPToPostGIS 将SHP文件转换为PostGIS格式

type SerializedLayerData

type SerializedLayerData struct {
	Data []byte
	Size int
}

SerializedLayerData 表示序列化的图层数据

type SpatialReference

type SpatialReference struct {
	// contains filtered or unexported fields
}

SpatialReference 表示空间参考系统的Go包装器

func CreateEPSG4490WithCorrectAxis

func CreateEPSG4490WithCorrectAxis() (*SpatialReference, error)

func (*SpatialReference) Destroy

func (srs *SpatialReference) Destroy()

Destroy 手动销毁空间参考系统资源

type SpatialReferenceXML added in v1.4.7

type SpatialReferenceXML struct {
	XMLName    xml.Name `xml:"SpatialReference"`
	WKT        string   `xml:"WKT"`
	WKID       string   `xml:"WKID"`
	LatestWKID string   `xml:"LatestWKID"`
}

type SyncFieldOptions added in v1.3.9

type SyncFieldOptions struct {
	SourceField      string            // PostGIS源字段名
	TargetField      string            // GDB目标字段名
	SourceIDField    string            // PostGIS的ID字段名(默认为"objectid")
	TargetIDField    string            // GDB的ID字段名("FID"或"OBJECTID")
	UseFID           bool              // 是否使用FID作为关联字段(默认true)
	BatchSize        int               // 批处理大小(默认1000)
	UseTransaction   bool              // 是否使用事务(默认true)
	UpdateNullValues bool              // 是否更新NULL值(默认false)
	FieldMapping     map[string]string // 多字段映射(源字段->目标字段)
	WhereClause      string            // SQL过滤条件(可选)
}

SyncFieldOptions 字段同步选项

type SyncResult added in v1.3.9

type SyncResult struct {
	TotalCount   int      // 总记录数
	UpdatedCount int      // 成功更新数
	FailedCount  int      // 失败数
	SkippedCount int      // 跳过数
	Errors       []string // 错误信息列表
}

SyncResult 同步结果

func BatchSyncToFile added in v1.6.13

func BatchSyncToFile(task *SyncTask) (*SyncResult, error)

func SyncFieldFromPostGIS added in v1.3.9

func SyncFieldFromPostGIS(postGISConfig *PostGISConfig, gdbPath string, gdbLayerName string, options *SyncFieldOptions) (*SyncResult, error)

SyncFieldFromPostGIS 从PostGIS同步字段值到GDB postGISConfig: PostGIS配置 gdbPath: GDB文件路径 gdbLayerName: GDB图层名称 options: 同步选项

type SyncTask added in v1.6.13

type SyncTask struct {
	FilePath      string
	LayerName     string // SHP 留空
	IsShapefile   bool
	KeyField      string // 源文件中用于定位的字段名,如 OBJECTID / FID
	DeleteIDs     []int64
	UpdatePairs   []UpdatePair
	InsertSources []*GDALLayer
	Options       *InsertOptions
}

SyncTask 描述一次批量同步的全部操作

type TableStructureInfo

type TableStructureInfo struct {
	TableName string
	Schema    string
	Fields    []PostGISFieldInfo
}

func GetTableStructure

func GetTableStructure(DB *gorm.DB, tableName string) (*TableStructureInfo, error)

type TerrainOptions added in v1.3.17

type TerrainOptions struct {
	TileSize         int              // 瓦片大小,默认256(Mapbox Terrain-RGB使用256或512)
	MinZoom          int              // 最小缩放级别
	MaxZoom          int              // 最大缩放级别
	Encoding         string           // 编码方式: "mapbox" 或 "terrarium"
	Concurrency      int              // 并发数
	BatchSize        int              // 批量插入大小
	ProgressCallback ProgressCallback // 进度回调
}

TerrainOptions 地形瓦片生成选项

type TerrainTileResult added in v1.3.17

type TerrainTileResult struct {
	Zoom  int
	X     int
	Y     int
	Data  []byte
	Error error
}

TerrainTileResult 地形瓦片结果

type TileClipResultM

type TileClipResultM struct {
	Index        int    // 瓦片索引
	Success      bool   // 是否成功
	Error        error  // 错误信息
	OutputPath   string // 输出文件路径
	FeatureCount int    // 要素数量
}

TileClipResultM 表示瓦片裁剪结果

func ClipAndSerializeLayerByTilesOptimized

func ClipAndSerializeLayerByTilesOptimized(layer *GDALLayer, tiles []*TileInfo, uuid string, config *TileProcessingConfig, progressCallback TileProgressCallback) ([]*TileClipResultM, error)

ClipAndSerializeLayerByTilesOptimized 优化版本的主要接口函数

type TileInfo

type TileInfo struct {
	Index    int     // 分块索引
	MinX     float64 // 边界框
	MinY     float64
	MaxX     float64
	MaxY     float64
	Envelope C.OGRGeometryH // 分块包络几何体
}

TileInfo 分块信息

type TileInfo2 added in v1.3.6

type TileInfo2 struct {
	Name        string     // 切片名称
	Index       int        // 切片索引
	Row         int        // 行号
	Col         int        // 列号
	Bounds      [4]float64 // 切片边界 [minX, minY, maxX, maxY]
	PixelBounds [4]int     // 像素边界 [minX, minY, maxX, maxY]
	Width       int        // 切片宽度(像素)
	Height      int        // 切片高度(像素)
}

TileInfo 切片信息

type TileOptions added in v1.3.6

type TileOptions struct {
	TileWidth  int     // 切片宽度(像素)
	TileHeight int     // 切片高度(像素)
	OverlapX   int     // X方向重叠像素数
	OverlapY   int     // Y方向重叠像素数
	NamePrefix string  // 切片名称前缀
	StartIndex int     // 起始索引
	BufferDist float64 // 缓冲距离(可选)
}

TileOptions 切片选项

type TileProcessingConfig

type TileProcessingConfig struct {
	MaxConcurrency int  // 最大并发数
	BufferSize     int  // 预分配缓冲区大小
	EnableProgress bool // 是否启用进度回调
}

TileProcessingConfig 瓦片处理配置

type TileProgressCallback

type TileProgressCallback func(processed, total int, currentTile *TileInfo)

ProgressCallback 进度回调函数

type TileResult

type TileResult struct {
	TileIndex        int
	InteriorFeatures []C.OGRFeatureH // 完全在分块内部的要素
	BorderFeatures   []C.OGRFeatureH // 可能跨越边界的要素
	Error            error
	ProcessTime      time.Duration
}

修改分块结果结构,标记边界要素

type TileServer added in v1.4.16

type TileServer struct {
	// contains filtered or unexported fields
}

TileServer 动态瓦片服务器(免切片)

func NewTileServer added in v1.4.16

func NewTileServer(imagePath string, options *TileServerOptions) (*TileServer, error)

NewTileServer 创建动态瓦片服务器

func (*TileServer) Close added in v1.4.16

func (ts *TileServer) Close()

Close 关闭瓦片服务器

func (*TileServer) GetBounds added in v1.4.16

func (ts *TileServer) GetBounds() (minLon, minLat, maxLon, maxLat float64)

GetBounds 获取边界(经纬度)

func (*TileServer) GetTerrainTile added in v1.4.16

func (ts *TileServer) GetTerrainTile(z, x, y int, encoding string) ([]byte, error)

GetTerrainTile 获取地形瓦片(Terrain-RGB格式)

func (*TileServer) GetTile added in v1.4.16

func (ts *TileServer) GetTile(z, x, y int) ([]byte, error)

GetTile 获取瓦片(核心方法 - 高性能)

func (*TileServer) GetTilePNG added in v1.4.16

func (ts *TileServer) GetTilePNG(z, x, y int) ([]byte, error)

GetTilePNG 获取PNG格式瓦片

func (*TileServer) GetTileRange added in v1.4.16

func (ts *TileServer) GetTileRange(zoom int) (minTileX, minTileY, maxTileX, maxTileY int)

GetTileRange 获取指定缩放级别的瓦片范围

type TileServerOptions added in v1.4.16

type TileServerOptions struct {
	TileSize  int  // 瓦片大小,默认256
	PoolSize  int  // 数据集池大小,默认为CPU核心数
	Reproject bool // 是否重投影到Web Mercator
}

TileServerOptions 瓦片服务器选项

type TileTask added in v1.2.12

type TileTask struct {
	Zoom int
	X    int
	Y    int
}

TileTask 瓦片任务

type TransformErrorAction added in v1.4.3

type TransformErrorAction int

TransformErrorAction 转换错误处理方式

const (
	TransformErrorSkip    TransformErrorAction = iota // 跳过该要素
	TransformErrorFail                                // 失败并停止
	TransformErrorKeepRaw                             // 保留原始坐标
)

type TransformOptions added in v1.4.3

type TransformOptions struct {
	// 转换精度控制
	AreaOfInterest *AreaOfInterest // 感兴趣区域(用于选择最佳转换方法)
	// 高程处理
	IncludeZ bool // 是否包含Z值转换
	// 错误处理
	OnTransformError TransformErrorAction // 转换错误时的处理方式
}

TransformOptions 坐标转换选项

type UnionConfig

type UnionConfig struct {
	GroupFields      []string
	OutputLayerName  string
	GeomType         C.OGRwkbGeometryType
	PrecisionConfig  *GeometryPrecisionConfig
	ProgressCallback ProgressCallback
}

type UnionProcessor

type UnionProcessor struct {
	// contains filtered or unexported fields
}

func NewUnionProcessor

func NewUnionProcessor(config *UnionConfig) *UnionProcessor

func (*UnionProcessor) ProcessUnion

func (up *UnionProcessor) ProcessUnion(inputLayer *GDALLayer) (*GeosAnalysisResult, error)

type UpdatePair added in v1.6.13

type UpdatePair struct {
	SourceID    int64
	InsertLayer *GDALLayer
}

UpdatePair 一个更新操作 = 删除源文件中的 SourceID + 插入新的 GDALLayer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL