Package org.geotools.geojson.feature

Examples of org.geotools.geojson.feature.FeatureJSON


            throw new IOException("FeatureID cannot be null");
        }
        /* Get the layer describing URL*/
        String jsonString = ods.resourceToString("data/" + contentEntry.getName().getLocalPart() + "/" + fnID, null);

        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature feature = fjson.readFeature(new StringReader(SFSDataStoreUtil.strip(jsonString)));

        return feature;
    }
View Full Code Here


            queryURL = SFSDataStoreUtil.encodeQuery(fnQuery, targetSchema);
        }

        // read the feature collection with a streaming reader
        jsonStream = ods.resourceToStream("data/" + layer.getTypeName().getLocalPart(), "mode=features&" + queryURL);
        fjson = new FeatureJSON();
        fjson.setFeatureType(contentState.getFeatureType());
        featureIterator = fjson.streamFeatureCollection(jsonStream);
        fbuilder = new SimpleFeatureBuilder(targetSchema);
    }
View Full Code Here

        featureIterator.close();
    }
   
    public static void main(String[] args) throws Exception {
        String json = "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[43.3599,-11.6515]},\"properties\": {},\"id\":\"null\"}]}";
        FeatureJSON fj = new FeatureJSON();
//        URL url = new URL("http://www.glews-test.net/eisurvtest/data/outbreakMarker?mode=features&bbox=-218.20632812500003%2C-85.6734453125%2C361.860109375%2C116.8704140625&limit=1");
//        InputStream is = url.openStream();
        System.out.println(fj.readFeature(json));
    }
View Full Code Here

        return new GeoRestFeatureReader(getState(), query);
    }

    @Override
    protected SimpleFeatureType buildFeatureType() throws IOException {
        FeatureJSON fjson = new FeatureJSON();
        InputStream in = new URL(url.toString() + "?limit=1").openStream();
        SimpleFeature feature = fjson.readFeature(new StringReader(streamToString(in)));
        return feature.getFeatureType();
    }
View Full Code Here

* @source $URL$
*/
public class Skunkworks {

    public static void main(String[] args) throws Exception {
        FeatureJSON json = new FeatureJSON();
        FeatureCollection fcol = json.readFeatureCollection(new FileInputStream("/Users/jdeolive/states.json"));

        System.out.println(fcol.getSchema().getCoordinateReferenceSystem());
    }
View Full Code Here

    }


    /* Test feature flipping with point geometry*/
    public void testFeatureFlippingWithPointGeom() throws IOException {
        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature sf = fjson.readFeature(reader(strip(getFeatureWithPointGeometry())));

        Geometry fnG = (Geometry) sf.getDefaultGeometry();

        SFSDataStoreUtil.flipFeatureYX(fnG);

View Full Code Here

    }

    /* Test feature flipping with LineString geometry*/
    public void testFeatureFlippingWithLineStringGeom() throws IOException {
        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature sf = fjson.readFeature(reader(strip(getFeatureWithLineStringGeometry())));

        Geometry fnG = (Geometry) sf.getDefaultGeometry();

        SFSDataStoreUtil.flipFeatureYX(fnG);

View Full Code Here

        assertEquals(fnG.getCoordinates()[1].y, 1.3);
    }

    /* Test feature flipping with Polygon w/o holes geometry*/
    public void testFeatureFlippingWithPolygonNoHolesGeom() throws IOException {
        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature sf = fjson.readFeature(reader(strip(getFeatureWithpolygonTyp1Geometry())));

        Geometry fnG = (Geometry) sf.getDefaultGeometry();

        SFSDataStoreUtil.flipFeatureYX(fnG);

View Full Code Here

        assertEquals(fnG.getCoordinates()[4].y, 100.1);
    }

    /* Test feature flipping with Polygon w/ holes geometry*/
    public void testFeatureFlippingWithPolygonHolesGeom() throws IOException {
        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature sf = fjson.readFeature(reader(strip(getFeatureWithpolygonTyp2Geometry())));

        Geometry fnG = (Geometry) sf.getDefaultGeometry();
       
        SFSDataStoreUtil.flipFeatureYX(fnG);

View Full Code Here

        assertEquals(fnG.getCoordinates()[8].y, 100.2);
    }

    /* Test feature flipping with Multi-Point geometry*/
    public void testFeatureFlippingWithMultiPointGeom() throws IOException {
        FeatureJSON fjson = new FeatureJSON();

        SimpleFeature sf = fjson.readFeature(reader(strip(getFeatureWithMultiPointGeometry())));

        Geometry fnG = (Geometry) sf.getDefaultGeometry();

        SFSDataStoreUtil.flipFeatureYX(fnG);

View Full Code Here

TOP

Related Classes of org.geotools.geojson.feature.FeatureJSON

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.