Releases: ebocher/geoscript-groovy
Releases · ebocher/geoscript-groovy
1.20-SNAPSHOT
Pre-release aligned with geoscript 1.20-SNAPSHOT.
Updated with H2GIS 2.1.0 and H2 2.1.214
geoscript_h2gis
This release integrates the H2GIS 2.0 database with GeoScript.
To test H2GIS, launch the geoscript groovy console
./geoscript-groovyConsole
Please read the geoscript for more informations https://jericks.github.io/geoscript-groovy-cookbook/#introduction
Note : Tested with Groovy 3.0.9 and 3.0.11
then you can run the demo script
/**
* A script to show how to use H2GIS 2.0.0 with GeoScript
* @author Erwan Bocher
*/
import geoscript.geom.*
import geoscript.viewer.*
import geoscript.workspace.*
import geoscript.render.*
import geoscript.style.*
//Create the H2GIS database
H2GIS h2gis = new H2GIS("/tmp/mygisdb")
//Load geojson file
h2gis.load("/tmp/rsu_lcz.geojson", true)
def lcz_layer = h2gis.get("RSU_LCZ")
println lcz_layer.count
//Create a unique value classification
UniqueValues uniqueValues = new UniqueValues(lcz_layer, "LCZ_PRIMARY")
//Apply the classification
lcz_layer.style = uniqueValues
//Build a map element to render the geojson file
Map map = new Map(
width: 800,
height: 300,
layers: [lcz_layer]
)
//Save the result in a png file
File file = new File("/tmp/map.png")
map.render(file)