├── .github
└── workflows
│ └── java-ci.yml
├── .gitignore
├── README.md
├── copyright-template.vml
├── deploy.sh
├── docs
├── positions_hierarchy.puml
└── resources
│ └── positions_hierarchy.png
├── geom
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── geolatte
│ │ │ └── geom
│ │ │ ├── AbstractGeometryCollection.java
│ │ │ ├── AbstractPositionEquality.java
│ │ │ ├── AbstractPositionSequence.java
│ │ │ ├── AbstractPositionSequenceBuilder.java
│ │ │ ├── ApproximateGeometryEquality.java
│ │ │ ├── Box.java
│ │ │ ├── BufferAccessException.java
│ │ │ ├── ByteBuffer.java
│ │ │ ├── ByteOrder.java
│ │ │ ├── C2D.java
│ │ │ ├── C2DM.java
│ │ │ ├── C3D.java
│ │ │ ├── C3DM.java
│ │ │ ├── Circle.java
│ │ │ ├── Complex.java
│ │ │ ├── DecimalDegree.java
│ │ │ ├── DefaultMeasureGeometryOperations.java
│ │ │ ├── Envelope.java
│ │ │ ├── ExactPositionEquality.java
│ │ │ ├── Feature.java
│ │ │ ├── FeatureCollection.java
│ │ │ ├── FixedSizePositionSequenceBuilder.java
│ │ │ ├── G2D.java
│ │ │ ├── G2DM.java
│ │ │ ├── G3D.java
│ │ │ ├── G3DM.java
│ │ │ ├── Geometries.java
│ │ │ ├── Geometry.java
│ │ │ ├── GeometryCollection.java
│ │ │ ├── GeometryEquality.java
│ │ │ ├── GeometryOperation.java
│ │ │ ├── GeometryOperations.java
│ │ │ ├── GeometryPositionEquality.java
│ │ │ ├── GeometryType.java
│ │ │ ├── GeometryVisitor.java
│ │ │ ├── JTSGeometryOperations.java
│ │ │ ├── LLAPositionVisitor.java
│ │ │ ├── LLAPositionVisitors.java
│ │ │ ├── LineSegment.java
│ │ │ ├── LineSegments.java
│ │ │ ├── LineString.java
│ │ │ ├── Linear.java
│ │ │ ├── LinearRing.java
│ │ │ ├── M.java
│ │ │ ├── MeasureGeometryOperations.java
│ │ │ ├── MeasureInterpolatingVisitor.java
│ │ │ ├── Measured.java
│ │ │ ├── MultiLineString.java
│ │ │ ├── MultiPoint.java
│ │ │ ├── MultiPolygon.java
│ │ │ ├── NestedPositionSequence.java
│ │ │ ├── PackedPositionSequence.java
│ │ │ ├── Point.java
│ │ │ ├── Polygon.java
│ │ │ ├── Polygonal.java
│ │ │ ├── Position.java
│ │ │ ├── PositionEquality.java
│ │ │ ├── PositionFactory.java
│ │ │ ├── PositionSequence.java
│ │ │ ├── PositionSequenceBuilder.java
│ │ │ ├── PositionSequenceBuilders.java
│ │ │ ├── PositionSequenceEquality.java
│ │ │ ├── PositionSequenceIterator.java
│ │ │ ├── PositionSequencePositionEquality.java
│ │ │ ├── PositionVisitor.java
│ │ │ ├── Positions.java
│ │ │ ├── ProjectedGeometryOperations.java
│ │ │ ├── Simple.java
│ │ │ ├── V.java
│ │ │ ├── VariableSizePositionSequenceBuilder.java
│ │ │ ├── Vector.java
│ │ │ ├── WithinTolerancePositionEquality.java
│ │ │ ├── builder
│ │ │ ├── DSL.java
│ │ │ └── package.html
│ │ │ ├── cga
│ │ │ ├── Circle.java
│ │ │ ├── CircularArcLinearizer.java
│ │ │ └── NumericalMethods.java
│ │ │ ├── codec
│ │ │ ├── BaseWkbParser.java
│ │ │ ├── BaseWkbVisitor.java
│ │ │ ├── BaseWktParser.java
│ │ │ ├── BaseWktWriter.java
│ │ │ ├── CrsWktDecoder.java
│ │ │ ├── CrsWktTokenizer.java
│ │ │ ├── CrsWktVariant.java
│ │ │ ├── Db2WktDecoder.java
│ │ │ ├── Db2WktEncoder.java
│ │ │ ├── HANAWkbDecoder.java
│ │ │ ├── HANAWkbDialect.java
│ │ │ ├── HANAWkbEncoder.java
│ │ │ ├── HANAWktDecoder.java
│ │ │ ├── HANAWktDialect.java
│ │ │ ├── HANAWktEncoder.java
│ │ │ ├── MySqlWkbDecoder.java
│ │ │ ├── MySqlWkbDialect.java
│ │ │ ├── MySqlWkbEncoder.java
│ │ │ ├── PostgisWkbDecoder.java
│ │ │ ├── PostgisWkbEncoder.java
│ │ │ ├── PostgisWkbTypeMasks.java
│ │ │ ├── PostgisWkbV1Dialect.java
│ │ │ ├── PostgisWkbV2Dialect.java
│ │ │ ├── PostgisWkbV2Encoder.java
│ │ │ ├── PostgisWktDecoder.java
│ │ │ ├── PostgisWktDialect.java
│ │ │ ├── PostgisWktEncoder.java
│ │ │ ├── Sfa110WkbDecoder.java
│ │ │ ├── Sfa110WkbDialect.java
│ │ │ ├── Sfa110WkbEncoder.java
│ │ │ ├── Sfa110WktDecoder.java
│ │ │ ├── Sfa110WktDialect.java
│ │ │ ├── Sfa110WktEncoder.java
│ │ │ ├── Sfa121WkbDecoder.java
│ │ │ ├── Sfa121WkbDialect.java
│ │ │ ├── Sfa121WkbEncoder.java
│ │ │ ├── Sfa121WktDecoder.java
│ │ │ ├── Sfa121WktDialect.java
│ │ │ ├── Sfa121WktEncoder.java
│ │ │ ├── SimpleTokenizer.java
│ │ │ ├── UnsupportedConversionException.java
│ │ │ ├── Wkb.java
│ │ │ ├── WkbDecodeException.java
│ │ │ ├── WkbDecoder.java
│ │ │ ├── WkbDialect.java
│ │ │ ├── WkbEncoder.java
│ │ │ ├── WkbGeometryType.java
│ │ │ ├── Wkt.java
│ │ │ ├── WktDecodeException.java
│ │ │ ├── WktDecoder.java
│ │ │ ├── WktDialect.java
│ │ │ ├── WktEncoder.java
│ │ │ ├── WktKeywordToken.java
│ │ │ ├── WktNumberToken.java
│ │ │ ├── WktPunctuationToken.java
│ │ │ ├── WktTextToken.java
│ │ │ ├── WktToken.java
│ │ │ ├── WktVariant.java
│ │ │ ├── db
│ │ │ │ ├── Decoder.java
│ │ │ │ ├── Encoder.java
│ │ │ │ ├── db2
│ │ │ │ │ ├── Db2ClobDecoder.java
│ │ │ │ │ └── Db2ClobEncoder.java
│ │ │ │ ├── oracle
│ │ │ │ │ ├── AbstractSDODecoder.java
│ │ │ │ │ ├── AbstractSDOEncoder.java
│ │ │ │ │ ├── ConnectionFinder.java
│ │ │ │ │ ├── Decoders.java
│ │ │ │ │ ├── DefaultConnectionFinder.java
│ │ │ │ │ ├── ElemInfo.java
│ │ │ │ │ ├── Element.java
│ │ │ │ │ ├── ElementType.java
│ │ │ │ │ ├── Encoders.java
│ │ │ │ │ ├── GeometryCollectionSdoDecoder.java
│ │ │ │ │ ├── GeometryCollectionSdoEncoder.java
│ │ │ │ │ ├── LineStringSdoDecoder.java
│ │ │ │ │ ├── LineStringSdoEncoder.java
│ │ │ │ │ ├── Linearizer.java
│ │ │ │ │ ├── MultiLineSdoDecoder.java
│ │ │ │ │ ├── MultiLineStringSdoEncoder.java
│ │ │ │ │ ├── MultiPointSdoDecoder.java
│ │ │ │ │ ├── MultiPointSdoEncoder.java
│ │ │ │ │ ├── MultiPolygonSdoDecoder.java
│ │ │ │ │ ├── MultiPolygonSdoEncoder.java
│ │ │ │ │ ├── OracleJDBCTypeFactory.java
│ │ │ │ │ ├── Ordinates.java
│ │ │ │ │ ├── PointSdoDecoder.java
│ │ │ │ │ ├── PointSdoEncoder.java
│ │ │ │ │ ├── PolygonSdoDecoder.java
│ │ │ │ │ ├── PolygonSdoEncoder.java
│ │ │ │ │ ├── SDOGType.java
│ │ │ │ │ ├── SDOGeometry.java
│ │ │ │ │ ├── SDOPoint.java
│ │ │ │ │ ├── SQLTypeFactory.java
│ │ │ │ │ ├── SdoGeometryType.java
│ │ │ │ │ └── Settings.java
│ │ │ │ └── sqlserver
│ │ │ │ │ ├── AbstractGeometryCollectionSqlServerDecoder.java
│ │ │ │ │ ├── AbstractSqlServerDecoder.java
│ │ │ │ │ ├── AbstractSqlServerEncoder.java
│ │ │ │ │ ├── CountingPositionSequenceBuilder.java
│ │ │ │ │ ├── Decoders.java
│ │ │ │ │ ├── Encoders.java
│ │ │ │ │ ├── Figure.java
│ │ │ │ │ ├── FigureAttribute.java
│ │ │ │ │ ├── GeometryCollectionSqlServerDecoder.java
│ │ │ │ │ ├── GeometryCollectionSqlServerEncoder.java
│ │ │ │ │ ├── IndexRange.java
│ │ │ │ │ ├── LineStringSqlServerDecoder.java
│ │ │ │ │ ├── LineStringSqlServerEncoder.java
│ │ │ │ │ ├── MultiLineStringSqlServerDecoder.java
│ │ │ │ │ ├── MultiPointSqlServerDecoder.java
│ │ │ │ │ ├── MultiPolygonSqlServerDecoder.java
│ │ │ │ │ ├── OpenGisType.java
│ │ │ │ │ ├── PointSqlServerDecoder.java
│ │ │ │ │ ├── PointSqlServerEncoder.java
│ │ │ │ │ ├── PolygonSqlServerDecoder.java
│ │ │ │ │ ├── PolygonSqlServerEncoder.java
│ │ │ │ │ ├── Shape.java
│ │ │ │ │ ├── SqlServerGeometry.java
│ │ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ └── support
│ │ │ │ ├── CollectionGeometryBuilder.java
│ │ │ │ ├── DecodeException.java
│ │ │ │ ├── GeometryBuilder.java
│ │ │ │ ├── Holder.java
│ │ │ │ ├── LinearPositionsHolder.java
│ │ │ │ ├── LinearPositionsListHolder.java
│ │ │ │ ├── PointHolder.java
│ │ │ │ ├── PolygonListHolder.java
│ │ │ │ ├── SimpleGeometryBuilder.java
│ │ │ │ └── package-info.java
│ │ │ ├── crs
│ │ │ ├── AngularUnit.java
│ │ │ ├── CartesianCoordinateSystem2D.java
│ │ │ ├── CartesianCoordinateSystem2DM.java
│ │ │ ├── CartesianCoordinateSystem3D.java
│ │ │ ├── CartesianCoordinateSystem3DM.java
│ │ │ ├── CompoundCoordinateReferenceSystem.java
│ │ │ ├── CoordinateReferenceSystem.java
│ │ │ ├── CoordinateReferenceSystems.java
│ │ │ ├── CoordinateSystem.java
│ │ │ ├── CoordinateSystemAxis.java
│ │ │ ├── CoordinateSystemAxisDirection.java
│ │ │ ├── CrsExtendedId.java
│ │ │ ├── CrsId.java
│ │ │ ├── CrsIdentifiable.java
│ │ │ ├── CrsParameter.java
│ │ │ ├── CrsRegistry.java
│ │ │ ├── Datum.java
│ │ │ ├── Ellipsoid.java
│ │ │ ├── EllipsoidalAxis.java
│ │ │ ├── EllipsoidalCoordinateSystem2D.java
│ │ │ ├── EllipsoidalCoordinateSystem2DM.java
│ │ │ ├── EllipsoidalCoordinateSystem3D.java
│ │ │ ├── EllipsoidalCoordinateSystem3DM.java
│ │ │ ├── EllipsoidalHeightCSAXis.java
│ │ │ ├── Extension.java
│ │ │ ├── GeocentricCartesianCoordinateReferenceSystem.java
│ │ │ ├── GeodeticLatitudeCSAxis.java
│ │ │ ├── GeodeticLongitudeCSAxis.java
│ │ │ ├── Geographic2DCoordinateReferenceSystem.java
│ │ │ ├── Geographic3DCoordinateReferenceSystem.java
│ │ │ ├── GeographicCoordinateReferenceSystem.java
│ │ │ ├── InconsistentCoordinateSystemException.java
│ │ │ ├── LinearCoordinateReferenceSystem.java
│ │ │ ├── LinearUnit.java
│ │ │ ├── MeasureStraightLineAxis.java
│ │ │ ├── OneDimensionCoordinateReferenceSystem.java
│ │ │ ├── OneDimensionCoordinateSystem.java
│ │ │ ├── PrimeMeridian.java
│ │ │ ├── ProjectedCoordinateReferenceSystem.java
│ │ │ ├── Projection.java
│ │ │ ├── SingleCoordinateReferenceSystem.java
│ │ │ ├── StraightLineAxis.java
│ │ │ ├── Unit.java
│ │ │ ├── UnsupportedCoordinateReferenceSystem.java
│ │ │ ├── VerticalCoordinateReferenceSystem.java
│ │ │ ├── VerticalDatum.java
│ │ │ ├── VerticalStraightLineAxis.java
│ │ │ ├── package.html
│ │ │ └── trans
│ │ │ │ ├── ConcatenatedOperation.java
│ │ │ │ ├── CoordinateFrameRotation.java
│ │ │ │ ├── CoordinateOperation.java
│ │ │ │ ├── CoordinateOperations.java
│ │ │ │ ├── EnvelopeTransform.java
│ │ │ │ ├── Geographic3DTo2DConversion.java
│ │ │ │ ├── GeographicToGeocentricConversion.java
│ │ │ │ ├── PositionVectorTransformation.java
│ │ │ │ ├── TransformOperation.java
│ │ │ │ ├── TransformOperations.java
│ │ │ │ ├── TransformVisitor.java
│ │ │ │ ├── UnsupportedTransformException.java
│ │ │ │ ├── WithEpsgGOperationMethod.java
│ │ │ │ └── projections
│ │ │ │ ├── LambertConformalConic2SP.java
│ │ │ │ ├── Projections.java
│ │ │ │ └── PseudoMercator.java
│ │ │ ├── curve
│ │ │ ├── MortonCode.java
│ │ │ ├── MortonContext.java
│ │ │ └── package-info.java
│ │ │ ├── generator
│ │ │ ├── AbstractGeometryGenerator.java
│ │ │ ├── Choice.java
│ │ │ ├── CombinedGeometryGenerator.java
│ │ │ ├── DefaultGeometryCollectionGenerator.java
│ │ │ ├── DefaultLineStringGenerator.java
│ │ │ ├── DefaultMultiLineStringGenerator.java
│ │ │ ├── DefaultMultiPointGenerator.java
│ │ │ ├── DefaultMultiPolygonGenerator.java
│ │ │ ├── DefaultPointGenerator.java
│ │ │ ├── DefaultPolygonGenerator.java
│ │ │ ├── Generator.java
│ │ │ ├── GeometryGenerators.java
│ │ │ ├── PositionGenerator.java
│ │ │ ├── PropertyMapGenerator.java
│ │ │ └── ValueGeneratorFactory.java
│ │ │ ├── jts
│ │ │ ├── JTS.java
│ │ │ ├── JTSConversionException.java
│ │ │ ├── JTSUtils.java
│ │ │ ├── PointSequenceCoordinateSequenceFactory.java
│ │ │ └── package-info.java
│ │ │ └── package.html
│ └── resources
│ │ ├── spatial_ref_sys.txt
│ │ └── spatial_ref_sys_license
│ └── test
│ ├── java
│ ├── TestSettings.java
│ └── org
│ │ └── geolatte
│ │ ├── geom
│ │ ├── AssertHelpers.java
│ │ ├── BoxTest.java
│ │ ├── CastBehaviorTest.java
│ │ ├── ContainsTest.java
│ │ ├── CrsMock.java
│ │ ├── DecimalDegreeTest.java
│ │ ├── ExactCoordinatePositionEqualityTest.java
│ │ ├── ForceToCrsTest.java
│ │ ├── LineSegmentsTest.java
│ │ ├── LineStringTest.java
│ │ ├── LinearRingTest.java
│ │ ├── MeasuredTestCases.java
│ │ ├── MultiLineStringTest.java
│ │ ├── MultiPointTest.java
│ │ ├── NestedPositionSequenceTest.java
│ │ ├── PackedPointSequenceTest.java
│ │ ├── PointTest.java
│ │ ├── PolygonTest.java
│ │ ├── PositionSequenceBuilderTest.java
│ │ ├── PositionSequenceIteratorTest.java
│ │ ├── PositionSequencePositionEqualityTest.java
│ │ ├── PositionTest.java
│ │ ├── SerializableTest.java
│ │ ├── TestDefaultMeasureGeometryOperations.java
│ │ ├── TestEnvelope.java
│ │ ├── TestJTSGeometryOperations.java
│ │ ├── TestVector.java
│ │ ├── VariableSizePointSequenceBuilderTest.java
│ │ ├── builder
│ │ │ └── client
│ │ │ │ └── DslTest.java
│ │ ├── cga
│ │ │ ├── CircleTest.java
│ │ │ ├── CircularArcLinearizerTest.java
│ │ │ └── NumericalMethodsTest.java
│ │ ├── codec
│ │ │ ├── HANACodecUnitTests.java
│ │ │ ├── MySqlCodecUnitTests.java
│ │ │ ├── TestByteBuffer.java
│ │ │ ├── TestByteBufferInvalidCharacters.java
│ │ │ ├── TestCrsWktDecoder.java
│ │ │ ├── TestCrsWktTokenizer.java
│ │ │ ├── TestCrsWktWordMatcher.java
│ │ │ ├── TestEWktDecodingWithCrsSpecified.java
│ │ │ ├── TestMySqlWkbCodec.java
│ │ │ ├── TestPostgisJDBCUnitTests.java
│ │ │ ├── TestPostgisJDBCWithSRIDUnitTests.java
│ │ │ ├── TestPostgisWkbEncoderDecoder.java
│ │ │ ├── TestPostgisWkbV2EncoderDecoder.java
│ │ │ ├── TestPostgisWktEncoderDecoder.java
│ │ │ ├── TestSfa110WktWkbCodec.java
│ │ │ ├── TestSfa121WktWkbCodec.java
│ │ │ ├── TestSimpleTokenizer.java
│ │ │ ├── TestWkbCodecBugs.java
│ │ │ ├── TestWkbDecodingIdempotent.java
│ │ │ ├── TestWktDecodingBugs.java
│ │ │ ├── TestWktDecodingIdempotent.java
│ │ │ ├── db
│ │ │ │ ├── db2
│ │ │ │ │ └── Db2ClobEncoderDecoderTest.java
│ │ │ │ ├── oracle
│ │ │ │ │ ├── GeogratTests.java
│ │ │ │ │ ├── SDOElemInfoSpecTest.java
│ │ │ │ │ ├── SDOElemInfoTest.java
│ │ │ │ │ ├── SDOGTypeTest.java
│ │ │ │ │ ├── SDOGeometryHelper.java
│ │ │ │ │ ├── SmallArcBugTest.java
│ │ │ │ │ ├── TestForIssue140.java
│ │ │ │ │ ├── TestForIssue67.java
│ │ │ │ │ ├── TestGeometryCollectionSdoDecoder.java
│ │ │ │ │ ├── TestGeometryCollectionSdoEncoder.java
│ │ │ │ │ ├── TestLineStringSdoDecoder.java
│ │ │ │ │ ├── TestLineStringSdoEncoder.java
│ │ │ │ │ ├── TestMultiLineSdoCodec.java
│ │ │ │ │ ├── TestMultiPointSdoCodec.java
│ │ │ │ │ ├── TestMultiPolygonSdoCodec.java
│ │ │ │ │ ├── TestPointSdoDecoder.java
│ │ │ │ │ ├── TestPointSdoEncoder.java
│ │ │ │ │ ├── TestPolygonSdoDecoder.java
│ │ │ │ │ ├── TestPolygonSdoEncoder.java
│ │ │ │ │ ├── TestSdoEncodeBug78.java
│ │ │ │ │ └── TestSdoGeometryPointDecoder.java
│ │ │ │ └── sqlserver
│ │ │ │ │ └── TestSqlServerCodec.java
│ │ │ └── testcases
│ │ │ │ ├── BoundingBoxTest.java
│ │ │ │ ├── CodecUnitTestBase.java
│ │ │ │ ├── HANAJDBCUnitTestInputs.java
│ │ │ │ ├── HANAJDBCWithSRIDTestInputs.java
│ │ │ │ ├── MySqlUnitTestInputs.java
│ │ │ │ ├── PostgisJDBCUnitTestInputs.java
│ │ │ │ ├── PostgisJDBCWithSRIDTestInputs.java
│ │ │ │ ├── PostgisTestCases.java
│ │ │ │ ├── Sfa110WktWkbTestCases.java
│ │ │ │ ├── Sfa121WktWkbTestCases.java
│ │ │ │ ├── WktWkbCodecTestBase.java
│ │ │ │ └── XmlDatabaseCodecTestCases.java
│ │ ├── crs
│ │ │ ├── SerializableTest.java
│ │ │ ├── TestCoordinateReferenceSystem.java
│ │ │ ├── TestCrsExtendedId.java
│ │ │ ├── TestCrsId.java
│ │ │ ├── TestCrsIdenttity.java
│ │ │ ├── testCrsRegistry.java
│ │ │ └── trans
│ │ │ │ ├── ConcatenatedCoordinateOperationTest.java
│ │ │ │ ├── CoordinateOperationsTest.java
│ │ │ │ ├── GeographicToGeocentricConversionTest.java
│ │ │ │ ├── PositionVectorTransformationTest.java
│ │ │ │ ├── TestEnvelopeTransform.java
│ │ │ │ ├── TestTransformVisitor.java
│ │ │ │ ├── TestTransformVisitorExt.java
│ │ │ │ └── projections
│ │ │ │ ├── LambertCC2SPTest.java
│ │ │ │ └── PseudoMercatorTest.java
│ │ ├── curve
│ │ │ ├── MortonCodeTest.java
│ │ │ └── MortonContextTest.java
│ │ ├── generators
│ │ │ └── GeneratorsTest.java
│ │ ├── jts
│ │ │ ├── JTSUtilsTest.java
│ │ │ ├── ReverseTest.java
│ │ │ └── TestJTS.java
│ │ └── support
│ │ │ └── generator
│ │ │ ├── CircleGenerator.java
│ │ │ ├── Generator.java
│ │ │ ├── PositionGenerator.java
│ │ │ └── StdGenerators.java
│ │ └── test
│ │ └── GeometryApiTest.java
│ └── resources
│ ├── log4j.properties
│ └── sqlserver-test-data.xml
├── json
├── README.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── geolatte
│ │ └── geom
│ │ └── json
│ │ ├── BoxSerializer.java
│ │ ├── CrsDeserializer.java
│ │ ├── CrsSerializer.java
│ │ ├── FeatureCollectionDeserializer.java
│ │ ├── FeatureCollectionSerializer.java
│ │ ├── FeatureDeserializer.java
│ │ ├── FeatureSerializer.java
│ │ ├── GeoJsonFeature.java
│ │ ├── GeoJsonFeatureCollection.java
│ │ ├── GeoJsonProcessingException.java
│ │ ├── GeolatteGeomModule.java
│ │ ├── GeometryDeserializer.java
│ │ ├── GeometrySerializer.java
│ │ ├── Setting.java
│ │ └── Settings.java
│ └── test
│ └── java
│ └── org
│ └── geolatte
│ └── geom
│ └── json
│ ├── CrsDynamicegistrationTest.java
│ ├── CrsSupportTest.java
│ ├── Crss.java
│ ├── FeatureCollectionDeserializationTest.java
│ ├── FeatureCollectionSerializationTest.java
│ ├── FeatureDeserializationTest.java
│ ├── FeatureSerializationTest.java
│ ├── ForceCrsToDefaultTest.java
│ ├── GeoJsonStrings.java
│ ├── GeoJsonTest.java
│ ├── GeometryCollectionSerializationTest.java
│ ├── GeometryColllectionDeserializationTest.java
│ ├── GeometryDeserializationTest.java
│ ├── IgnoreCrsTest.java
│ ├── LineStringDeserializationTest.java
│ ├── LineStringSerializationTest.java
│ ├── MultiLineStringDeserializationTest.java
│ ├── MultiLineStringSerializationTest.java
│ ├── MultiPointDeserializationTest.java
│ ├── MultiPointSerializationTest.java
│ ├── MultiPolygonDeserializationTest.java
│ ├── MultiPolygonSerializationTest.java
│ ├── PointDeserializationTest.java
│ ├── PointSerializationTest.java
│ ├── PolygonDeserializerTest.java
│ ├── PolygonSerializationTest.java
│ └── UrnCrsSupportTest.java
├── pom.xml
└── scala
├── .scalafmt.conf
├── build.sbt
├── circe-geojson
└── src
│ ├── main
│ └── scala
│ │ └── org
│ │ └── geolatte
│ │ └── geom
│ │ └── circe
│ │ ├── GeoJsonCodec.scala
│ │ └── WktJsonCodec.scala
│ └── test
│ └── scala
│ └── org
│ └── geolatte
│ └── geom
│ └── circejson
│ ├── GeoJsonGen.scala
│ ├── GeometryDecodersSpec.scala
│ ├── GeometryEncodersSpec.scala
│ └── WktJsonCodecSpec.scala
├── geom
└── src
│ ├── main
│ └── scala
│ │ └── org
│ │ └── geolatte
│ │ └── geom
│ │ └── syntax
│ │ └── GeometryImplicits.scala
│ └── test
│ └── scala
│ └── org
│ └── geolatte
│ └── geom
│ └── syntax
│ └── ImplicitConversionTests.scala
├── play-json-28
└── src
│ ├── main
│ └── scala
│ │ └── org
│ │ └── geolatte
│ │ └── geom
│ │ └── playjson
│ │ └── GeometryJsonFormats.scala
│ └── test
│ └── scala
│ └── org
│ └── geolatte
│ └── geom
│ └── playjson
│ ├── GeoJsonStringGenerator.scala
│ └── GeometryReadersTest.scala
├── project
├── build.properties
└── plugins.sbt
└── slick
└── src
└── main
└── scala
└── org
└── geolatte
└── slick
└── GeolattePgPostGISSupport.scala
/.github/workflows/java-ci.yml:
--------------------------------------------------------------------------------
1 | name: Java CI
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build_on_jdk11:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - uses: actions/checkout@v4
11 | - name: Set up JDK 11
12 | uses: actions/setup-java@v4
13 | with:
14 | java-version: 11
15 | distribution: 'temurin'
16 | - name: Cache Maven packages
17 | uses: actions/cache@v4
18 | with:
19 | path: ~/.m2
20 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
21 | restore-keys: ${{ runner.os }}-m2
22 | - name: Build with Maven
23 | run: mvn --batch-mode --update-snapshots verify
24 |
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | atlassian-ide-plugin.xml
2 | *.idea
3 | *.iml
4 | *.ipr
5 | *.iws
6 | target
7 | javadoc/*
8 | **/.classpath
9 | **/.project
10 | **/.settings
11 | **/bin**/logs/
12 | **/project/*-shim.sbt
13 | **/project/project/
14 | **/project/target/
15 | **/target/
16 | **/.flattened-pom.xml
17 | deploy-release.sh
18 | .sdkmanrc
19 |
--------------------------------------------------------------------------------
/copyright-template.vml:
--------------------------------------------------------------------------------
1 | This file is part of the GeoLatte project.
2 |
3 | GeoLatte is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU Lesser General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | GeoLatte is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU Lesser General Public License for more details.
12 |
13 | You should have received a copy of the GNU Lesser General Public License
14 | along with GeoLatte. If not, see
boolean equals(Geometry
first, Geometry
second) {
21 | return super.equals(first, second);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/BufferAccessException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see
Position
s to be equal if and only if
26 | * the have the same coordinates.
27 | * dimensions.
28 | *
29 | * @author Karel Maesen, Geovise BVBA
30 | * creation-date: 4/13/12
31 | */
32 | public class ExactPositionEquality extends AbstractPositionEquality {
33 |
34 | @Override
35 | protected boolean equals(double co1, double co2) {
36 | return co1 == co2;
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/Feature.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | import java.util.Map;
4 |
5 | /**
6 | * Models a spatial feature
7 | *
8 | * Created by Karel Maesen, Geovise BVBA on 13/07/2018.
9 | */
10 | public interface Feature< P extends Position, ID> {
11 |
12 | final static String TYPE = "Feature";
13 |
14 | Geometry getGeometry();
15 |
16 | ID getId();
17 |
18 | Map getBbox();
21 |
22 | default String getType(){
23 | return TYPE;
24 | }
25 |
26 | default Object getProperty(String propertyName) {
27 | return getProperties().get(propertyName);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/FeatureCollection.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | import java.util.List;
4 |
5 | public interface FeatureCollection {
6 |
7 | String TYPE = "FeatureCollection";
8 |
9 | List getBbox();
12 |
13 | default String getType() {
14 | return TYPE;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/G2D.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * A {@code Position} in a geographic coordinate reference system.
5 | *
6 | * @author Karel Maesen, Geovise BVBA
7 | * creation-date: 2/19/14
8 | */
9 | public class G2D extends Position {
10 |
11 |
12 | /**
13 | * Constructs an empty instance
14 | */
15 | public G2D() {
16 | super();
17 | }
18 |
19 | /**
20 | * Constructs an instance with the specified longitude and latitude
21 | *
22 | * @param lon the longitude
23 | * @param lat the latitude
24 | */
25 | public G2D(double lon, double lat) {
26 | super(lon, lat);
27 | }
28 |
29 | /**
30 | * Constructs an instance from the specified coordinates.
31 | *
32 | * It expects first the longitude, then the latitude coordinate
33 | * @param coords
34 | */
35 | protected G2D(double... coords) {
36 | super(coords);
37 | }
38 |
39 | /**
40 | * Returns the longitude of this position
41 | * @return the longitude of this position
42 | */
43 | public double getLon() {
44 | return getCoordinate(0);
45 | }
46 |
47 | /**
48 | * Returns the latitude of this position
49 | * @return the latitude of this position
50 | */
51 | public double getLat() {
52 | return getCoordinate(1);
53 | }
54 |
55 | @Override
56 | public int getCoordinateDimension() {
57 | return 2;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/G2DM.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * A geographic {@code Position} with a measure value.
5 | *
6 | * @author Karel Maesen, Geovise BVBA
7 | * creation-date: 2/19/14
8 | */
9 | public class G2DM extends G2D implements Measured {
10 |
11 |
12 | public G2DM() {
13 | super();
14 | }
15 |
16 | public G2DM(double lon, double lat, double m) {
17 | super(lon, lat, m);
18 | }
19 |
20 | @Override
21 | public double getM() {
22 | return getCoordinate(2);
23 | }
24 |
25 | @Override
26 | public int getCoordinateDimension() {
27 | return 3;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/G3D.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * A geographic {@code Position} with an altitude.
5 | *
6 | * @author Karel Maesen, Geovise BVBA
7 | * creation-date: 2/19/14
8 | */
9 | public class G3D extends G2D {
10 |
11 | public G3D() {
12 | super();
13 | }
14 |
15 | public G3D(double lon, double lat, double alt) {
16 | super(lon, lat, alt);
17 | }
18 |
19 | protected G3D(double... coords) {
20 | super(coords);
21 | }
22 |
23 | public double getHeight() {
24 | return getCoordinate(2);
25 | }
26 |
27 | @Override
28 | public int getCoordinateDimension() {
29 | return 3;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/G3DM.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * A geographic {@code Position} with both an altitude and a measure value.
5 | *
6 | * @author Karel Maesen, Geovise BVBA
7 | * creation-date: 2/19/14
8 | */
9 | public class G3DM extends G3D implements Measured {
10 |
11 | public G3DM() {
12 | super();
13 | }
14 |
15 | public G3DM(double lon, double lat, double alt, double m) {
16 | super(lon, lat, alt, m);
17 | }
18 |
19 | @Override
20 | public double getM() {
21 | return getCoordinate(3);
22 | }
23 |
24 | @Override
25 | public int getCoordinateDimension() {
26 | return 4;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/GeometryCollection.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
4 |
5 | /**
6 | * Created by Karel Maesen, Geovise BVBA on 2019-07-29.
7 | */
8 | public class GeometryCollection extends AbstractGeometryCollection > {
9 |
10 |
11 | @SafeVarargs
12 | public GeometryCollection(Geometry ... geoms) {
13 | super(geoms);
14 | }
15 |
16 | public GeometryCollection(CoordinateReferenceSystem crs) {
17 | super(crs);
18 | }
19 |
20 | @SuppressWarnings("unchecked")
21 | public boolean equals(Geometry first, Geometry second);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/GeometryOperation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see The This visitor is for high performance applications. The PositionSequence that accepts the visitor passes each
7 | * coordinate as an array. LLAPositionVisitor mkCombiningVisitor(PositionSequenceBuilder builder){
6 | return new CombiningVisitor<>(builder);
7 | }
8 | }
9 |
10 | class CombiningVisitor implements LLAPositionVisitor {
11 |
12 | final PositionSequenceBuilder builder;
13 |
14 | CombiningVisitor(PositionSequenceBuilder builder) {
15 | this.builder = builder;
16 | }
17 |
18 | /**
19 | * The visit method that is executed for each coordinate.
20 | *
21 | * @param coordinate the visited coordinate in array representation
22 | */
23 | @Override
24 | public void visit(double[] coordinate) {
25 | this.builder.add(coordinate);
26 | }
27 |
28 | PositionSequence result() {
29 | return builder.toPositionSequence();
30 | }
31 | }
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/Linear.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see {
31 |
32 | /**
33 | * Returns the start position of the linear {@code Geometry}
34 | *
35 | * @return the start position of the linear {@code Geometry}
36 | */
37 | public P getStartPosition();
38 |
39 | /**
40 | * Returns the end position of the linear {@code Geometry}
41 | *
42 | * @return the end position of the linear {@code Geometry}
43 | */
44 | public P getEndPosition();
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/M.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 29/11/14.
5 | */
6 | public class M extends Position {
7 |
8 | /**
9 | * Constructs an empty instance
10 | */
11 | public M() {
12 | super();
13 | }
14 |
15 | /**
16 | * Constructs an instance with the specified longitude and latitude
17 | *
18 | * @param value the vertical value
19 | */
20 | public M(double value) {
21 | super(value);
22 | }
23 |
24 | /**
25 | * Constructs an instance from the specified coordinates.
26 | *
27 | * It expects first the longitude, then the latitude coordinate
28 | *
29 | * @param coords
30 | */
31 | protected M(double... coords) {
32 | super(coords);
33 | }
34 |
35 | public double getValue() {
36 | return getCoordinate(0);
37 | }
38 |
39 | @Override
40 | public int getCoordinateDimension() {
41 | return 1;
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/Measured.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | /**
4 | * Interface for {@code Position}s that have a "measure" value.
5 | *
6 | * @author Karel Maesen, Geovise BVBA
7 | * creation-date: 2/19/14
8 | */
9 | public interface Measured {
10 |
11 | /**
12 | * Returns the measure value of this instance.
13 | *
14 | * @return the measure value of this instance.
15 | */
16 | double getM();
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/Polygonal.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/PositionFactory.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
7 | */
8 | public interface PositionFactory extends Serializable {
9 |
10 | public Class forClass();
11 |
12 | public int getCoordinateDimension();
13 |
14 | public P mkPosition(double... coordinates);
15 |
16 | //the next three methods are required for interoperability with JTS coordinates
17 |
18 | public boolean hasZComponent();
19 |
20 | public boolean hasMComponent();
21 |
22 | public int getMComponentIndex();
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/PositionSequenceEquality.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see Implementations must be thread-safe. boolean equals(PositionSequence first, PositionSequence second);
42 |
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/PositionVisitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see {
31 |
32 | /**
33 | * The visit method to be executed for each Position
34 | *
35 | * @param position Position to visit
36 | */
37 | public void visit(P position);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/Simple.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see A DSL to simplify the creation of Geometries.
6 | *
7 | * Note:this Decoder is to be used in combination with the DB2 EWKT transform group created by David Adler.See the
8 | * Hibernate documentation for the DB2 Dialect.
9 | *
10 | * Created by Karel Maesen,Geovise BVBA on 05/06/17.
11 | */
12 |
13 | public class Db2WktDecoder extends HANAWktDecoder {
14 |
15 | //DB2 and HANA use the same (E)WKT format, so we just inherit (so later we can substitute a different implementation should the need arise
16 | }
17 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Db2WktEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | /**
4 | * An EWKT encoder for DB2 as used in Hibernate Spatial
5 | *
6 | *
7 | * Note: this Encoder is to be used in combination with the DB2 EWKT transform group created by David Adler. See the
8 | * Hibernate documentation for the DB2 Dialect.
9 | *
10 | * Created by Karel Maesen, Geovise BVBA on 05/06/17.
11 | */
12 | public class Db2WktEncoder extends HANAWktEncoder {
13 |
14 | //DB2 and HANA use the same (E)WKT format, so we just inherit.
15 | //Later we can substitute a different implementation should the need arise.
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/HANAWkbDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.*;
4 |
5 | class HANAWkbDialect extends WkbDialect {
6 |
7 | final public static HANAWkbDialect INSTANCE = new HANAWkbDialect();
8 |
9 | private HANAWkbDialect() {
10 | }
11 |
12 | @Override
13 | boolean emptyPointAsNaN() {
14 | return false;
15 | }
16 |
17 | @Override
18 | GeometryType parseType(long tpe) {
19 | return super.parseType((tpe & 0xFFFF) % 100);
20 | }
21 |
22 | protected int calculateSize(Geometry geom, boolean includeSrid) {
23 | int size = 1 + ByteBuffer.UINT_SIZE; //size for order byte + type field
24 | if (includeSrid) {
25 | size += 4;
26 | }
27 | if (geom.isEmpty()) return size + ByteBuffer.UINT_SIZE;
28 | return size + geometrySize(geom);
29 | }
30 |
31 | @Override
32 | BaseWkbVisitor mkVisitor(Geometry geom, ByteOrder bo) {
33 | return new HANAWkbVisitor<>(mkByteBuffer(geom, bo), this);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/MySqlWkbDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.AbstractGeometryCollection;
4 | import org.geolatte.geom.ByteBuffer;
5 | import org.geolatte.geom.Geometry;
6 | import org.geolatte.geom.Position;
7 |
8 | class MySqlWkbDialect extends Sfa110WkbDialect {
9 | final public static WkbDialect INSTANCE = new MySqlWkbDialect();
10 |
11 | @Override
12 | protected int extraHeaderSize(Geometry geom) {
13 | return 4;
14 | }
15 |
16 | @Override
17 | protected int sizeEmptyGeometry(Geometry geometry) {
18 | return ByteBuffer.UINT_SIZE;
19 | }
20 |
21 | private boolean hasEmpty(Geometry geometry) {
22 | if (geometry.isEmpty()) {
23 | return true;
24 | }
25 | if (geometry instanceof AbstractGeometryCollection) {
26 | for (Geometry part : (AbstractGeometryCollection ) geometry) {
27 | if (hasEmpty(part)) return true;
28 | }
29 | }
30 | return false;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/PostgisWkbV2Dialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Position;
6 |
7 | class PostgisWkbV2Dialect extends PostgisWkbV1Dialect {
8 |
9 | final public static PostgisWkbV2Dialect INSTANCE = new PostgisWkbV2Dialect();
10 |
11 | @Override
12 | boolean emptyPointAsNaN() {
13 | return true;
14 | }
15 |
16 | @Override
17 | protected Long geometryTypeCode(Geometry geometry) {
18 | if (geometry.isEmpty() && geometry.getGeometryType() == GeometryType.POINT) {
19 | return (long) WKB_POINT;
20 | }
21 | return super.geometryTypeCode(geometry);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/PostgisWkbV2Encoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | /**
4 | * A Postgis WKB Encoder that encodes empty points as points with NaN coordinates.
5 | *
6 | * The convention to encode empty points as points with NaN coordinates was
7 | * introduced in Postgis v2.2.2 String encode(Geometry geometry) {
37 | return new BaseWktWriter(PostgisWktDialect.INSTANCE, new StringBuilder()).writeGeometry(geometry);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WkbDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.ByteBuffer;
4 | import org.geolatte.geom.Geometry;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | /**
9 | * A WKB decoder for the format specified in Simple Feature Access, version 1.1.0
10 | */
11 | public class Sfa110WkbDecoder implements WkbDecoder {
12 |
13 |
14 | @Override
15 | public Geometry decode(ByteBuffer byteBuffer, CoordinateReferenceSystem crs) {
16 | BaseWkbParser parser = new BaseWkbParser<>(Sfa110WkbDialect.INSTANCE, byteBuffer, crs);
17 | try {
18 | return parser.parse();
19 | } catch( WkbDecodeException e) {
20 | throw e;
21 | } catch (Throwable e) {
22 | throw new WkbDecodeException(e);
23 | }
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WkbDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.ByteBuffer;
4 | import org.geolatte.geom.ByteOrder;
5 | import org.geolatte.geom.Geometry;
6 | import org.geolatte.geom.Position;
7 |
8 | class Sfa110WkbDialect extends WkbDialect {
9 |
10 | public final static Sfa110WkbDialect INSTANCE = new Sfa110WkbDialect();
11 |
12 | protected Sfa110WkbDialect() {
13 |
14 | }
15 |
16 | protected int getPositionSize(Geometry geom) {
17 | return 2 * ByteBuffer.DOUBLE_SIZE;
18 | }
19 |
20 | @Override
21 | BaseWkbVisitor mkVisitor(Geometry geom, ByteOrder bo) {
22 | ByteBuffer buffer = mkByteBuffer(geom, bo);
23 | return new SFA110WkbVisitor<>(buffer, this);
24 | }
25 | }
26 |
27 | class SFA110WkbVisitor extends BaseWkbVisitor {
28 |
29 | SFA110WkbVisitor(ByteBuffer byteBuffer, WkbDialect dialect) {
30 | super(byteBuffer, dialect);
31 | }
32 |
33 | @Override
34 | protected void writePoint(double[] coordinates, ByteBuffer output) {
35 | output.putDouble(coordinates[0]);
36 | output.putDouble(coordinates[1]);
37 | }
38 | }
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WkbEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.ByteBuffer;
4 | import org.geolatte.geom.ByteOrder;
5 | import org.geolatte.geom.Geometry;
6 | import org.geolatte.geom.Position;
7 |
8 | /**
9 | * A WKB encoder for the format specified in Simple Feature Access, version 1.1.0
10 | */
11 | public class Sfa110WkbEncoder implements WkbEncoder {
12 |
13 | @Override
14 | public ByteBuffer encode(Geometry geometry, ByteOrder byteOrder) {
15 | BaseWkbVisitor visitor = Sfa110WkbDialect.INSTANCE.mkVisitor(geometry, byteOrder);
16 | geometry.accept(visitor);
17 | return visitor.result();
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WktDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 | import org.geolatte.geom.codec.support.Holder;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | public class Sfa110WktDecoder implements WktDecoder {
9 |
10 | @Override
11 | public Geometry decode(String wkt, CoordinateReferenceSystem crs) {
12 | return new Sfa110WktParser<>(wkt, crs).parse();
13 | }
14 |
15 | }
16 |
17 | class Sfa110WktParser extends BaseWktParser {
18 |
19 | private final static WktDialect dialect = new WktDialect();
20 |
21 | Sfa110WktParser(String wkt, CoordinateReferenceSystem crs) {
22 | super(dialect, wkt, crs);
23 | }
24 |
25 | @Override
26 | protected CoordinateReferenceSystem> widenCrsToCoordinateDimension(CoordinateReferenceSystem> crs) {
27 | //don't do this for this dialect
28 | return crs;
29 | }
30 |
31 | protected Holder matchesMultiPointList() {
32 | return matchesPositionList();
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WktDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | /**
4 | * A WKT decoder for the format specified in Simple Feature Access, version 1.1.0
5 | */
6 | class Sfa110WktDialect extends WktDialect {
7 |
8 | public static final Sfa110WktDialect INSTANCE = new Sfa110WktDialect();
9 |
10 | @Override
11 | boolean writeMultiPointAsListOfPositions() {
12 | return true;
13 | }
14 |
15 | @Override
16 | boolean isLimitedTo2D() {
17 | return true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa110WktEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 |
6 | /**
7 | * A WKT encoder for the format specified in Simple Feature Access, version 1.1.0
8 | */
9 | public class Sfa110WktEncoder implements WktEncoder {
10 |
11 | @Override
12 | public String encode(Geometry geometry) {
13 | return new Sfa110WktWriter().writeGeometry(geometry);
14 | }
15 | }
16 |
17 | class Sfa110WktWriter extends BaseWktWriter {
18 |
19 | public Sfa110WktWriter() {
20 | super(Sfa110WktDialect.INSTANCE, new StringBuilder());
21 | }
22 |
23 | @Override
24 | protected void addMultiPointText(Geometry geometry) {
25 | addPointList(geometry.getPositions());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WkbDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.ByteBuffer;
4 | import org.geolatte.geom.Geometry;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | /**
9 | * A WKB decoder for the format specified in Simple Feature Access, version 1.2.1
10 | */
11 | public class Sfa121WkbDecoder implements WkbDecoder {
12 | @Override
13 | public Geometry decode(ByteBuffer byteBuffer, CoordinateReferenceSystem crs) {
14 | BaseWkbParser parser = new BaseWkbParser<>(Sfa121WkbDialect.INSTANCE, byteBuffer, crs);
15 | try {
16 | return parser.parse();
17 | } catch( WkbDecodeException e) {
18 | throw e;
19 | } catch (Throwable e) {
20 | throw new WkbDecodeException(e);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WkbDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Position;
6 |
7 | class Sfa121WkbDialect extends WkbDialect {
8 |
9 | final static Sfa121WkbDialect INSTANCE = new Sfa121WkbDialect();
10 |
11 | @Override
12 | protected Long geometryTypeCode(Geometry geometry) {
13 | Long base = super.geometryTypeCode(geometry);
14 | if (geometry.hasZ()) base += 1000L;
15 | if (geometry.hasM()) base += 2000L;
16 | return base;
17 | }
18 |
19 | @Override
20 | GeometryType parseType(long tpe) {
21 | long t = tpe % 1000L;
22 | return super.parseType(t);
23 | }
24 |
25 | @Override
26 | boolean hasZ(long tpe) {
27 | return (tpe > 1000 && tpe < 2000) || tpe > 3000;
28 | }
29 |
30 | @Override
31 | boolean hasM(long tpe) {
32 | return tpe > 2000;
33 | }
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WkbEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.ByteBuffer;
4 | import org.geolatte.geom.ByteOrder;
5 | import org.geolatte.geom.Geometry;
6 | import org.geolatte.geom.Position;
7 |
8 | /**
9 | * A WKB encoder for the format specified in Simple Feature Access, version 1.2.1
10 | */
11 | public class Sfa121WkbEncoder implements WkbEncoder {
12 |
13 | @Override
14 | public ByteBuffer encode(Geometry geometry, ByteOrder byteOrder) {
15 | BaseWkbVisitor visitor = Sfa121WkbDialect.INSTANCE.mkVisitor(geometry, byteOrder);
16 | geometry.accept(visitor);
17 | return visitor.result();
18 | }
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WktDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
6 |
7 | /**
8 | * A WKT decoder for the format specified in Simple Feature Access, version 1.2.1
9 | */
10 | public class Sfa121WktDecoder implements WktDecoder {
11 |
12 | @Override
13 | public Geometry decode(String wkt, CoordinateReferenceSystem crs) {
14 | return new Sfa121WktParser<>(wkt, crs).parse();
15 | }
16 |
17 | }
18 |
19 | class Sfa121WktParser extends BaseWktParser {
20 |
21 | Sfa121WktParser(String wkt, CoordinateReferenceSystem crs) {
22 | super(Sfa110WktDialect.INSTANCE, wkt, crs);
23 | }
24 |
25 | @Override
26 | protected void matchesOptionalZMMarkers() {
27 | tokenizer.skipWhitespace();
28 | if (tokenizer.matchesOneOf('Z', 'z').isPresent()) {
29 | this.hasZMark = true;
30 | }
31 | if (tokenizer.matchesOneOf('M', 'm').isPresent()) {
32 | this.hasMMark = true;
33 | }
34 | }
35 |
36 |
37 | }
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WktDialect.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 |
5 | class Sfa121WktDialect extends WktDialect{
6 |
7 | final static Sfa121WktDialect INSTANCE = new Sfa121WktDialect();
8 |
9 | @Override
10 | void addGeometryZMMarker(StringBuilder buffer, Geometry> geometry) {
11 | if (!(geometry.hasZ() || geometry.hasM())) return;
12 |
13 | if (geometry.hasZ() && geometry.hasM()) buffer.append(" ZM");
14 | else if (geometry.hasZ()) buffer.append(" Z");
15 | else if (geometry.hasM()) buffer.append(" M");
16 |
17 | if(!geometry.isEmpty())
18 | buffer.append(' ');
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/Sfa121WktEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 |
6 | /**
7 | * A WKT encoder for the format specified in Simple Feature Access, version 1.2.1
8 | */
9 | public class Sfa121WktEncoder implements WktEncoder {
10 |
11 | @Override
12 | public String encode(Geometry geometry) {
13 | return new BaseWktWriter(Sfa121WktDialect.INSTANCE, new StringBuilder()).writeGeometry(geometry);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/UnsupportedConversionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see In general String encode(Geometry geometry);
41 | }
42 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/WktNumberToken.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see > N encode(G geom);
37 |
38 | boolean accepts(Geometry geom);
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/db2/Db2ClobEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.db2;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 | import org.geolatte.geom.codec.Wkt;
6 | import org.geolatte.geom.codec.WktEncoder;
7 | import org.geolatte.geom.codec.db.Encoder;
8 |
9 | /**
10 | * An {@code Encoder} for DB2 as used in Hibernate Spatial
11 | *
12 | * Note: this Encoder is to be used in combination with the DB2 EWKT transform group created by David Adler. See the
13 | * Hibernate documentation for the DB2 Dialect.
14 | *
15 | *
16 | * Created by Karel Maesen, Geovise BVBA on 04/06/17.
17 | */
18 | public class Db2ClobEncoder implements Encoder > String encode(G geom) {
22 | WktEncoder encoder = Wkt.newEncoder(Wkt.Dialect.DB2_WKT);
23 | return encoder.encode(geom);
24 | }
25 |
26 | @Override
27 | public boolean accepts(Geometry geom) {
28 | return false;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/AbstractSDODecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.Position;
5 | import org.geolatte.geom.codec.db.Decoder;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Karel Maesen, Geovise BVBA on 17/02/15.
12 | */
13 | abstract public class AbstractSDODecoder implements Decoder Geometry decode(SDOGType gtype, List crs);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/Decoders.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.codec.db.Decoder;
5 |
6 | import java.sql.Struct;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 19/03/15.
10 | */
11 | public class Decoders {
12 |
13 | public static Decoder Geometry decode(SDOGType gtype, List crs) {
30 | assert (elements.size() <= 1);
31 | return new LineString(elements.get(0).linearizedPositions(gtype, crs), crs);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/LineStringSdoEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Position;
6 |
7 | /**
8 | * Created by Karel Maesen, Geovise BVBA on 01/04/15.
9 | */
10 | public class LineStringSdoEncoder extends AbstractSDOEncoder {
11 | @Override
12 | public boolean accepts(Geometry geom) {
13 | return GeometryType.LINESTRING.equals(geom.getGeometryType());
14 | }
15 |
16 | @Override
17 | public > SDOGeometry encode(G geom) {
18 | final int dim = geom.getCoordinateDimension();
19 | final int lrsPos = getLRSDim(geom);
20 | final boolean isLrs = lrsPos > 0;
21 | final Double[] ordinates = convertPositionSequence(geom.getPositions());
22 | final ElemInfo info = new ElemInfo(1);
23 | info.setElement(0, 1, ElementType.LINE_STRAIGTH_SEGMENTS);
24 | return new SDOGeometry(
25 | new SDOGType(dim, lrsPos, SdoGeometryType.LINE),
26 | geom.getSRID(),
27 | null,
28 | info,
29 | new Ordinates(ordinates));
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/MultiLineSdoDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.LineString;
5 | import org.geolatte.geom.MultiLineString;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
8 |
9 | import java.util.List;
10 | import java.util.stream.Collectors;
11 |
12 | /**
13 | * Created by Karel Maesen, Geovise BVBA on 19/03/15.
14 | */
15 | public class MultiLineSdoDecoder extends AbstractSDODecoder {
16 |
17 | @Override
18 | public boolean accepts(SDOGeometry nativeGeom) {
19 | return nativeGeom.getGType().getTypeGeometry() == SdoGeometryType.MULTILINE;
20 | }
21 |
22 | @Override
23 | @SuppressWarnings("unchecked")
24 | Geometry> internalDecode() {
25 | return decode(nativeGeom.getGType(), nativeGeom.getElements(), nativeGeom.getCoordinateReferenceSystem());
26 | }
27 |
28 | @SuppressWarnings("unchecked")
29 | @Override
30 | protected Geometry decode(SDOGType gtype, List crs) {
31 | List boolean accepts(Geometry geom) {
14 | return GeometryType.MULTILINESTRING.equals(geom.getGeometryType());
15 | }
16 |
17 | @Override
18 | @SuppressWarnings("unchecked")
19 | public > SDOGeometry encode(G geom) {
20 | MultiLineString multiLineString = (MultiLineString ) geom;
21 | final int dim = multiLineString.getCoordinateDimension();
22 | final int lrsDim = getLRSDim(multiLineString);
23 | final boolean isLrs = (lrsDim != 0);
24 |
25 | SDOGType sdoGtype = new SDOGType(dim, lrsDim, SdoGeometryType.MULTILINE);
26 |
27 | final ElemInfo info = new ElemInfo(multiLineString.getNumGeometries());
28 | int oordinatesOffset = 1;
29 | Double[] ordinates = new Double[]{};
30 | for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
31 | info.setElement(i, oordinatesOffset, ElementType.LINE_STRAIGTH_SEGMENTS);
32 | ordinates = addOrdinates(ordinates, convertPositionSequence(multiLineString.getGeometryN(i).getPositions()));
33 | oordinatesOffset = ordinates.length + 1;
34 | }
35 | return new SDOGeometry(sdoGtype, geom.getSRID(), null, info, new Ordinates(ordinates));
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/MultiPointSdoDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.MultiPoint;
5 | import org.geolatte.geom.Point;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by Karel Maesen, Geovise BVBA on 19/03/15.
13 | */
14 | public class MultiPointSdoDecoder extends AbstractSDODecoder {
15 |
16 | @Override
17 | public boolean accepts(SDOGeometry nativeGeom) {
18 | return nativeGeom.getGType().getTypeGeometry() == SdoGeometryType.MULTIPOINT;
19 | }
20 |
21 | @Override
22 | @SuppressWarnings("unchecked")
23 | Geometry> internalDecode() {
24 | return decode(nativeGeom.getGType(), nativeGeom.getElements()
25 | , nativeGeom.getCoordinateReferenceSystem());
26 | }
27 |
28 | @SuppressWarnings({"rawtypes", "unchecked"})
29 | @Override
30 | protected Geometry decode(SDOGType gtype, List crs) {
31 | Point[] pnts = elements.stream()
32 | .map(el -> el.linearizedPositions(gtype, crs))
33 | .flatMap(pos -> pos.stream().map(p -> new Point(p, crs)))
34 | .toArray(Point[]::new);
35 | return pnts.length > 0 ? new MultiPoint(pnts) : new MultiPoint(crs);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/MultiPolygonSdoDecoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.*;
4 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by Karel Maesen, Geovise BVBA on 19/03/15.
11 | */
12 | public class MultiPolygonSdoDecoder extends AbstractSDODecoder {
13 |
14 | @Override
15 | public boolean accepts(SDOGeometry nativeGeom) {
16 | return nativeGeom.getGType().getTypeGeometry() == SdoGeometryType.MULTIPOLYGON;
17 | }
18 |
19 | @Override
20 | @SuppressWarnings("unchecked")
21 | Geometry> internalDecode() {
22 | return decode(nativeGeom.getGType(), nativeGeom.getElements(), nativeGeom.getCoordinateReferenceSystem());
23 | }
24 |
25 | @Override
26 | protected Geometry decode(SDOGType gtype, List crs) {
27 | List )decoder.decode(gtype, rings, crs));
33 | rings.clear();
34 | }
35 | rings.add(element);
36 | }
37 | if (!rings.isEmpty()) {
38 | polys.add((Polygon )decoder.decode(gtype, rings, crs));
39 | }
40 | return polys.isEmpty() ?
41 | new MultiPolygon<>(crs) :
42 | new MultiPolygon<>(polys.toArray(new Polygon[0]));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/MultiPolygonSdoEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.*;
4 |
5 | /**
6 | * Created by Karel Maesen, Geovise BVBA on 01/04/15.
7 | */
8 | public class MultiPolygonSdoEncoder extends AbstractSDOEncoder {
9 | @Override
10 | public boolean accepts(Geometry geom) {
11 | return GeometryType.MULTIPOLYGON.equals(geom.getGeometryType());
12 | }
13 |
14 | @Override
15 | @SuppressWarnings("unchecked")
16 | public > SDOGeometry encode(G geom) {
17 | MultiPolygon multiPolygon = (MultiPolygon ) geom;
18 | final int dim = multiPolygon.getCoordinateDimension();
19 | final int lrsPos = getLRSDim(multiPolygon);
20 |
21 | SDOGType gType = new SDOGType(dim, lrsPos, SdoGeometryType.MULTIPOLYGON);
22 | SDOGeometry sdoGeom = new SDOGeometry(gType, geom.getSRID(), null, null, null);
23 | for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
24 | try {
25 | final Polygon pg = multiPolygon.getGeometryN(i);
26 | sdoGeom = addPolygon(sdoGeom, pg);
27 | } catch (Exception e) {
28 | throw new RuntimeException("Found geometry that was not a geometry in MultiPolygon", e);
29 | }
30 | }
31 | return sdoGeom;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/PointSdoEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Position;
6 |
7 | /**
8 | * Created by Karel Maesen, Geovise BVBA on 01/04/15.
9 | */
10 | public class PointSdoEncoder extends AbstractSDOEncoder {
11 |
12 | @Override
13 | public boolean accepts(Geometry geom) {
14 | return GeometryType.POINT.equals(geom.getGeometryType());
15 | }
16 |
17 | @Override
18 | public > SDOGeometry encode(G geom) {
19 | final int dim = geom.getCoordinateDimension();
20 | final int lrsDim = getLRSDim(geom);
21 | final boolean isLrs = (lrsDim != 0);
22 |
23 | final Double[] coord = convertPositionSequence(geom.getPositions());
24 |
25 | if (Settings.useSdoPointType() && !isLrs && !geom.isEmpty()) {
26 | return new SDOGeometry(
27 | new SDOGType(dim, lrsDim, SdoGeometryType.POINT),
28 | geom.getSRID(),
29 | new SDOPoint(coord), null, null
30 | );
31 | }
32 |
33 | final ElemInfo info = new ElemInfo(1);
34 | info.setElement(0, 1, ElementType.POINT);
35 | return new SDOGeometry(
36 | new SDOGType(dim, lrsDim, SdoGeometryType.POINT),
37 | geom.getSRID(),
38 | null,
39 | info,
40 | new Ordinates(coord)
41 | );
42 |
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/PolygonSdoEncoder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Polygon;
6 | import org.geolatte.geom.Position;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 01/04/15.
10 | */
11 | public class PolygonSdoEncoder extends AbstractSDOEncoder {
12 | @Override
13 | public boolean accepts(Geometry geom) {
14 | return GeometryType.POLYGON.equals(geom.getGeometryType());
15 | }
16 |
17 | @Override
18 | public > SDOGeometry encode(G geom) {
19 | final int dim = geom.getCoordinateDimension();
20 | final int lrsPos = getLRSDim(geom);
21 |
22 | SDOGType sdogType = new SDOGType(dim, lrsPos, SdoGeometryType.POLYGON);
23 | SDOGeometry base = new SDOGeometry(sdogType, geom.getSRID(), null, null, null);
24 | Polygon> polygon = (Polygon>) geom;
25 | return addPolygon(base, polygon);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/oracle/Settings.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.db.oracle;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 04/12/16.
5 | */
6 | public class Settings {
7 |
8 | final public static String USE_SDO_POINT = "GEOLATTE_USE_SDO_POINT_TYPE";
9 |
10 |
11 | public static boolean useSdoPointType() {
12 | String use = System.getProperty(USE_SDO_POINT);
13 | return determineValue(use);
14 | }
15 |
16 | private static boolean determineValue(String val) {
17 | if (val == null) return false;
18 | return val.equalsIgnoreCase("true") || val.equalsIgnoreCase("1");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/db/sqlserver/IndexRange.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see
5 | * Created by maesenka on 07/10/14.
6 | */
7 | package org.geolatte.geom.codec.db.sqlserver;
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Encoder/Decoder classes for serializing Geometries and Coordinate Reference Systems.
3 | *
4 | * Created by maesenka on 07/10/14.
5 | */
6 | package org.geolatte.geom.codec;
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/support/CollectionGeometryBuilder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.support;
2 |
3 | import org.geolatte.geom.Geometries;
4 | import org.geolatte.geom.Geometry;
5 | import org.geolatte.geom.GeometryType;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 | import java.util.stream.Collectors;
12 |
13 | public class CollectionGeometryBuilder extends GeometryBuilder {
14 | final private List Geometry createGeometry(CoordinateReferenceSystem crs) {
21 | if (components.isEmpty()) return Geometries.mkEmptyGeometry(GeometryType.GEOMETRYCOLLECTION, crs);
22 | List Geometry createGeometry(CoordinateReferenceSystem crs);
18 |
19 | abstract public int getCoordinateDimension();
20 |
21 | abstract public void setPositions(Holder positions);
22 |
23 | abstract public boolean isEmpty();
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/support/Holder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.support;
2 |
3 | import org.geolatte.geom.Geometry;
4 | import org.geolatte.geom.GeometryType;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 09/09/17.
10 | */
11 | abstract public class Holder {
12 |
13 | abstract public boolean isEmpty();
14 |
15 | abstract public int getCoordinateDimension();
16 |
17 | abstract public Geometry toGeometry(CoordinateReferenceSystem crs, GeometryType geomType);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/support/PolygonListHolder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.support;
2 |
3 | import org.geolatte.geom.*;
4 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import java.util.stream.Collectors;
9 |
10 | /**
11 | * Created by Karel Maesen, Geovise BVBA on 11/09/17.
12 | */
13 | public class PolygonListHolder extends Holder {
14 |
15 | final private List Geometry toGeometry(CoordinateReferenceSystem crs, GeometryType geomType) {
33 | return isEmpty() ? Geometries.mkEmptyMultiPolygon(crs) : Geometries.mkMultiPolygon(toPolygons(crs));
34 | }
35 |
36 | List crs) {
37 | return spcs.stream().map(lph ->
38 | lph.isEmpty() ? Geometries.mkEmptyPolygon(crs) : Geometries.mkPolygon(lph.toLinearRings(crs))
39 | ).collect(Collectors.toList());
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/support/SimpleGeometryBuilder.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.codec.support;
2 |
3 | import org.geolatte.geom.Geometries;
4 | import org.geolatte.geom.Geometry;
5 | import org.geolatte.geom.GeometryType;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
8 |
9 | public class SimpleGeometryBuilder extends GeometryBuilder {
10 | final private GeometryType type;
11 | private Holder positions;
12 |
13 | public SimpleGeometryBuilder(GeometryType type) {
14 | this.type = type;
15 | }
16 |
17 | public Geometry createGeometry(CoordinateReferenceSystem crs) {
18 | if (positions == null || positions.isEmpty()) return Geometries.mkEmptyGeometry(type, crs);
19 | return positions.toGeometry(crs, type);
20 | }
21 |
22 | @Override
23 | public int getCoordinateDimension() {
24 | return positions == null || positions.isEmpty() ? 2 : positions.getCoordinateDimension();
25 | }
26 |
27 | @Override
28 | public void setPositions(Holder positions) {
29 | this.positions = positions;
30 | }
31 |
32 | @Override
33 | public boolean isEmpty() {
34 | return positions == null || positions.isEmpty();
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/support/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This package contains data structures useful when decoding {@code Geometry}s from WKT/WKB or GEOJSON
3 | */
4 | package org.geolatte.geom.codec.support;
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/AngularUnit.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | /**
4 | * Angular units
5 | *
6 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
7 | */
8 | public class AngularUnit extends Unit {
9 |
10 | /**
11 | * Creates an instance.
12 | *
13 | * @param crsId
14 | * @param name
15 | * @param conversionFactor
16 | */
17 | public AngularUnit(CrsId crsId, String name, double conversionFactor) {
18 | super(crsId, name, conversionFactor);
19 | }
20 |
21 | @Override
22 | public AngularUnit getFundamentalUnit() {
23 | return Unit.RADIAN;
24 | }
25 |
26 | @Override
27 | public boolean isAngular() {
28 | return true;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/CartesianCoordinateSystem3DM.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | import org.geolatte.geom.C3DM;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
10 | */
11 | public class CartesianCoordinateSystem3DM extends CoordinateSystem If authority EPSG and 0 or -1 is passed for the code parameter, a value equal to extends CoordinateSystem {
10 |
11 | private final Class posType;
12 |
13 | public OneDimensionCoordinateSystem(StraightLineAxis axis, Class posType){
14 | super(axis);
15 | this.posType = posType;
16 | }
17 |
18 |
19 | /**
20 | * Returns the single axis in the coordinate system.
21 | * @return
22 | */
23 | public CoordinateSystemAxis getAxis() {
24 | return getAxis(0);
25 | }
26 |
27 | @Override
28 | public Class getPositionClass() {
29 | return posType;
30 | }
31 |
32 | @Override
33 | public CoordinateSystem> merge(OneDimensionCoordinateSystem> coordinateSystem) {
34 | throw new UnsupportedOperationException();
35 | }
36 |
37 | @Override
38 | public CoordinateSystem> extend(CoordinateSystemAxis axis) {
39 | throw new UnsupportedOperationException();
40 | }
41 |
42 | @Override
43 | public boolean hasZ() {
44 | return getAxis().getNormalOrder() == 2;
45 | }
46 |
47 | @Override
48 | public boolean hasM() {
49 | return getAxis().getNormalOrder() == 3;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/SingleCoordinateReferenceSystem.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | import org.geolatte.geom.Position;
4 |
5 | /**
6 | * A Coordinate reference system consisting of one Coordinate System and one Datum (as opposed to a Compound CRS)
7 | *
8 | * Created by Karel Maesen, Geovise BVBA on 29/11/14.
9 | */
10 | abstract public class SingleCoordinateReferenceSystem extends CoordinateReferenceSystem {
11 |
12 | /**
13 | * Constructs a
22 | coordinateSystem) {
23 | super(crsId, name, coordinateSystem);
24 | }
25 |
26 | @Override
27 | public boolean isCompound() {
28 | return false;
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/StraightLineAxis.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | /**
4 | * A straight line axis for us in cartesian, vertical or linear coordinate systems
5 | *
6 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
7 | */
8 | public class StraightLineAxis extends CoordinateSystemAxis {
9 | /**
10 | * Creates an instance.
11 | *
12 | * @param axisName the name for this axis
13 | * @param coordinateSystemAxisDirection the direction for this axis
14 | * @param unit the unit of this axis
15 | */
16 | public StraightLineAxis(String axisName, CoordinateSystemAxisDirection coordinateSystemAxisDirection, LinearUnit
17 | unit) {
18 | super(axisName, coordinateSystemAxisDirection, unit);
19 | }
20 |
21 | public StraightLineAxis(String axisName, CoordinateSystemAxisDirection coordinateSystemAxisDirection, int normalOrder, Unit unit) {
22 | super(axisName, coordinateSystemAxisDirection, normalOrder, unit);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/UnsupportedCoordinateReferenceSystem.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 2019-03-24.
5 | */
6 | public class UnsupportedCoordinateReferenceSystem extends RuntimeException {
7 |
8 | public UnsupportedCoordinateReferenceSystem(CrsId crsId) {
9 | super(String.format("CRS %s is not supported", crsId));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/VerticalCoordinateReferenceSystem.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | import org.geolatte.geom.V;
4 |
5 | /**
6 | *
7 | * Created by Karel Maesen, Geovise BVBA on 29/11/14.
8 | */
9 | public class VerticalCoordinateReferenceSystem extends SingleCoordinateReferenceSystem
6 | * Determines how elevation is to be interpreted. See this Wikipedia page).
7 | * It is modeled here as in the OGC specification "OpenGIS Implementation Specification: Coordinate Transformation Services" (rev. 1.00)"
8 | * {
11 |
12 | final private TransformOperation operation;
13 |
14 | public EnvelopeTransform(TransformOperation operation) {
15 | this.operation = operation;
16 |
17 | }
18 |
19 | public Envelope envelope) {
20 | P ll = envelope.lowerLeft();
21 | P ur = envelope.upperRight();
22 | Q tll = operation.forward(ll);
23 | Q tur = operation.forward(ur);
24 | return new Envelope<>(tll, tur, operation.getTarget());
25 | }
26 |
27 | public Envelope reverse(Envelope {
11 |
12 | CoordinateReferenceSystem getSource();
13 | CoordinateReferenceSystem > implements Generator bbox;
15 | protected final Random rnd;
16 |
17 | public AbstractGeometryGenerator(Box bbox, Random rnd) {
18 | this.bbox = bbox;
19 | this.rnd = rnd;
20 | }
21 |
22 | @Override
23 | abstract public G generate();
24 |
25 | protected CoordinateReferenceSystem crs() {
26 | return this.bbox.getCoordinateReferenceSystem();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/Choice.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import java.util.List;
4 | import java.util.Random;
5 |
6 | /**
7 | * Created by Karel Maesen, Geovise BVBA on 2019-08-16.
8 | */
9 | public class Choice implements Generator generate() {
24 | int idx = chooser.nextInt(generators.size());
25 | return generators.get(idx).generate();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultGeometryCollectionGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.*;
4 | import org.geolatte.geom.builder.DSL;
5 |
6 | import java.util.Random;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
10 | */
11 | class DefaultGeometryCollectionGenerator implements Generator generate() {
25 | Geometry [] geoms = (Geometry []) new Geometry[numGeoms-1];
26 | baseGenerator.generateArray(geoms);
27 | return DSL.geometrycollection(baseGenerator.generate(), geoms);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultLineStringGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.Box;
4 | import org.geolatte.geom.LineString;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.builder.DSL;
7 |
8 | import java.util.Random;
9 |
10 | /**
11 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
12 | */
13 | class DefaultLineStringGenerator extends AbstractGeometryGenerator > {
14 |
15 | final private int size;
16 | final private boolean closed;
17 |
18 | DefaultLineStringGenerator(int size, Box bbox, Random rnd) {
19 | super(bbox, rnd);
20 | this.size = size;
21 | this.closed = false;
22 | }
23 |
24 | @Override
25 | public LineString generate() {
26 | P[] ps = PositionGenerator.nPositionsWithin(size, bbox, rnd);
27 | if (closed) {
28 | ps[ps.length - 1] = ps[0];
29 | }
30 | return DSL.linestring(crs(), ps);
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultMultiLineStringGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.*;
4 | import org.geolatte.geom.builder.DSL;
5 |
6 | import java.util.Random;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
10 | */
11 | class DefaultMultiLineStringGenerator extends AbstractGeometryGenerator > {
12 |
13 | private final int numLineString;
14 | private final DefaultLineStringGenerator lineStrGen;
15 |
16 | DefaultMultiLineStringGenerator(int numLineString, int numPoints, Box bbox, Random rnd) {
17 | super(bbox, rnd);
18 | this.numLineString = numLineString;
19 | this.lineStrGen = new DefaultLineStringGenerator<>(numPoints, bbox, rnd);
20 | }
21 |
22 | @Override
23 | public MultiLineString generate() {
24 | LineString [] linestrings = (LineString []) new LineString[numLineString - 1];
25 | lineStrGen.generateArray(linestrings);
26 | return DSL.multilinestring(lineStrGen.generate(), linestrings);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultMultiPointGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.Box;
4 | import org.geolatte.geom.MultiPoint;
5 | import org.geolatte.geom.Point;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.builder.DSL;
8 |
9 | import java.util.Random;
10 |
11 | /**
12 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
13 | */
14 | class DefaultMultiPointGenerator extends AbstractGeometryGenerator > {
15 |
16 |
17 | final private Generator bbox, Random rnd) {
20 | super(bbox, rnd);
21 | this.numPnts = numPnts;
22 | pntGen = new DefaultPointGenerator<>(bbox, rnd);
23 | }
24 |
25 | @Override
26 | public MultiPoint generate() {
27 | Point [] points = (Point []) new Point[numPnts - 1];
28 | pntGen.generateArray(points);
29 | return DSL.multipoint(pntGen.generate(), points);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultMultiPolygonGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.*;
4 | import org.geolatte.geom.builder.DSL;
5 |
6 | import java.util.Random;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
10 | */
11 | class DefaultMultiPolygonGenerator extends AbstractGeometryGenerator >{
12 |
13 |
14 | private final int numPolys;
15 | private final DefaultPolygonGenerator polyGen;
16 |
17 | DefaultMultiPolygonGenerator(int numPolys, int numPoints, Box bbox, Random rnd) {
18 | super(bbox, rnd);
19 | this.numPolys = numPolys;
20 | this.polyGen = new DefaultPolygonGenerator<>(numPoints, bbox, rnd);
21 | }
22 |
23 | @Override
24 | public MultiPolygon generate() {
25 | Polygon [] polys = (Polygon []) new Polygon[numPolys - 1];
26 | polyGen.generateArray(polys);
27 | return DSL.multipolygon(polyGen.generate(), polys);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultPointGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.Box;
4 | import org.geolatte.geom.Point;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.builder.DSL;
7 |
8 | import java.util.Random;
9 |
10 |
11 | import static org.geolatte.geom.generator.PositionGenerator.positionWithin;
12 |
13 | /**
14 | * Created by Karel Maesen, Geovise BVBA on 03/08/2018.
15 | */
16 | class DefaultPointGenerator extends AbstractGeometryGenerator > {
17 |
18 | DefaultPointGenerator(Box bbox, Random rnd) {
19 | super(bbox, rnd);
20 | }
21 |
22 | @Override
23 | public Point generate() {
24 | return DSL.point(crs(), positionWithin(bbox, rnd) );
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/DefaultPolygonGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.Box;
4 | import org.geolatte.geom.LinearRing;
5 | import org.geolatte.geom.Polygon;
6 | import org.geolatte.geom.Position;
7 | import org.geolatte.geom.builder.DSL;
8 |
9 | import java.util.Random;
10 |
11 |
12 | import static org.geolatte.geom.builder.DSL.ring;
13 | import static org.geolatte.geom.generator.PositionGenerator.nPositionsWithinAndClosed;
14 |
15 | /**
16 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
17 | */
18 | class DefaultPolygonGenerator extends AbstractGeometryGenerator > {
19 |
20 | final private int numPoints;
21 |
22 | DefaultPolygonGenerator(int numPoints, Box bbox, Random rnd) {
23 | super(bbox, rnd);
24 | this.numPoints = numPoints;
25 | }
26 |
27 | @Override
28 | public Polygon generate() {
29 | P[] ps = nPositionsWithinAndClosed(numPoints, bbox, rnd);
30 | LinearRing hull = ring(crs(), ps);
31 | return DSL.polygon(hull);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/Generator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 2019-08-16.
5 | */
6 | public interface Generator GeometryCollection
as(Class
castToType){
22 | checkCast(castToType);
23 | return (GeometryCollection
)this;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/GeometryEquality.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see
Geometry
s.
26 | *
27 | * @author Karel Maesen, Geovise BVBA
28 | * creation-date: 4/13/12
29 | */
30 | public interface GeometryEquality {
31 |
32 | /**
33 | * Checks whether the first geometry equals
34 | * the second, for some definition of equality.
35 | *
36 | * @param first a Geometry
37 | * @param second a second Geometry
38 | * @return true if and only if both both Geometry
s are equal.
39 | */
40 | public Geometry
.
26 | *
27 | * GeometryOperation
interface makes it easy to use the Strategy Pattern and implement different
28 | * algorithms for certain geometric or topological operations. PositionSequence
equality.
26 | *
27 | * PositionSequence
s are equal.
36 | *
37 | * @param first
38 | * @param second
39 | * @return true if two PositionSequence
s are equal, false otherwise.
40 | */
41 | public Position
s.
26 | *
27 | * @author Karel Maesen, Geovise BVBA
28 | * creation-date: 5/3/11
29 | */
30 | public interface PositionVisitorWktEncoder
implementations are not be thread-safe.Geometry
instance to encode
38 | * @return a WKT representation of the specified object.
39 | */
40 | WktToken
for numbers.
26 | *
27 | * @author Karel Maesen, Geovise BVBA
28 | * creation-date: 11/19/11
29 | */
30 | class WktNumberToken implements WktToken {
31 |
32 | private final double number;
33 |
34 | public WktNumberToken(double number) {
35 | super();
36 | this.number = number;
37 | }
38 |
39 | public double getNumber() {
40 | return number;
41 | }
42 |
43 | public String toString() {
44 | return String.valueOf(number);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/codec/WktPunctuationToken.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see CrsId.UNDEFINED
is returned.
17 | *
18 | * param base base CrsId
19 | * @return a CrsId
for the specified authority and code.
20 | */
21 | CrsExtendedId(CrsId base, Unit verticalUnit, Unit measureUnit) {
22 | super(base.getAuthority(), base.getCode());
23 | this.verticalUnit = verticalUnit;
24 | this.measureUnit = measureUnit;
25 | }
26 |
27 | @Override
28 | public boolean equals(Object o) {
29 | if (this == o) return true;
30 | if (o == null || getClass() != o.getClass()) return false;
31 | if (!super.equals(o)) return false;
32 | CrsExtendedId that = (CrsExtendedId) o;
33 | return Objects.equals(verticalUnit, that.verticalUnit) &&
34 | Objects.equals(measureUnit, that.measureUnit);
35 | }
36 |
37 | @Override
38 | public int hashCode() {
39 | return Objects.hash(super.hashCode(), verticalUnit, measureUnit);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/EllipsoidalAxis.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
5 | */
6 | abstract public class EllipsoidalAxis extends CoordinateSystemAxis {
7 |
8 |
9 | EllipsoidalAxis(String axisName, CoordinateSystemAxisDirection coordinateSystemAxisDirection, Unit unit) {
10 | super(axisName, coordinateSystemAxisDirection, unit);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/EllipsoidalCoordinateSystem3DM.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs;
2 |
3 | import org.geolatte.geom.G3DM;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by Karel Maesen, Geovise BVBA on 28/11/14.
10 | */
11 | public class EllipsoidalCoordinateSystem3DM extends CoordinateSystemCoordinateReferenceSystem
uniquely
20 | * @param name the commonly used name for this CoordinateReferenceSystem
21 | * @param coordinateSystem the coordinate system to use @throws java.lang.IllegalArgumentException if less than
22 | * two {@link org.geolatte.geom.crs.CoordinateSystemAxis CoordinateSystemAxes} are passed.
23 | */
24 | public Geographic3DCoordinateReferenceSystem(CrsId crsId, String name, EllipsoidalCoordinateSystem3D coordinateSystem) {
25 | super(crsId, name, coordinateSystem);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/InconsistentCoordinateSystemException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the GeoLatte project.
3 | *
4 | * GeoLatte is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * GeoLatte is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with GeoLatte. If not, see HorizontalCoordinateReferenceSystem
.
14 | *
15 | * @param crsId the {@link org.geolatte.geom.crs.CrsId} that identifies this
16 | * CoordinateReferenceSystem
uniquely
17 | * @param name the commonly used name for this CoordinateReferenceSystem
18 | * @param coordinateSystem the coordinate system to use @throws java.lang.IllegalArgumentException if less than
19 | * two {@link org.geolatte.geom.crs.CoordinateSystemAxis CoordinateSystemAxes} are passed.
20 | */
21 | public SingleCoordinateReferenceSystem(CrsId crsId, String name, CoordinateSystem forward(Envelope
envelope) {
28 | Q ll = envelope.lowerLeft();
29 | Q ur = envelope.upperRight();
30 | P tll = operation.reverse(ll);
31 | P tur = operation.reverse(ur);
32 | return new Envelope<>(tll, tur, operation.getSource());
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/trans/Geographic3DTo2DConversion.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs.trans;
2 |
3 | /**
4 | * Converts between a Geographic 3D and a 2D system
5 | *
6 | * EPSG Method 9659
7 | * Created by Karel Maesen, Geovise BVBA on 20/07/17.
8 | */
9 | public class Geographic3DTo2DConversion implements CoordinateOperation, WithEpsgGOperationMethod {
10 |
11 | final private double height;
12 |
13 | public Geographic3DTo2DConversion(double height) {
14 | this.height = height;
15 | }
16 |
17 |
18 | public Geographic3DTo2DConversion() {
19 | this(0.0d);
20 | }
21 |
22 | @Override
23 | public boolean isReversible() {
24 | return true;
25 | }
26 |
27 | @Override
28 | public int inCoordinateDimension() {
29 | return 3;
30 | }
31 |
32 | @Override
33 | public int outCoordinateDimension() {
34 | return 2;
35 | }
36 |
37 | @Override
38 | public void forward(double[] inCoordinate, double[] outCoordinate) {
39 | System.arraycopy(inCoordinate, 0, outCoordinate, 0, 2);
40 | }
41 |
42 | @Override
43 | public void reverse(double[] inCoordinate, double[] outCoordinate) {
44 | System.arraycopy(inCoordinate, 0, outCoordinate, 0, 2);
45 | outCoordinate[2] = height;
46 | }
47 |
48 | @Override
49 | public int getMethodId() {
50 | return 9659;
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/trans/TransformOperation.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs.trans;
2 |
3 | import org.geolatte.geom.Position;
4 | import org.geolatte.geom.Positions;
5 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
6 |
7 | /**
8 | * Created by Karel Maesen, Geovise BVBA on 2019-03-27.
9 | */
10 | public interface TransformOperation
getTarget();
14 |
15 | CoordinateOperation getOperation();
16 |
17 | default Q forward(P pos) {
18 | double[] out = new double[getTarget().getCoordinateDimension()];
19 | getOperation().forward(pos.toArray(null), out);
20 | return Positions.mkPosition(getTarget().getPositionClass(), out);
21 | }
22 |
23 | default P reverse(Q pos) {
24 | double[] out = new double[getSource().getCoordinateDimension()];
25 | getOperation().reverse(pos.toArray(null), out);
26 | return Positions.mkPosition(getSource().getPositionClass(), out);
27 | }
28 |
29 |
30 | TransformOperation
reversed();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/trans/UnsupportedTransformException.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs.trans;
2 |
3 | import org.geolatte.geom.crs.CrsId;
4 |
5 | /**
6 | * Created by Karel Maesen, Geovise BVBA on 2019-03-24.
7 | */
8 | public class UnsupportedTransformException extends RuntimeException {
9 |
10 | public UnsupportedTransformException(CrsId source, CrsId target) {
11 | super(String.format("Can't find transform from %s to %s", source, target));
12 | }
13 |
14 | public UnsupportedTransformException(CrsId method) {
15 | super(String.format("Can't find operation method with id %s", method));
16 | }
17 |
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/crs/trans/WithEpsgGOperationMethod.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.crs.trans;
2 |
3 | /**
4 | * Created by Karel Maesen, Geovise BVBA on 02/04/2018.
5 | */
6 | public interface WithEpsgGOperationMethod {
7 |
8 | /**
9 | * Returns the EPSG code for the operation method
10 | * @return The EPSG Code for the operation method
11 | */
12 | int getMethodId();
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/curve/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Space-filling curves.
3 | *
4 | * Created by maesenka on 07/10/14.
5 | */
6 | package org.geolatte.geom.curve;
--------------------------------------------------------------------------------
/geom/src/main/java/org/geolatte/geom/generator/AbstractGeometryGenerator.java:
--------------------------------------------------------------------------------
1 | package org.geolatte.geom.generator;
2 |
3 | import org.geolatte.geom.Box;
4 | import org.geolatte.geom.Geometry;
5 | import org.geolatte.geom.Position;
6 | import org.geolatte.geom.crs.CoordinateReferenceSystem;
7 |
8 | import java.util.Random;
9 |
10 | /**
11 | * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
12 | */
13 | abstract class AbstractGeometryGenerator