Created
December 9, 2010 04:55
-
-
Save jericks/734353 to your computer and use it in GitHub Desktop.
GeoScript Groovy Style Geometry Transformation and Formatting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geoscript.layer.* | |
import geoscript.proj.* | |
import geoscript.style.* | |
import geoscript.map.* | |
import geoscript.filter.Function | |
def statesShp = new Shapefile("states.shp") | |
statesShp.style = new Style([ | |
new PolygonSymbolizer( | |
fillColor: "#E6E6E6", | |
strokeColor: "#4C4C4C", | |
strokeWidth: 0.5f | |
), | |
new PointSymbolizer( | |
geometry: new Function("centroid(the_geom)"), | |
fillColor: "#66CCff", | |
strokeColor: "#004080", | |
size: 6f, | |
shape: "circle" | |
), | |
new TextSymbolizer( | |
label: new Function("strToLowerCase(STATE_ABBR)"), | |
color: "#004080", | |
fontWeight: "bold" | |
) | |
]) | |
def map = new Map(width: 600, height: 400, fixAspectRatio: true) | |
map.proj = "EPSG:4326" | |
map.addLayer(statesShp) | |
map.bounds = statesShp.bounds | |
map.render(new File("states.png")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment