• geotools library


    Library

    The GeoTools library is organized into a series of jars. These jars form a software stack, each building on the services of the others. Individual jars such as “data” are extended with plugins in order to support additional capabilities. For data these plugins include support for common spatial formats such as shapefiles.

    https://docs.geotools.org/stable/userguide/library/index.html

    1. OpenGIS

    Interfaces for GeoSpatial concepts, often defined by the OGC or ISO standards bodies. The interfaces in this module serve as a great reference if you do not have the time to purchase and read the official standards documents. Approach the standards using an environment you are comfortable with - Java!

    地理空间概念的接口,通常由OGC或ISO标准机构定义。如果您没有时间购买和阅读官方标准文档,本模块中的界面将是一个很好的参考。使用您熟悉的环境来接近标准-Java!

    ../../_images/gt-opengis.png

    GeoTools is all about implementing spatial solutions, and we do our very best to follow a don’t invent here policy (rather than get off topic). By referencing standards we are able to use well understood names for common spatial ideas and constructs.

    GeoTools致力于实现空间解决方案,我们尽最大努力遵循“不是在这里发明”的政策(而不是偏离主题)。通过参考标准,我们能够为常见的空间想法和结构使用易于理解的名称。

    The gt-opengis module provides:

    gt-opengis模块提供:

    • interfaces implemented by gt-main such as Feature, FeatureType, Filter and Function

    • 由gt-main实现的接口,例如Feature,FeatureType,Filter和Function。
    • interfaces implemented by gt-coverage such as GridCoverage

    • 由gt-coverage实现的接口,例如GridCoverage。
    • interfaces implemented by gt-referencing such as CoordinateReferenceSystem

    • 由gt-referencing实现的接口,例如CoordinateReferencingSystem。
    • interfaces implemented by gt-metadata such as Citation

    • 由gt-metadata实现的接口,例如Citation。

    For more information on the standards covered by the library as whole: Standards Covered

    有关整个库涵盖的标准的更多信息:涵盖的标准

    Reference参考

    Maven:Maven依赖:

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-opengis</artifactId>
      <version>${geotools.version}</version>
    </dependency>
    

    Contents目录

    Model模型

    GeoTools provides a clear separation between:

    GeoTools提供了清晰的分割在:

    • data model - feature responsible for holding values

    • 数据模型-feature,用来存储数值。
    • query model - filter and expression used to select content and drill in and retrieve values

    • 查询模型-filter和expression,用来查询内容以及钻取以及检索数据。
    • metadata model - feature type describing contents in sufficient details for validation and query construction

    • 元数据模型-feature type,为验证和查询构造器提供足够详细的内容描述

    References:

    Comparison to Java:

    与Java的比较:

    The data structure Feature is used to hold information. Each Feature “belongs to” a FeatureType which is used to describe valid contents. This is a dynamic type system because FeatureType is a data structure we can define at runtime.

    数据结构Feature用来存储信息。每一个Feature属于一种FeatureType,后者是用来描述有效的内容的。这是一种动态的类型系统,因为FeatureType是可以在运行时定义的数据结构。

    The data structure Object is used to hold information. Each Object “belongs to” a Class which is used to describe valid contents. This is a static type system because Class is a data structure we need to compile before the application is started.

    数据结构Object用来存储信息。每一个Object 属于一个Class,后者用来描述有效的内容。这是一个静态的类型系统,因为Class是一种我们需要在应用程序启动前编译的数据结构。

    Java 例子:

          class Flag {
                public Point location;
                public String name;
                public int classification;
                public double height;
            };
    
            GeometryFactory geomFactory = JTSFactoryFinder.getGeometryFactory();
    
            Flag here = new Flag();
            here.location = geomFactory.createPoint(new Coordinate(23.3, -37.2));
            here.name = "Here";
            here.classification = 3;
            here.height = 2.0;

    Feature例子:

            SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
            b.setName("Flag");
            b.setCRS(DefaultGeographicCRS.WGS84);
            b.add("location", Point.class);
            b.add("name", String.class);
            b.add("classification", Integer.class);
            b.add("height", Double.class);
            SimpleFeatureType type = b.buildFeatureType();
    
            GeometryFactory geomFactory = JTSFactoryFinder.getGeometryFactory();
    
            SimpleFeatureBuilder f = new SimpleFeatureBuilder(type);
            f.add(geomFactory.createPoint(new Coordinate(23.3, -37.2)));
            f.add("here");
            f.add(3);
            f.add(2.0);
            SimpleFeature feature = f.buildFeature("fid.1");

    2. JTS

    The JTS Topology Suite is an external project that GeoTools uses to provide an implementation of the Geometry data structure. The major benefit is the numerically stable geometry operations as a result of years of dedicated effort.

    JTS拓扑套件是GeoTools用于提供几何数据结构实现的外部项目。主要的好处是,经过多年的努力,几何操作在数值上是稳定的。

    ../../_images/gt-jts.png

    GeoTools is all about implementing spatial solutions, and we do our very best to follow a don’t invent here policy (rather than get off topic). The excellent JTS Topology Suite project offers an implementation of Geometry which we use throughout our library.

    GeoTools致力于实现空间解决方案,我们尽最大努力遵循“不要在这里发明”的政策(而不是偏离主题)。优秀的JTS拓扑套件项目提供了我们在整个库中使用的几何体实现。

    The GeoTools provides some help for working with JTS:

    • gt-main offers helper classes (such as JTS and Geometries) and extends JTS with a CurvedGeometryFactory for working with curves along with helper classes to translate Geometry into a Java Shape for display

    References

    Maven:

    <dependency>
      <groupId>org.locationtech</groupId>
      <artifactId>jts</artifactId>
      <version>1.13</version>
    </dependency>
    

    Contents

    geotools添加数据源:

    geotools数据的存储和读取:

    Geotools示例:Tests

    geotools-18.1-bin:包含252个jar包。。。可怕

    看geotools的pom.xml。。。也是几千行。。。依赖库多到爆炸

    GeoTools折腾手记:https://zhuanlan.zhihu.com/p/39113566 有时候因为geotools太复杂难学直接使用数据库postgis自带的函数就够用了

  • 相关阅读:
    Swift
    Swift
    Swift
    Swift
    Swift
    nineOldAnimation 应用
    Android 编程下 Touch 事件的分发和消费机制
    用Gradle 构建android程序
    CygWin模拟Linux环境进行Ant批量打包
    UML类图与类的关系详解
  • 原文地址:https://www.cnblogs.com/2008nmj/p/15867482.html
Copyright © 2020-2023  润新知