0

I'm following the GeoTools documentation and found this:

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

When I put it in intellij IDE, for each class there are several suggested imports to use. What import I need to select?

Alternative way (with same issue) is:

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

1 回答 1

3

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

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

同时,您的GeometryBuilder是一个org.geotools.geometry.GeometryBuilder导致以下导入的:

import org.geotools.geometry.GeometryBuilder;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.geometry.primitive.Point;
于 2015-09-15T01:08:26.203 回答