Opened 22 years ago

Closed 20 years ago

#255 closed enhancement (duplicate)

Access Z values

Reported by: Chip.Hankley@… Owned by: dmorissette
Priority: high Milestone:
Component: MapScript-PHP Version: 4.1
Severity: minor Keywords:
Cc:

Description

Add the ability to retrieve the z values of vertices in 3D shapefiles.

Change History (4)

comment:1 by dmorissette, 22 years ago

Daniel Morissette wrote:
> MapScript supports 2D shapefiles (x,y), and measured shapefiles (x,y,m),
> but it doesn't support shapefiles with Z values (x,y,z).  I would think
> that someone could add this fairly easily by looking at the latest
> version of Shapelib and porting the changes to suppport the Z types to
> the MapServer version of shapelib.  Perhaps you could file this as an
> enhancement in bugzilla, and if someone ever has time...

Frank Warmerdam wrote:
> 
> Chip / Daniel,
> 
> I would also note that 3D shapefiles can be accessed through OGR.  I am
> not sure it is worth complicating the existing fast 3D shapefile support
> in MapServer when those wanting to use 3D shapefiles can just use
> OGR-in-Mapserver.  Also, utilities like ogr2ogr can be used to flatten
> a shapefile to 2D if needed.
> 

Daniel Morissette wrote:
> 
> True.  I didn't think about that.  I guess that solves the issue for you
> Chip, unless you need access to the Z values in MapScript in which case
> we would have to add a 'z' value to the pointObj and modify mapogr.cpp
> to set the z value.  With the current version if you access a 3D
> shapefile with OGR the Z values are simply dropped.
> 


comment:2 by dmorissette, 22 years ago

"Hankley, Chip" wrote:
> 
> I'd like to use the z values of the shapefile to create profiles... so what
> I'm trying to do, is get the individual z values for each vertex in a shape.
> So, I understand that I can't do this through mapScript... but I don't see a
> way to do it with OGR either (albeit my OGR experience is pretty limited).
> Am I missing something?


You could use the $layer->open()/close() and $layer->getShape() to read
shapes out of an OGR data source (or any data source that MapServer
supports).

The only problem is that those calls are intended to be used to read
shapes returned by a query call, so they don't provide the equivalent of
the shapefileObj->numshapes member.  Assuming your shapefile is not too
big then you could do a queryByAttributes() with an attribute filter
that matches all shapes in your layer, and then the query results will
contain the shape id of all shapes in your layer.

It might also be possible to implement a new $layer->getNextShape()
method that would allow someone to sequentially read all shapes using a
layerObj.

Now, where do we go from there?  I'll file those comments in the bug
report and we can continue the discussion there:
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=255

I would be interested in hearing what Steve thinks about adding support
for Z values in MapServer since this implies an increase in size of the
pointObj, which means more memory per shapeObj, all this for a feature
that very few users will use.  Perhaps that should be made available as
a compile option?

comment:3 by dmorissette, 21 years ago

Cc: assefa@… steve.lime@… added
Priority: highesthigh
Version: 4.04.1
Can't happen for 4.0 for sure.  Perhaps we should revisit this in a later 
release adding Steve and Assefa to the CC to include them in the discussion when 
we get to that later.

comment:4 by assefa, 20 years ago

Resolution: duplicate
Status: newclosed

*** This bug has been marked as a duplicate of 869 ***
Note: See TracTickets for help on using tickets.