[OpenMap Users] EsriShapeExport class to export a graphiclist of EsriPolylines

From: Martin Chapman <mchapman@sanz.com>
Date: Thu Nov 20 2003 - 17:53:08 EST

Don,
 
When I use the EsriShapeExport class to export a graphiclist of
EsriPolylines it always exports the shape file as type polygon. I want
it to eport a shape file of type polyline. The code is listed below.
Can you see anything that is wrong or missing?
 
private void downloadFile(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
    {
        try
        {
            PrintWriter out = response.getWriter();
            response.setContentType(CONTENT_TYPE);
 
            String aoiVertices = getAOIVertices(request);
            String inputGeometryIds = getInputGeometryIds(request);
            String where = "[igeo_pk] IN(" + inputGeometryIds + ")";
 
            EsriGraphicList graphicList = new EsriPolylineList();
 
graphicList.setTraverseMode(OMGraphicList.LAST_ADDED_ON_TOP);
 
            EWInputGeometryList inputGeometryList = new
EWInputGeometryList();
            inputGeometryList.retrieve(where, "", 0, 0, 0);
 
            while (inputGeometryList.next())
            {
                EWInputGeometry inputGeometry = inputGeometryList.item
();
 
                float[] points = new float[10];
                points[0] = (float) inputGeometry.getUlLat();
                points[1] = (float) inputGeometry.getUlLon();
                points[2] = (float) inputGeometry.getLlLat();
                points[3] = (float) inputGeometry.getLlLon();
                points[4] = (float) inputGeometry.getLrLat();
                points[5] = (float) inputGeometry.getLrLon();
                points[6] = (float) inputGeometry.getUrLat();
                points[7] = (float) inputGeometry.getUrLon();
                points[8] = (float) inputGeometry.getUlLat();
                points[9] = (float) inputGeometry.getUlLon();
 
                EsriPolyline polyline = new EsriPolyline(points,
OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_STRAIGHT);
                graphicList.add(polyline);
 
                inputGeometry = null;
            }
 
            inputGeometryList.close();
 
            int projType =
ProjectionFactory.getProjType(getProjectionType(request));
            float latitude = getLatitude(request);
            float longitude = getLongitude(request);
            int scale = getScale(request);
            int width = getWidth(request);
            int height = getHeight(request);
 
            Projection projection =
ProjectionFactory.makeProjection(projType,
 
latitude,
 
longitude,
 
scale,
 
width,
 
height);
 
            Date date = new Date();
            String fileName = date.toString();
            fileName = fileName.replaceAll(" ", "");
            fileName = fileName.replaceAll(":", "");
 
            EsriShapeExport esriShapeExport = new
EsriShapeExport(graphicList, projection, "/earthwhere_working/" +
fileName);
            esriShapeExport.export();
 
            out.write("<html>");
            out.write(aoiVertices + "<br>");
            out.write(inputGeometryIds + "<br>");
            out.write("</html>");
        }
        catch (Exception e)
        {
            PrintWriter out = response.getWriter();
            out.write(
            "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01
Transitional//EN'>");
            out.write("<html>\n");
            out.write("<head>");
            out.write("<title>EarthWhere Shape File Download</title>");
            out.write("<meta http-equiv='Content-Type'
content='text/html; charset=iso-8859-1'>");
            out.write("<link href='css/earthwhere.css' rel='stylesheet'
type='text/css'>");
            out.write("</head>");
            out.write("<body bgcolor='#ffffff'>");
            out.write("An error occurred while downloading the file.
Please contact your administrator with the message below.<br><br>");
            out.write(e.getMessage());
            out.write("<br><br><input onclick='window.close();'
type='button' name='btnClose' id='btnClose' value='Close'>");
            out.write("</body>");
            out.write("</html>\n");
        }
    }
 
Martin Chapman
Cell 303-885-1936
Office 303-660-3933 x226
mchapman@sanz.com
http://www.sanz.com <http://www.sanz.com/>
 
 

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Nov 20 17:51:17 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT