MASON-INTEREST-L Archives

March 2013

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
multipart/alternative; boundary=047d7b5d9c6f0a282304d7e776d8
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
Mark Coletti <[log in to unmask]>
Date:
Thu, 14 Mar 2013 15:23:44 -0400
In-Reply-To:
MIME-Version:
1.0
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (2772 bytes) , text/html (6 kB)
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


ATOM RSS1 RSS2