Skip to content

Instantly share code, notes, and snippets.

View ianturton's full-sized avatar
🏠
Working from home

Ian Turton ianturton

🏠
Working from home
View GitHub Profile
package com.ianturton.cookbook.raster;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.geotools.coverage.GridSampleDimension;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ianturton.cookbook</groupId>
<artifactId>modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Cookbook</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>15-SNAPSHOT</geotools.version>
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ianturton.cookbook</groupId>
<artifactId>modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.ianturton.cookbook</groupId>
@ianturton
ianturton / WindingOrder.java
Last active November 6, 2015 11:26
Reorder polygons so you can import them into programs which don't understand Exterior + Interior rings.
package spike;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.geotools.data.DataUtilities;
import org.geotools.data.shapefile.shp.JTSUtilities;
package com.ianturton.w3w;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
@ianturton
ianturton / Buffer
Last active January 30, 2021 16:38
Buffer a GeoTools Linestring, this code creates a new polygon at a specified distance around the provided line.
package com.ianturton.cookbook.operations;
import java.util.List;
import javax.measure.Measure;
import javax.measure.quantity.Length;
import javax.measure.unit.SI;
import org.geotools.data.DataUtilities;
import org.geotools.feature.SchemaException;