Opened 13 years ago

Closed 13 years ago

#3606 closed enhancement (fixed)

shpxy ability to output outer/inner rings

Reported by: assefa Owned by: jmckenna
Priority: normal Milestone: 6.0 release
Component: Documentation - MapServer Version: unspecified
Severity: normal Keywords:
Cc: assefa, havatv

Description

right now using the template's shpxy, It seem it is not possible to do an output with outer and inner rings to get valid geometries for kml or gml too (I think). Would shpxy be the place to add this?

Attachments (2)

ring_support_chodgson.patch (5.6 KB ) - added by chodgson 13 years ago.
revised patch
shpxy_rings_doc.patch (2.0 KB ) - added by chodgson 13 years ago.
doc patch for shpxy ring/hole support

Download all attachments as: .zip

Change History (17)

comment:1 by sdlime, 13 years ago

You are correct and yes, that's the spot. I had planned on doing this and I think there are even the base variables already defined (but probably already defined). It's just a matter of detecting inner and outer rings (there are functions for that in mapprimitive.c) and writing ring headers/footers.

Steve

comment:2 by sdlime, 13 years ago

Status: newassigned

I enabled the ring variables in the shpxy tag: irh,irf,irs and orh,orf,ors in r10733. Now to actually use them (ir=inner ring, or=outer ring). I have to think about that a bit... -Steve

comment:3 by assefa, 13 years ago

Can we make the assumption that if irh,irf and orh,orf are defined, the user want to output something that always look like:

<orh>coodinates<orf><irh>coordinates<irf><irh>coordinates<irf>...

This being repeatable for several outer/inner rings.

I believe this would work for kml and gml I think.

comment:4 by sdlime, 13 years ago

That's what I was thinking. We support part headers and footers already, this is just an extension of that for the inner/outer part types. I hope to get this in trunk today. I was also going to add the ability to skip holes which would be nice for image maps...

Steve

comment:5 by assefa, 13 years ago

great thanks.

comment:6 by chodgson, 13 years ago

Steve I don't know if you've taken this any further than what's in trunk now? Either way I could finish up a patch for this one if you like.

comment:7 by sdlime, 13 years ago

Sorry, sorry, sorry. I just committed what I hope is the correct functionality just now (r10817). I'm having trouble getting trunk to compile for other reasons so I could not test it but it's a pretty simple change.

Steve

comment:8 by chodgson, 13 years ago

Thanks Steve, this looks pretty good. One thing though, I think we still need to use the part header/footer to allow for multi-polygons with holes - eg. for kml we need something like:

sh = "<MultiGeometry>" ph = "<Polygon>" orh = "<OuterBounderIs><LinearRing><coordinates>" orf = "</coordinates></LinearRing irh = "<InnerBoundaryIs><LinearRing><coordinates>" irf = "</coordinates></LinearRing></innerBoundaryIs>" pf="</Polygon>" sf = "</MultiGeometry>"

I'm happy to write the code for this but I have one question first - can I rely on the rings being ordered nicely as they seem to be in my test data (outer, inner*, outer, inner*, ...) or is it necessary to use msGetOuterList()/msGetInnerList() to calculate which inner rings belong to which outer rings? I only ask because I imagine it would be nice to avoid recalculating the rings if possible.

comment:9 by chodgson, 13 years ago

The patch I have attached uses msGetOuterList() and msGetInnerList() to output rings in the logical order as required for kml (and I expect gml) output. It also supports using ph/ps/pf to specify the header/separator/footer for individual polygons within a multipolygon. One caveat is that a single polygon with hole(s) has only one "part" so you must use different options to output single polygons vs. multipolygons, and if your data is mixed then you will be forced to output everything as multi's. I suppose it would be possible to do something "smarter" but it gets tricky to know what to do without getting into the specifics of the different formats being output.

The options specified in my earlier comment are an example of how to use these changes to shpxy to output multigeometry (polygon) kml with holes.

by chodgson, 13 years ago

Attachment: ring_support_chodgson.patch added

revised patch

comment:10 by sdlime, 13 years ago

Applied patch in r10901. Thanks Chris!

Steve

comment:11 by sdlime, 13 years ago

Milestone: 6.0 release

comment:12 by sdlime, 13 years ago

Component: MapServer C LibraryMapServer Documentation

Need to get the new parameters documented. Transferring ownership to the docs component. -Steve

comment:13 by sdlime, 13 years ago

Owner: changed from sdlime to jmckenna
Status: assignednew

by chodgson, 13 years ago

Attachment: shpxy_rings_doc.patch added

doc patch for shpxy ring/hole support

comment:14 by chodgson, 13 years ago

I have attached a patch for the documentation with the additional options to shpxy explained, and an example provided.

comment:15 by havatv, 13 years ago

Cc: havatv added
Resolution: fixed
Status: newclosed

Example and improved explanation from the patch added for 6.0 and trunk docs in r12014. irh, orh, irf and orf was added in an earlier fix.

Note: See TracTickets for help on using tickets.