Package org.geotools.geopkg.geom

Source Code of org.geotools.geopkg.geom.GeoPkgIOTest

package org.geotools.geopkg.geom;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.geotools.geometry.jts.GeometryBuilder;
import org.junit.Test;

import com.vividsolutions.jts.geom.Geometry;

public class GeoPkgIOTest {

    @Test
    public void testReadWrite() throws IOException {
        Geometry g1 = new GeometryBuilder().point(0,0).buffer(10);
        byte[] bytes = new GeoPkgGeomWriter().write(g1);

        Geometry g2 = new GeoPkgGeomReader().read(bytes);
        assertTrue(g1.equals(g2));
    }

    @Test
    public void testHeader() throws IOException {
        Geometry g1 = new GeometryBuilder().point(0,0).buffer(10);
        byte[] bytes = new GeoPkgGeomWriter().write(g1);

        assertEquals(0x47, bytes[0]);
        assertEquals(0x50, bytes[1]);
        assertEquals(0x00, bytes[2]);
    }
}
TOP

Related Classes of org.geotools.geopkg.geom.GeoPkgIOTest

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.