Created
March 11, 2012 19:48
-
-
Save jericks/2017856 to your computer and use it in GitHub Desktop.
layer transformation and cleaning
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.Shapefile | |
import geoscript.proj.Projection | |
import geoscript.feature.Field | |
def shp = new Shapefile("test_uk.shp") | |
def out = shp.workspace.create(shp.schema.reproject("EPSG:27700", "test_uk_valid")) | |
out.add(shp.cursor.collect{f -> | |
f.geom = Projection.transform(f.geom, "EPSG:4326", "EPSG:27700") | |
if (!f.geom.isValid()) { | |
f.geom = f.geom.buffer(0) | |
} | |
f | |
}) | |
geoscript.render.Draw.draw(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment