Opened 13 years ago

Closed 13 years ago

#3906 closed enhancement (fixed)

add 2.5d support to OGR output

Reported by: msmitherdc Owned by: warmerdam
Priority: normal Milestone: 6.2 release
Component: OGR Support Version: svn-trunk (development)
Severity: normal Keywords: wfs, 2.5d, Z, ogr, output
Cc: dmorissette

Description

There is a need for Z values in OGR Output formats generated by mapserver

Attachments (5)

testshape_3d.zip (163.8 KB ) - added by msmitherdc 13 years ago.
testshape_3d.map (1.3 KB ) - added by msmitherdc 13 years ago.
mapfile for testcase
testpoints_2d.zip (2.1 KB ) - added by msmitherdc 13 years ago.
Shapefile for 2d test
ogrouttest.map (1.9 KB ) - added by msmitherdc 13 years ago.
mapfile for test
testpoints_25d.zip (2.3 KB ) - added by msmitherdc 13 years ago.
Shapefile for 25d test (Z=0)

Download all attachments as: .zip

Change History (18)

by msmitherdc, 13 years ago

Attachment: testshape_3d.zip added

by msmitherdc, 13 years ago

Attachment: testshape_3d.map added

mapfile for testcase

comment:2 by msmitherdc, 13 years ago

I'll also need to set the output projection at the request level

comment:3 by msmitherdc, 13 years ago

Nevermind on output projection. This is easily done in WFS 1.1 with SRSNAME

comment:4 by warmerdam, 13 years ago

bump,

Ideally two things need to be done.

1) add optional support when build with enable_z_m to capture Z coordinates and output them if they are available.

2) when there isn't z we should only generate 2D geometries which could be accomplished by post-flattening the geometries just before they are written out.

comment:5 by warmerdam, 13 years ago

I would just caution against using OGR_G_SetPoint_2D() which is a relatively new addition to OGR and would incorporate an unnecessary version dependence. Thus the suggestion of OGR_G_FlattenTo2D() which I think has been available for a long time.

comment:6 by warmerdam, 13 years ago

Cc: dmorissette added; warmerdam removed
Owner: changed from dmorissette to warmerdam

I'm seizing this, and going to take a crack at it tonight.

comment:8 by warmerdam, 13 years ago

Status: newassigned

Mike,

My problem last night turn out to be a failure to build WFS server support in!

Working on linux now...

comment:9 by warmerdam, 13 years ago

Mike,

On brief inspection your .shp file does not seem to have any non-zero Z values despite having a geometry type for 2.5D features.

It looks like the OGR reader in MapServer does not collect Z values even when USE_POINT_Z_M is set, so I'm going to need to fix that up as well as mapogroutput.c. I have a preliminary patch for mapogroutput.c but it is hard to fully test with the data at hand.

by msmitherdc, 13 years ago

Attachment: testpoints_2d.zip added

Shapefile for 2d test

by msmitherdc, 13 years ago

Attachment: ogrouttest.map added

mapfile for test

comment:10 by msmitherdc, 13 years ago

Frank,

Correct, its really a 3d shapefile. The issue i was getting is that I'm receiving 0's rather the Z values with x,y,z are present and (for some drivers like geojson) getting 0's for z when its just X and Y input.

To see the Z output from 2d with the new mapfile and data layer

http://server/cgi-bin/mapserv6?map=ogrouttest.map&service=wfs&version=1.1.0&request=getFeature&typename=points2d&outputformat=geojson&srsname=epsg:4326

comment:11 by warmerdam, 13 years ago

Mike,

I have confirmed and corrected the issue of always producing Z=0 values even if the input and desired output is 2D. But since there are no non-zero Z values in the sample file I'll need to dig up some other data and an alternate test to confirm we can pass through non-zero Z's properly.

comment:12 by msmitherdc, 13 years ago

The first test file should have non-zero Z values. But if thats not what you need, let me know and I can generate whatever you need to test.

by msmitherdc, 13 years ago

Attachment: testpoints_25d.zip added

Shapefile for 25d test (Z=0)

comment:13 by warmerdam, 13 years ago

Milestone: 6.0.1 release6.2 release
Resolution: fixed
Status: assignedclosed

Mike,

I have adjusted mapogroutput.c to:

1) Determine what geometry type to create the output layer based on whether the _geomtype metadata has 25D appended or not. So to produce 2.5D output you would use "ows_geomtype" "MultiLineString?25D".

2) In USE_POINT_Z_M mode the Z will actually be carried through properly now.

These changes are in trunk (r12022). I have also updated the msautotest suite (r12023) so that it does not expect the Z values for the existing test cases though I have not extended the test suite with 2.5D cases.

It should be noted that only the builtin shapefile driver and oracle drivers carry through Z in USE_POINT_Z_M mode. The PostGIS and OGR drivers do not. It might be worthwhile to extend them.

Docs have been extended to mention 2.5D geomtype values (r12024).

If you need this backported into the 6.0 stable branch let me know. I don't think it would be dangerous.

Note: See TracTickets for help on using tickets.