You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: web/docs/developer/index.md
+20-32Lines changed: 20 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,36 @@
1
1
# JTS Topology Suite Developer’s Guide
2
2
3
-
#OVERVIEW
3
+
## Overview
4
4
5
5
The JTS Topology Suite is a Java API that implements a core set of spatial data operations using an explicit precision model and robust geometric algorithms. It provides a complete model for specifying 2-D linear Geometry. Many common operations in computational geometry and spatial data processing are exposed in a clear, consistent and integrated API. JTS is intended to be used in the development of applications that support the validation, cleaning, integration and querying of spatial datasets.
6
6
7
7
This document is intended for developers who would like to use JTS to accomplish their spatial data processing requirements. It describes common uses of the JTS API and gives code examples.
8
8
9
-
##RESOURCES
9
+
### Resources
10
10
11
11
**OpenGIS Simple Features Specification For SQL Revision 1.1* (referred to as SFS in this document). The reference specification for the spatial data model and the spatial predicates and functions implemented by JTS.
12
12
**JTS Technical Specifications*. The design specification for the classes, methods and algorithms implemented in the JTS Topology Suite.
13
13
**JTS JavaDoc*. Documentation for all of the packages, classes and methods in JTS.
14
14
15
-
#GETTING STARTED
15
+
## Getting Started
16
16
17
-
The most common JTS tasks involve creating and using Geometry objects. The easiest way to create a Geometry by hand is to use a WKTReader to generate one from a Well-Known Text (WKT) string. For example:
17
+
The most common JTS tasks involve creating and using `Geometry` objects. The easiest way to create a `Geometry` by hand is to use a `WKTReader` to generate one from a Well-Known Text (WKT) string. For example:
A precise specification for WKT is given in the *JTS Technical Specifications*. And many examples of WKT may be found in the files in the *test* directory.
23
+
A specification for WKT is given in the *JTS Technical Specifications*. Many examples of WKT may be found in the files in the *test* directory.
24
24
25
-
In a real program, it’s easier to use a GeometryFactory, because you don’t need to build up a WKT string; rather, you work with the objects directly:
25
+
In a real program, it’s better to use a `GeometryFactory`, because you don’t need to build up a WKT string; rather, you work with the objects directly:
Once you’ve made your Geometry, there are many things you can do with it. You can easily find the intersection of two Geometries:
33
+
Once you’ve made a Geometry, there are many things you can do with it. You can easily find the intersection of two geometries:
34
34
35
35
```java
36
36
Geometry g3 = g1.intersection(g2);
@@ -40,7 +40,7 @@ Other computations built into Geometries include: area, envelope, centroid, and
40
40
about what a Geometry can do, see the JavaDoc for Geometry in the `org.loctiontech.jts.geom`
41
41
package, as well as subsequent sections in this document.
42
42
43
-
#COMPUTING SPATIAL RELATIONSHIPS
43
+
## Spatial Relationships
44
44
45
45
An important application of JTS is computing the spatial relationships between Geometries. Various methods of computing relationships are provided. JTS follows the **Dimensionally Extended 9 Intersection Matrix** model specified by the OGC. To compute the DE-9IM for two Geometries, use the relate method:
46
46
@@ -65,7 +65,7 @@ Most relationships of interest can be specified as a pattern which matches a set
65
65
66
66
In some cases the precise definition of the predicates is subtle. You should refer to the JTS Technical Specifications to determine exactly what will be returned in any given case.
67
67
68
-
#COMPUTING OVERLAY OPERATIONS
68
+
## Overlay Operations
69
69
70
70
The previous section discussed functions that return true or false, like Intersects and Contains. We will now present the JTS **overlay operations**, some of which are illustrated in Figure 4-1 below.
71
71
@@ -91,7 +91,7 @@ Descriptions for the overlay operations are tabulated below.
91
91
92
92
As with the spatial relationships described in the previous section, these overlay operations have precise definitions given in the JTS Technical Specifications.
93
93
94
-
#COMPUTING BUFFERS
94
+
## Buffering
95
95
96
96
In GIS, buffering is an operation which in GIS is used to compute the area containing all points within a given distance of a Geometry. In mathematical terms, this is called computing the **Minkowski sum** of the Geometry with a disc of radius equal to the buffer distance. Finding positive and negative buffers is sometimes referred to as the operations of **erosion** and **dilation**. In CAD/CAM buffer curves are called **offset curves**.
97
97
@@ -114,7 +114,7 @@ or a `Point` results in an empty `Geometry`.
114
114
115
115
Buffer distances of 0 are also supported. You can use this to perform an efficient union of multiple polygons.
116
116
117
-
##BASIC BUFFERING
117
+
### Basic Buffers
118
118
119
119
To compute a buffer for a given distance, call the `buffer()` method on the `Geometry`:
120
120
@@ -123,7 +123,7 @@ Geometry g = ...
123
123
Geometry buffer = g.buffer(100.0);
124
124
```
125
125
126
-
##END CAP STYLES
126
+
### End Cap Styles
127
127
128
128
Buffer polygons can be computed with different line **end cap
129
129
styles**. The end cap style determines how the line work for the buffer
Since the exact buffer outline of a Geometry usually contains circular
161
-
sections, the buffer must be approximated by the linear Geometry
161
+
sections, the buffer must be approximated by the linear Geometry
162
162
supported by JTS. The degree of approximation may be controlled by the
163
163
user. In JTS this is done by specifying the number of quadrant segments
164
164
used to approximate a quarter-circle. Specifying a larger number of
@@ -180,7 +180,7 @@ The default number of segments is 8. This gives less than a 2% maximum error in
180
180
181
181
**Figure 5-3 \- Using Different Curve Approximation Levels**
182
182
183
-
#POLYGONIZATION
183
+
## Polygonization
184
184
185
185
Polygonization is the process of forming polygons from linework which encloses areas. Linework to be formed into polygons must be fully noded – that is, linestrings must not cross and must touch only at endpoints.
186
186
@@ -213,7 +213,7 @@ If the set of lines is not correctly noded the Polygonizer will still operate on
213
213
214
214
**Figure 6-1 \- The Polygonization Operation**
215
215
216
-
#**7. MERGING A SET OF LINESTRINGS**
216
+
## Merging Lines
217
217
218
218
Sometimes a spatial operation such as \#union will produce chains of small LineStrings. The JTS LineMerger is a simple utility to sew these small LineStrings together, as shown below.
By default JTS uses arrays of Coordinates to represent the points and lines of Geometries. There are some cases in which you might want Geometries to store their points using some other implementation. For example, to save memory you may want to use a more compact sequence implementation, such as an array of x’s and an array of y’s. Another possibility is to use a custom coordinate class to store extra information on each coordinate, such as measures for linear referencing.
244
244
@@ -260,11 +260,11 @@ A note on performance: If your `CoordinateSequence` is not based on an array of
260
260
marshalling and unmarshalling required for JTS to convert the user coordinates into arrays of JTS
261
261
coordinates.
262
262
263
-
#TIPS & TECHNIQUES
263
+
## Tips & Techniques
264
264
265
-
##NODING A SET OF LINESTRINGS
265
+
### Noding Lines
266
266
267
-
Many spatial operations assume that their input data is **noded**, meaning that `LineStrings` never cross. For
267
+
Many spatial operations expect that their input data is **noded**, meaning that `LineStrings` never cross. For
268
268
example, the JTS `Polygonizer` and the JTS `LineMerger` described earlier assume that their input is noded.
269
269
270
270
The noding process splits `LineStrings` that cross into smaller `LineStrings` that meet at a point, or
@@ -288,16 +288,4 @@ for (int i = 1; i \< lineStrings.size(); i++) {
288
288
}
289
289
```
290
290
291
-
# UNIONING MANY POLYGONS EFFICIENTLY
292
291
293
-
Calling `Polygon.union` repeatedly is one way to union several `Polygons`
294
-
together. But here’s a trick that can be significantly faster (seconds
295
-
rather than minutes) – add the `Polygons` to a `GeometryCollection`,
0 commit comments