package leigh.gis.geojson;

import org.geotools.geojson.geom.GeometryJSON;
import org.locationtech.jts.geom.GeometryCollection;
import org.locationtech.jts.geom.Polygon;

import java.io.Reader;
import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Paths;

public class GeoJsonExtractor {
    public static void main(String[] args) throws Exception {
        String content = new String(Files.readAllBytes(Paths.get("/users/aleigh/proj/jlee/wc_ar_taxparcel.geojson")), "UTF-8");
        GeometryJSON gjson = new GeometryJSON();
        Reader reader = new StringReader(content);


        GeometryCollection gc = gjson.readGeometryCollection(reader);


        while (true) {
            Polygon p = gjson.readPolygon(reader);
            if (p == null) break;
            System.out.println("polygon: " + p);
        }
    }
}
