Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jericks/734351 to your computer and use it in GitHub Desktop.
Save jericks/734351 to your computer and use it in GitHub Desktop.
GeoScript Groovy Building Style Geometry Transformations
import geoscript.geom.Bounds
import geoscript.map.Map
import geoscript.workspace.Directory
import geoscript.style.*
import geoscript.filter.Function
def dir = new Directory("/Users/jericks/Downloads/OpenGeo Workshop/data/shp-gs")
def layer = dir.get("nyc_buildings")
layer.style = new Style([
new PolygonSymbolizer(
geometry: new Function("offset(the_geom,-6,-6)"),
fillColor: "black",
strokeColor: "black",
strokeWidth: 0.25,
zIndex: 1
),
new PolygonSymbolizer(
geometry: new Function("buffer(the_geom,-5)"),
fillColor: "#333333",
strokeColor: "#222222",
strokeWidth: 0.25,
zIndex: 3
),
new PolygonSymbolizer(
geometry: "the_geom",
fillColor: "#E6E6E6",
strokeColor: "#666666",
strokeWidth: 0.25,
zIndex: 2
)
])
def map = new Map(
backgroundColor: "white",
layers: [layer],
bounds: new Bounds(582724, 4506674, 583896, 4507078)
)
map.render(new File("buildings.png"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment