【问题标题】:GeoTools: How to build a point? (imports issue)GeoTools:如何建立一个点? (进口问题)
【发布时间】:2015-09-14 12:50:49
【问题描述】:

我正在关注GeoTools documentation 并找到了这个:

GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
Coordinate coord = new Coordinate(45, 15);
Point point = geometryFactory.createPoint(coord);

当我把它放在 intellij IDE 中时,每个类都有几个建议的导入使用。我需要选择什么导入?

替代方式(同样的问题)是:

GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
Point point = builder.createPoint(45, 15);

【问题讨论】:

    标签: gis geotools osgeo


    【解决方案1】:

    当您有疑问时,您可以随时阅读文档,例如 JTSFactoryFinder 返回一个 com.vividsolutions.jts.geom.GeometryFactory,一旦您知道其他部分就位:

    import com.vividsolutions.jts.geom.Coordinate;
    import com.vividsolutions.jts.geom.GeometryFactory;
    import com.vividsolutions.jts.geom.Point;
    

    同时您的GeometryBuilderorg.geotools.geometry.GeometryBuilder,它会导致以下导入:

    import org.geotools.geometry.GeometryBuilder;
    import org.geotools.referencing.crs.DefaultGeographicCRS;
    import org.opengis.geometry.primitive.Point;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      • 2018-12-25
      • 2013-08-27
      相关资源
      最近更新 更多