/** * Constructs a line from list of coordinates * @param coordinates Coordinate (lon,lat) pairs * @return */ public static Geoshape line(List<double[]> coordinates) { Preconditions.checkArgument(coordinates.size() >= 2, "Too few coordinate pairs provided"); final LineStringBuilder builder = getShapeFactory().lineString(); for (double[] coordinate : coordinates) { Preconditions.checkArgument(isValidCoordinate(coordinate[1], coordinate[0]), "Invalid coordinate provided"); builder.pointXY(coordinate[0], coordinate[1]); } return new Geoshape(builder.build()); }
final Geoshape multiPoint = Geoshape.geoshape(Geoshape.getShapeFactory().multiPoint().pointXY(60.0, 60.0).pointXY(120.0, 60.0).build()); add(store, "doc5", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiPoint, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape multiLine = Geoshape.geoshape(Geoshape.getShapeFactory().multiLineString().add(Geoshape.getShapeFactory().lineString().pointXY(59.0, 60.0).pointXY(61.0, 60.0)) .add(Geoshape.getShapeFactory().lineString().pointXY(119.0, 60.0).pointXY(121.0, 60.0)).build()); add(store, "doc6", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiLine, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape multiPolygon = Geoshape.geoshape(Geoshape.getShapeFactory().multiPolygon() add(store, "doc7", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiPolygon, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape geometryCollection = Geoshape.geoshape(Geoshape.getGeometryCollectionBuilder().add(Geoshape.getShapeFactory().pointXY(60.0, 60.0)) .add(Geoshape.getShapeFactory().lineString().pointXY(119.0, 60.0).pointXY(121.0, 60.0).build()).build()); add(store, "doc8", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), geometryCollection, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true);
/** Constructs a line string. It's an ordered sequence of connected vertexes. There * is no official shape/interface for it yet so we just return Shape. */ @Deprecated public Shape makeLineString(List<Point> points) { return shapeFactory.lineString(points, 0); }
/** Constructs a buffered line string. It's an ordered sequence of connected vertexes, * with a buffer distance along the line in all directions. There * is no official shape/interface for it so we just return Shape. */ @Deprecated public Shape makeBufferedLineString(List<Point> points, double buf) { return shapeFactory.lineString(points, buf); }
/** * Parses a LINESTRING shape from the raw string -- an ordered sequence of points. * * <pre> * coordinateSequence * </pre> * * @see #pointList(State, ShapeFactory.PointsBuilder) */ protected Shape parseLineStringShape(State state) throws ParseException { ShapeFactory.LineStringBuilder lineStringBuilder = shapeFactory.lineString(); if (state.nextIfEmptyAndSkipZM()) return lineStringBuilder.build(); return pointList(state, lineStringBuilder).build(); }
protected Shape readLineString(JSONParser parser) throws IOException, ParseException { assert (parser.lastEvent() == JSONParser.ARRAY_START); ShapeFactory.LineStringBuilder builder = shapeFactory.lineString(); readCoordListXYZ(parser, builder); // check for buffer field builder.buffer(readDistance(BUFFER, BUFFER_UNITS, parser)); Shape out = builder.build(); readUntilEvent(parser, JSONParser.OBJECT_END); return out; }
ShapeFactory.LineStringBuilder builder = factory.lineString(); fillPoints(builder, arr); builder.buffer(buffer);
ShapeFactory.LineStringBuilder lineBuilder = shpFactory.lineString(); reader.readPoints(lineBuilder);
List<ShapePoint> tripShape = mShapePoints.get(shapeAgencyAndId.getId()); if (tripShape != null) { ShapeFactory.LineStringBuilder lineBuilder = sf.lineString(); for (ShapePoint p : tripShape) { lineBuilder.pointXY(p.getLon(), p.getLat());