Skip to content

Commit c1f7475

Browse files
committed
Updates for GeoTools 25. Work on release notes.
1 parent 93bea6b commit c1f7475

File tree

5 files changed

+174
-9
lines changed

5 files changed

+174
-9
lines changed

doc/images/carto_scalebar.png

65.2 KB
Loading

doc/releases.rst

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,168 @@
33
GeoScript Groovy Releases
44
=========================
55

6+
1.17.0
7+
------
8+
The 1.17 release of GeoScript is build on Groovy 3.0.7, GeoTools 25.0, and the Java Topology Suite 1.18.1 and requires Java 8.
9+
10+
Added uber jar as an easy way to run and distribute geoscript-groovy::
11+
12+
java -jar geoscript-groovy-app-1.17.0.jar <shell|console|script>
13+
14+
Added Project.toMeters to convert measurements in the projection's native units to meters::
15+
16+
Projection p = new Projection("EPSG:2927")
17+
double meters = p.toMeters(5280)
18+
19+
Added a ScaleBarItem to the carto package::
20+
21+
.. image:: images/carto_scalebar.png
22+
23+
Added JSON and XML MapReaders to create a Map from a string::
24+
25+
String json = """{
26+
"width": 400,
27+
"height": 400,
28+
"type": "png",
29+
"backgroundColor": "blue",
30+
"proj": "EPSG:4326",
31+
"bounds": {
32+
"minX": -135.911779,
33+
"minY": 36.993573,
34+
"maxX": -96.536779,
35+
"maxY": 51.405899
36+
},
37+
"layers": [
38+
{
39+
"layertype": "layer",
40+
"dbtype": "geopkg",
41+
"database": "src/main/resources/data.gpkg",
42+
"layername": "ocean",
43+
"style": "src/main/resources/ocean.sld"
44+
},
45+
{
46+
"layertype": "layer",
47+
"dbtype": "geopkg",
48+
"database": "src/main/resources/data.gpkg",
49+
"layername": "countries",
50+
"style": "src/main/resources/countries.sld"
51+
},
52+
{
53+
"layertype": "layer",
54+
"dbtype": "geopkg",
55+
"database": "src/main/resources/data.gpkg",
56+
"layername": "states",
57+
"style": "src/main/resources/states.sld"
58+
}
59+
]
60+
}
61+
"""
62+
MapReader mapReader = new JsonMapReader()
63+
Map map = mapReader.read(json)
64+
BufferedImage image = map.renderToImage()
65+
66+
Added JSON and XML CartoReaders to create CartoBuilder from a string::
67+
68+
String json = """{
69+
"type": "png",
70+
"width": 400,
71+
"height": 400,
72+
"items": [
73+
{
74+
"x": 0,
75+
"y": 0,
76+
"width": 400,
77+
"height": 400,
78+
"type": "rectangle",
79+
"fillColor": "white",
80+
"strokeColor": "white"
81+
},
82+
{
83+
"x": 10,
84+
"y": 10,
85+
"width": 380,
86+
"height": 380,
87+
"type": "rectangle"
88+
},
89+
{
90+
"x": 20,
91+
"y": 20,
92+
"width": 360,
93+
"height": 360,
94+
"type": "map",
95+
"name": "mainMap",
96+
"proj": "EPSG:4326",
97+
"bounds": {
98+
"minX": -135.911779,
99+
"minY": 36.993573,
100+
"maxX": -96.536779,
101+
"maxY": 51.405899
102+
},
103+
"layers": [
104+
{
105+
"layertype": "layer",
106+
"dbtype": "geopkg",
107+
"database": "src/main/resources/data.gpkg",
108+
"layername": "ocean",
109+
"style": "src/main/resources/ocean.sld"
110+
},
111+
{
112+
"layertype": "layer",
113+
"dbtype": "geopkg",
114+
"database": "src/main/resources/data.gpkg",
115+
"layername": "countries",
116+
"style": "src/main/resources/countries.sld"
117+
},
118+
{
119+
"layertype": "layer",
120+
"dbtype": "geopkg",
121+
"database": "src/main/resources/data.gpkg",
122+
"layername": "states",
123+
"style": "src/main/resources/states.sld"
124+
}
125+
]
126+
},
127+
{
128+
"x": 20,
129+
"y": 20,
130+
"width": 30,
131+
"height": 40,
132+
"type": "northarrow"
133+
},
134+
{
135+
"x": 260,
136+
"y": 20,
137+
"width": 50,
138+
"height": 200,
139+
"type": "legend",
140+
"map": "mainMap"
141+
},
142+
{
143+
"x": 70,
144+
"y": 20,
145+
"width": 170,
146+
"height": 50,
147+
"type": "text",
148+
"text": "Western US",
149+
"font": {
150+
"name": "Arial",
151+
"style": "BOLD",
152+
"size": 24
153+
},
154+
"horizontalAlign": "CENTER",
155+
"verticalAlign": "MIDDLE"
156+
}
157+
]
158+
}
159+
"""
160+
161+
CartoReader cartoReader = new JsonCartoReader()
162+
CartoBuilder cartoBuilder = cartoReader.read(json)
163+
File file = new File("map.png")
164+
file.withOutputStream { OutputStream outputStream ->
165+
cartoBuilder.build(outputStream)
166+
}
167+
6168
1.16.0
7169
------
8170
The 1.16 release of GeoScript is build on Groovy 3.0.5, GeoTools 24.0, and the Java Topology Suite 1.17.1 and requires Java 8.

pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@
3434
<dependency>
3535
<groupId>no.ecc.vectortile</groupId>
3636
<artifactId>java-vector-tile</artifactId>
37-
<version>1.3.10</version>
37+
<version>1.3.13</version>
3838
<exclusions>
3939
<exclusion>
4040
<groupId>com.google.protobuf</groupId>
4141
<artifactId>protobuf-java</artifactId>
4242
</exclusion>
43+
<exclusion>
44+
<groupId>org.locationtech.jts</groupId>
45+
<artifactId>jts-core</artifactId>
46+
</exclusion>
4347
</exclusions>
4448
</dependency>
4549
<dependency>
@@ -567,7 +571,7 @@
567571
</plugins>
568572
</reporting>
569573
<properties>
570-
<gt.version>25-SNAPSHOT</gt.version>
574+
<gt.version>25.0</gt.version>
571575
<groovy.version>3.0.7</groovy.version>
572576
</properties>
573577
<name>geoscript groovy</name>

src/test/groovy/geoscript/geom/GeometryTestCase.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class GeometryTestCase {
326326
String wkt = """POLYGON ((13.63525390625 51.337890625, 13.59130859375 51.337890625, 13.41552734375 51.337890625, 12.44873046875 51.8212890625, 11.04248046875 52.5244140625, 9.98779296875 52.919921875, 8.53759765625 53.359375, 7.52685546875 53.53515625, 6.47216796875 53.6669921875, 5.63720703125 53.6669921875, 5.02197265625 53.6669921875, 4.67041015625 53.6669921875, 4.40673828125 53.4912109375, 4.14306640625 53.2275390625, 3.96728515625 52.919921875, 3.79150390625 52.568359375, 3.65966796875 52.1728515625, 3.52783203125 51.7333984375, 3.35205078125 51.25, 3.13232421875 50.72265625, 2.82470703125 49.931640625, 2.56103515625 49.2724609375, 2.29736328125 48.61328125, 2.07763671875 47.998046875, 1.90185546875 47.4267578125, 1.81396484375 46.8994140625, 1.77001953125 46.4599609375, 1.72607421875 46.1962890625, 1.72607421875 45.8447265625, 1.72607421875 45.6689453125, 1.72607421875 45.44921875, 1.72607421875 45.2734375, 1.72607421875 45.009765625, 1.85791015625 44.5263671875, 2.03369140625 44.21875, 2.25341796875 43.779296875, 2.51708984375 43.4716796875, 2.73681640625 43.2080078125, 3.00048828125 43.0322265625, 3.30810546875 42.9443359375, 3.96728515625 42.900390625, 4.05517578125 42.900390625, 4.31884765625 42.900390625, 4.75830078125 42.7685546875, 5.59326171875 42.5048828125, 6.47216796875 42.2412109375, 7.30712890625 41.93359375, 7.87841796875 41.8017578125, 8.58154296875 41.6259765625, 9.37255859375 41.494140625, 10.03173828125 41.40625, 10.64697265625 41.3623046875, 10.91064453125 41.3623046875, 11.13037109375 41.3623046875, 11.52587890625 41.3623046875, 12.18505859375 41.40625, 13.28369140625 41.7138671875, 14.33837890625 41.9775390625, 14.86572265625 42.197265625, 15.48095703125 42.548828125, 15.87646484375 42.7685546875, 16.18408203125 42.98828125, 16.40380859375 43.2080078125, 16.57958984375 43.427734375, 16.75537109375 43.69140625, 16.88720703125 44.04296875, 17.06298828125 44.482421875, 17.19482421875 45.009765625, 17.45849609375 46.064453125, 17.54638671875 46.328125, 17.63427734375 46.8115234375, 17.67822265625 47.0751953125, 17.67822265625 47.2509765625, 17.67822265625 47.3388671875, 17.63427734375 47.3388671875, 17.54638671875 47.3388671875, 17.28271484375 47.3388671875, 17.01904296875 47.3388671875, 16.62353515625 47.3388671875, 16.27197265625 47.3388671875, 15.87646484375 47.3388671875, 15.52490234375 47.3388671875, 15.21728515625 47.3388671875, 14.90966796875 47.294921875, 14.64599609375 47.2509765625, 14.38232421875 47.1630859375, 14.16259765625 47.1630859375, 13.89892578125 47.0751953125, 13.67919921875 47.03125, 13.45947265625 46.9873046875, 13.19580078125 46.9873046875, 12.97607421875 46.9873046875, 12.80029296875 46.9873046875, 12.58056640625 47.03125, 12.40478515625 47.1630859375, 12.22900390625 47.4267578125, 12.05322265625 47.6904296875, 12.00927734375 47.998046875, 11.96533203125 48.4375, 11.96533203125 48.701171875, 11.96533203125 48.9208984375, 12.00927734375 49.0966796875, 12.18505859375 49.2724609375, 12.36083984375 49.404296875, 12.58056640625 49.580078125, 12.75634765625 49.6240234375, 13.02001953125 49.7119140625, 13.28369140625 49.7119140625, 13.45947265625 49.7119140625, 13.76708984375 49.7119140625, 14.03076171875 49.66796875, 14.25048828125 49.580078125, 14.38232421875 49.4921875, 14.55810546875 49.4482421875, 14.68994140625 49.3603515625, 14.86572265625 49.3603515625, 14.99755859375 49.3603515625, 15.17333984375 49.3603515625, 15.39306640625 49.3603515625, 15.65673828125 49.3603515625, 15.83251953125 49.404296875, 16.00830078125 49.404296875, 16.31591796875 49.4921875, 16.44775390625 49.4921875, 16.57958984375 49.4921875, 16.71142578125 49.4921875, 16.79931640625 49.4921875, 16.88720703125 49.5361328125, 16.97509765625 49.5361328125, 17.01904296875 49.580078125, 17.10693359375 49.6240234375, 17.15087890625 49.66796875, 17.15087890625 49.7119140625, 17.19482421875 49.84375, 17.23876953125 50.01953125, 17.23876953125 50.2392578125, 17.23876953125 50.37109375, 17.28271484375 50.546875, 17.28271484375 50.634765625, 17.28271484375 50.72265625, 17.28271484375 50.7666015625, 17.28271484375 50.810546875, 17.28271484375 50.8544921875, 17.28271484375 50.8984375, 13.63525390625 51.337890625))"""
327327
Geometry g = Geometry.fromWKT(wkt)
328328
Geometry simplified = g.simplify(2)
329-
assertEquals "POLYGON ((13.63525390625 51.337890625, 17.28271484375 50.8984375, 11.96533203125 48.9208984375, 17.67822265625 47.3388671875, 15.87646484375 42.7685546875, 2.25341796875 43.779296875, 4.67041015625 53.6669921875, 13.63525390625 51.337890625))", simplified.wkt
329+
assertEquals "POLYGON ((13.63525390625 51.337890625, 4.67041015625 53.6669921875, 2.25341796875 43.779296875, 15.87646484375 42.7685546875, 17.67822265625 47.3388671875, 11.96533203125 48.9208984375, 17.28271484375 50.8984375, 13.63525390625 51.337890625))", simplified.wkt
330330
}
331331

332332
@Test void simplifyPreservingTopology() {
@@ -339,7 +339,7 @@ class GeometryTestCase {
339339
@Test void densify() {
340340
Geometry g = new LineString([[0,0],[0,10]])
341341
Geometry densifiedGeom = g.densify(1)
342-
assertEquals("LINESTRING (0 0, 0 0.9090909090909092, 0 1.8181818181818183, 0 2.727272727272727, 0 3.6363636363636367, 0 4.545454545454545, 0 5.454545454545454, 0 6.363636363636363, 0 7.272727272727273, 0 8.181818181818182, 0 9.09090909090909, 0 10)", densifiedGeom.wkt)
342+
assertEquals("LINESTRING (0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10)", densifiedGeom.wkt)
343343
}
344344

345345
@Test void minimumRectangle() {

src/test/groovy/geoscript/geom/MultiLineStringTestCase.groovy

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ class MultiLineStringTestCase {
3535
"52.65625, 6.38427734375 50.634765625)"
3636
def lines = new MultiLineString(Geometry.fromWKT(wkt))
3737
def noded = lines.node(5)
38-
assertEquals "MULTILINESTRING ((5.19775390625 51.07421875, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
39-
"(6.4 52.6, 7.52685546875 53.7548828125, 8.2 53.2), (8.2 53.2, 9 52.4), " +
40-
"(9 52.4, 11.65771484375 49.931640625, 7.52685546875 47.20703125, 9 52.4), " +
41-
"(9 52.4, 9.50439453125 54.501953125, 8.2 53.2), (8.2 53.2, 7.35107421875 52.4365234375, 6.4 52.6), " +
42-
"(6.4 52.6, 4.53857421875 52.65625, 5.6 51.6), (5.6 51.6, 6.38427734375 50.634765625))", noded.wkt
38+
assertEquals "MULTILINESTRING ((5.2 51, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
39+
"(6.4 52.6, 7.6 53.8, 8.2 53.2), (8.2 53.2, 9 52.4), (9 52.4, 11.6 50, 7.6 47.2, 9 52.4), " +
40+
"(9 52.4, 9.6 54.6, 8.2 53.2), (8.2 53.2, 7.4 52.4, 6.4 52.6), (6.4 52.6, 4.6 52.6, 5.6 51.6), " +
41+
"(5.6 51.6, 6.4 50.6))", noded.wkt
4342
}
4443

4544
@Test void merge() {

0 commit comments

Comments
 (0)