[Geoserver-devel] SHAPE-ZIP Missing .shx

In 1.3.0 and 1.3.1 the .shp, .dbf and .shx files are generated in org.vfny.geoserver.wfs.responses.ShapeFeatureResponseDelegate
and written to java.io.tmpdir. However the .shx file is never included in the SHAPE-ZIP. Is this intentional? The code for creating the zip entries is below:

        // BEGIN RELOADING and ZIPPING
                // read in and write out .shp
        ZipEntry entry = new ZipEntry(name + ".shp");
        zipOut.putNextEntry(entry);
        InputStream shp_in = new FileInputStream(namePath + ".shp");
        readInWriteOutBytes(output, shp_in);
        zipOut.closeEntry();
        shp_in.close();
                // read in and write out .dbf
        entry = new ZipEntry(name + ".dbf");
        zipOut.putNextEntry(entry);
        InputStream dbf_in = new FileInputStream(namePath + ".dbf");
        readInWriteOutBytes(output, dbf_in);
        zipOut.closeEntry();
        dbf_in.close();

To include the .shx file the following code can be added:

    // read in and write out .shx
    entry = new ZipEntry(name + ".shx");
    zipOut.putNextEntry(entry);
    InputStream shx_in = new FileInputStream(namePath + ".shx");
    readInWriteOutBytes(output, shx_in);
    zipOut.closeEntry();
    shx_in.close();

This is useful for me as I'm using ogr2ogr to convert the shape output to other formats which seems to require the .shx file.

Duncan Clarkson

Thanks for the patch Duncan.
I will get it in for the next release.

cheers,

Brent Owens
(The Open Planning Project)

Duncan Clarkson wrote:

In 1.3.0 and 1.3.1 the .shp, .dbf and .shx files are generated in org.vfny.geoserver.wfs.responses.ShapeFeatureResponseDelegate
and written to java.io.tmpdir. However the .shx file is never included in the SHAPE-ZIP. Is this intentional? The code for creating the zip entries is below:

        // BEGIN RELOADING and ZIPPING
                // read in and write out .shp
        ZipEntry entry = new ZipEntry(name + ".shp");
        zipOut.putNextEntry(entry);
        InputStream shp_in = new FileInputStream(namePath + ".shp");
        readInWriteOutBytes(output, shp_in);
        zipOut.closeEntry();
        shp_in.close();
                // read in and write out .dbf
        entry = new ZipEntry(name + ".dbf");
        zipOut.putNextEntry(entry);
        InputStream dbf_in = new FileInputStream(namePath + ".dbf");
        readInWriteOutBytes(output, dbf_in);
        zipOut.closeEntry();
        dbf_in.close();

To include the .shx file the following code can be added:

    // read in and write out .shx
    entry = new ZipEntry(name + ".shx");
    zipOut.putNextEntry(entry);
    InputStream shx_in = new FileInputStream(namePath + ".shx");
    readInWriteOutBytes(output, shx_in);
    zipOut.closeEntry();
    shx_in.close();

This is useful for me as I'm using ogr2ogr to convert the shape output to other formats which seems to require the .shx file.

Duncan Clarkson

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel