Examples of ShpFiles


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

        ShpFileType[] types = ShpFileType.values();
        for (ShpFileType type : types) {
            expected.put(type, new URL(base + type.extensionWithPeriod));
        }

        ShpFiles shapefiles = new ShpFiles(expected.get(SHP));

        Map<ShpFileType, String> files = shapefiles.getFileNames();

        Set<Entry<ShpFileType, URL>> expectedEntries = expected.entrySet();
        for (Entry<ShpFileType, URL> entry : expectedEntries) {
            assertEquals(entry.getValue().toExternalForm(), files.get(entry
                    .getKey()));
View Full Code Here

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

    public void testFileURLs() throws Exception {
        Map<ShpFileType, File> expected = createFiles("testShapefileFilesAll",
                ShpFileType.values(), false);

        File file = expected.values().iterator().next();
        ShpFiles shapefiles = new ShpFiles(file.toURI().toURL());

        assertEqualMaps(expected, shapefiles.getFileNames());
    }
View Full Code Here

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

    ShpXmlFileReader reader;

    @Before
    public void setUp() throws Exception {
        URL example = TestData.url(TestCaseSupport.class, "example.shp.xml");
        ShpFiles shpFiles = new ShpFiles(example);

        reader = new ShpXmlFileReader(shpFiles);
    }
View Full Code Here

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

                if (!args[i].toLowerCase().endsWith(".shp")) {
                    System.out.println("File extension must be '.shp'");
                    System.exit(1);
                }

                idx.setShapeFileName(new ShpFiles(args[i]));
            }
        }

        try {
            System.out.print("Indexing ");
View Full Code Here

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

    public boolean IsRandomAccessEnabled() {
        return this.randomAccessEnabled;
    }

    public static void main(String[] args) throws Exception {
        IndexedDbaseFileReader reader = new IndexedDbaseFileReader(new ShpFiles(args[0]), false);
        System.out.println(reader.getHeader());
        int r = 0;
        while (reader.hasNext()) {
            System.out.println(++r + "," + java.util.Arrays.asList(reader.readEntry()));
        }
View Full Code Here

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

        }
        return new String(chars);
    }

    public static void main(final String[] args) throws Exception {
        final DbaseFileReader reader = new DbaseFileReader(new ShpFiles(args[0]),
                false, Charset.forName("ISO-8859-1"), null);
        System.out.println(reader.getHeader());
        int r = 0;
        while (reader.hasNext()) {
            System.out.println(++r + ","
View Full Code Here

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

        Map<ShpFileType, File> files1 = ShpFilesTest.createFiles("Files1",
                ShpFileType.values(), false);
        Map<ShpFileType, File> files2 = ShpFilesTest.createFiles("Files2",
            ShpFileType.values(), false);

        shpFiles1 = new ShpFiles(files1.get(SHP));
        shpFiles2 = new ShpFiles(files2.get(SHP));
    }
View Full Code Here

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

        shpFiles2 = new ShpFiles(files2.get(SHP));
    }

    @Test
    public void testReplaceOriginal() throws Exception {
        ShpFiles files1 = shpFiles1;
        ShpFileType type = PRJ;
        StorageFile storagePRJ1 = files1.getStorageFile(type);
        File original = storagePRJ1.getFile();
       
        try {
          String writtenToStorageFile = "Copy";
 
          writeData(storagePRJ1, writtenToStorageFile);
 
          storagePRJ1.replaceOriginal();
          assertEquals(0, files1.numberOfLocks());
 
          assertCorrectData(files1, type, writtenToStorageFile);
        } catch(Exception e) {
          storagePRJ1.getFile().delete();
          original.delete();
View Full Code Here

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

        backprj =  sibling(backshp, "prj");
        backqix =  sibling(backshp, "qix");

        fixFile =  sibling(backshp, "fix");

        shpFiles = new ShpFiles(backshx);
    }
View Full Code Here

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

        copyShapefiles(STATEPOP);
        copyShapefiles(STATEPOP_IDX);
        final URL url1 = TestData.url(STATEPOP); // Backed by InputStream
        final URL url2 = TestData.url(TestCaseSupport.class, STATEPOP); // Backed by File
        final URL url3 = TestData.url(TestCaseSupport.class, STATEPOP_IDX);
        final ShapefileReader reader1 = new ShapefileReader(new ShpFiles(url1),
                false, false, new GeometryFactory());
        final ShapefileReader reader2 = new ShapefileReader(new ShpFiles(url2),
                false, false, new GeometryFactory());
        final IndexFile index = new IndexFile(new ShpFiles(url3), false);
        try {
            for (int i = 0; i < index.getRecordCount(); i++) {
                if (reader1.hasNext()) {

                    Geometry g1 = (Geometry) reader1.nextRecord().shape();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.