Package org.geotools.data.shapefile.files

Examples of org.geotools.data.shapefile.files.ShpFiles


    writer.close();
    transaction.commit();
    ds.dispose();

    // Read the same file and check the geometry is null
    ShpFiles shpFiles = new ShpFiles(shpUrl);
    ShapefileReader reader = new ShapefileReader(shpFiles, false, true,
        new GeometryFactory(), false);
    try {
      assertTrue(reader.hasNext());
      assertTrue(reader.nextRecord().shape() == null);
View Full Code Here


    }
  }

    protected void loadShapes(String resource, int expected) throws Exception {
        final URL url = TestData.url(resource);
        ShapefileReader reader = new ShapefileReader(new ShpFiles(url), false,
                false, new GeometryFactory());
        int cnt = 0;
        try {
            while (reader.hasNext()) {
                reader.nextRecord().shape();
View Full Code Here

    }

    @Test
    public void testReadingSparse() throws IOException {
        File file = TestData.file(TestCaseSupport.class, "sparse/sparse.shp");
        ShapefileReader reader = new ShapefileReader(new ShpFiles(file), false, false, new GeometryFactory());
        int cnt = 0;
        try {
            while (reader.hasNext()) {
                reader.nextRecord().shape();
                cnt++;
View Full Code Here

    }
 
    protected void loadMemoryMapped(String resource, int expected)
            throws Exception {
        final URL url = TestData.url(resource);
        ShapefileReader reader = new ShapefileReader(new ShpFiles(url), false,
                false, new GeometryFactory());
        int cnt = 0;
        try {
            while (reader.hasNext()) {
                reader.nextRecord().shape();
View Full Code Here

    /*
     * Test method for 'org.geotools.index.fid.FidIndexer.generate(URL)'
     */
    @Test
    public void testGenerate() throws Exception {
        ShpFiles shpFiles = new ShpFiles(backshp.toURI().toURL());
        FidIndexer.generate(shpFiles);

        ShapefileDataStore ds = new ShapefileDataStore(DataUtilities.fileToURL(backshp));

        SimpleFeatureSource fs = ds.getFeatureSource();
        int features = fs.getCount(Query.ALL);

        IndexedFidReader reader = new IndexedFidReader(shpFiles);

        try {
            assertEquals(features, reader.getCount());

            int i = 1;

            while (reader.hasNext()) {
                assertEquals(shpFiles.getTypeName() + "." + i, reader.next());
                assertEquals(shpFiles.getTypeName() + "." + i, i - 1, reader.currentSHXIndex());
                i++;
            }

            assertEquals(features, i - 1);
        } finally {
View Full Code Here

TOP

Related Classes of org.geotools.data.shapefile.files.ShpFiles

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.