On Thu, Mar 14, 2013 at 3:03 PM, Luís de Sousa <[log in to unmask]> wrote:
Just to complement this thread: with a POINT type layer the read
method works perfectly, just tried that.


If you look at the ShapeFileImporter.java, you'll notice these lines:

     46     // Shape types included in ESRI Shapefiles. Not all of these are currently supported.
     47 
     48     final static int NULL_SHAPE = 0;
     49     final static int POINT = 1;
     50     final static int POLYLINE = 3;
     51     final static int POLYGON = 5;
     52     final static int MULTIPOINT = 8;
     53     final static int POINTZ = 11;
     54     final static int POLYLINEZ = 13;
     55     final static int POLYGONZ = 15;
     56     final static int MULTIPOINTZ = 18;
     57     final static int POINTM = 21;
     58     final static int POLYLINEM = 23;
     59     final static int POLYGONM = 25;
     60     final static int MULTIPOINTM = 28;
     61     final static int MULTIPATCH = 31;
     62 
     63 
     64 
     65     public static boolean isSupported(int shapeType)
     66     {
     67         switch (shapeType)
     68         {
     69             case POINT:
     70                 return true;
     71             case POLYLINE:
     72                 return true;
     73             case POLYGON:
     74                 return true;
     75             default:
     76                 return false;   // no other types are currently supported
     77         }
     78     }
     79 

So, from that you can infer that POINTZ types are not currently supported.  However, I don't imagine adding support for that would be too hard.  Presumably POINTZ types are just POINTs with an elevation, or Z, value.  I don't have the shape file spec handy, but hopefully it's just a matter of modifying this part of the code:

    442                 Geometry geom = null;
    443 
    444                 if (recordType == POINT)
    445                 {
    446                     Coordinate pt = new Coordinate(byteBuf.getDouble(), byteBuf.getDouble());
    447                     geom = geomFactory.createPoint(pt);
    448                 } else if (recordType == POLYLINE || recordType == POLYGON)
    449                 {
    450                     // advance past four doubles: minX, minY, maxX, maxY
    451                     byteBuf.position(byteBuf.position() + 32);


I'm *guessing* that the byteBuf will just contain another double for the Z value, so splicing another if/else to check for "recordType == POINTZ" and then read the three coordinates. 

I'd experiment with this myself, but I not only don't have POINTZ data handy, but I really do need to get cracking on this dissertation.  If you try this and it works, I'll fold the patch into GeoMason.

Cheers!

Mark