[mapserver-users] buffer function

Jeppe Lund Andersen JXA at cowi.dk
Fri Oct 10 08:27:36 EDT 2008


hello all

I want to shrink or increase a shape, and for that I use the buffer
but if I look at the WKT streng I get a lot of points
and its because it make a curve around the corner

is it possible to set how many segment it shall make ?
so if I have a WKT with 4 corners
I would like a new WKT with 4 corners if I make the shape bigger

here is the wkt I have and the WKT it returns

Org WKT
POLYGON((482728.617354642 6285505.17359964, 482710.831068496
6285449.33496543, 482774.225119444 6285437.03746855, 482789.364489571
6285486.76734618, 482728.617354642 6285505.17359964))

New WKT after using Buffer

POLYGON ((482728.9073336222200000 6285506.1306326548000000,
482789.6544685512200000 6285487.7243791949000000,
482789.7041995495100000 6285487.7078764187000000,
482789.7529978694500000 6285487.6887914045000000,
482789.8007295344700000 6285487.6671765493000000,
482789.8472634966600000 6285487.6430911981000000,
482789.8924719964300000 6285487.6166014764000000,
482789.9362309131000000 6285487.5877801124000000,
482789.9784201060500000 6285487.5567062357000000,
482790.0189237442100000 6285487.5234651603000000,
482790.0576306243300000 6285487.4881481500000000,
482790.0944344761700000 6285487.4508521678000000,
482790.1292342541300000 6285487.4116796106000000,
482790.1619344150500000 6285487.3707380267000000,
482790.1924451800900000 6285487.3281398220000000,
482790.2206827816600000 6285487.2840019511000000,
482790.2465696929100000 6285487.2384455949000000,
482790.2700348410300000 6285487.1915958282000000,
482790.2910138020500000 6285487.1435812786000000,
482790.3094489781100000 6285487.0945337703000000,
482790.3252897550100000 6285487.0445879633000000,
482790.3384926417500000 6285486.9938809862000000,
482790.3490213896100000 6285486.9425520534000000,
482790.3568470918100000 6285486.8907420915000000,
482790.3619482627300000 6285486.8385933442000000,
482790.3643108970100000 6285486.7862489866000000,
482790.3639285080700000 6285486.7338527311000000,
482790.3608021457300000 6285486.6815484324000000,
482790.3549403934700000 6285486.6294796923000000,
482790.3463593447800000 6285486.5777894678000000,
482790.3350825590900000 6285486.5266196728000000,
482790.3211409970500000 6285486.4761107955000000,
482775.1817708700500000 6285436.7462331653000000,
482775.1652079030800000 6285436.6965379277000000,
482775.1460653818200000 6285436.6477781860000000,
482775.1243958323000000 6285436.6000877349000000,
482775.1002587146900000 6285436.5535974335000000,
482775.0737202599400000 6285436.5084348507000000,
482775.0448532882700000 6285436.4647239083000000,
482775.0137370090800000 6285436.4225845477000000,
482774.9804568039300000 6285436.3821323970000000,
482774.9451039919500000 6285436.3434784561000000,
482774.9077755794300000 6285436.3067287868000000,
482774.8685739936200000 6285436.2719842307000000,
482774.8276068015800000 6285436.2393401237000000,
482774.7849864153500000 6285436.2088860404000000,
482774.7408297829100000 6285436.1807055455000000,
482774.6952580678600000 6285436.1548759630000000,
482774.6483963166200000 6285436.1314681694000000,
482774.6003731154500000 6285436.1105463943000000,
482774.5513202374600000 6285436.0921680462000000,
482774.5013722813500000 6285436.0763835534000000,
482774.4506663016500000 6285436.0632362291000000,
482774.3993414330200000 6285436.0527621480000000,
482774.3475385081800000 6285436.0449900497000000,
482774.2953996717100000 6285436.0399412625000000,
482774.2430679899400000 6285436.0376296379000000,
482774.1906870583200000 6285436.0380615201000000,
482774.1384006073300000 6285436.0412357235000000,
482774.0863521084000000 6285436.0471435394000000,
482774.0346843798800000 6285436.0557687553000000,
482710.6406334318500000 6285448.3532656357000000,
482710.5891510075900000 6285448.3646686049000000,
482710.5383412270500000 6285448.3787694536000000,
482710.4883453652700000 6285448.3955289740000000,
482710.4393024341000000 6285448.4149005665000000,
482710.3913487957900000 6285448.4368303707000000,
482710.3446177839100000 6285448.4612574102000000,
482710.2992393325000000 6285448.4881137665000000,
482710.2553396149900000 6285448.5173247661000000,
482710.2130406929600000 6285448.5488091893000000,
482710.1724601773900000 6285448.5824794946000000,
482710.1337109009000000 6285448.6182420636000000,
482710.0969006047200000 6285448.6559974579000000,
482710.0621316387000000 6285448.6956407009000000,
482710.0295006767300000 6285448.7370615657000000,
482709.9990984482600000 6285448.7801448833000000,
482709.9710094856000000 6285448.8247708604000000,
482709.9453118892900000 6285448.8708154177000000,
482709.9220771106200000 6285448.9181505293000000,
482709.9013697531800000 6285448.9666445814000000,
482709.8832473930700000 6285449.0161627373000000,
482709.8677604189100000 6285449.0665673139000000,
482709.8549518917600000 6285449.1177181629000000,
482709.8448574253700000 6285449.1694730613000000,
482709.8375050869700000 6285449.2216881057000000,
482709.8329153196000000 6285449.2742181132000000,
482709.8311008848800000 6285449.3269170281000000,
482709.8320668278600000 6285449.3796383198000000,
482709.8358104627100000 6285449.4322354011000000,
482709.8423213803900000 6285449.4845620254000000,
482709.8515814775000000 6285449.5364727024000000,
482709.8635650067000000 6285449.5878230939000000,
482709.8782386481800000 6285449.6384704234000000,
482727.6645247942100000 6285505.4771046331000000,
482727.6815482985100000 6285505.5261141611000000,
482727.7010907441700000 6285505.5741748130000000,
482727.7230995280600000 6285505.6211572243000000,
482727.7475154083800000 6285505.6669349289000000,
482727.7742726641600000 6285505.7113847071000000,
482727.8032992718500000 6285505.7543869112000000,
482727.8345170997200000 6285505.7958257906000000,
482727.8678421176200000 6285505.8355898028000000,
482727.9031846234600000 6285505.8735719137000000,
482727.9404494846800000 6285505.9096698863000000,
482727.9795363941800000 6285505.9437865540000000,
482728.0203401404400000 6285505.9758300837000000,
482728.0627508906200000 6285506.0057142228000000,
482728.1066544863300000 6285506.0333585311000000,
482728.1519327507100000 6285506.0586885978000000,
482728.1984638067700000 6285506.0816362407000000,
482728.2461224054000000 6285506.1021396909000000,
482728.2947802622200000 6285506.1201437591000000,
482728.3443064033100000 6285506.1355999829000000,
482728.3945675175100000 6285506.1484667575000000,
482728.4454283152600000 6285506.1587094497000000,
482728.4967518928500000 6285506.1663004896000000,
482728.5484001009000000 6285506.1712194430000000,
482728.6002339161900000 6285506.1734530693000000,
482728.6521138159400000 6285506.1729953568000000,
482728.7039001532800000 6285506.1698475378000000,
482728.7554535331400000 6285506.1640180852000000,
482728.8066351875900000 6285506.1555226892000000,
482728.8573073492200000 6285506.1443842184000000,
482728.9073336222200000 6285506.1306326548000000))


CODE
$ms_shapeFromWKT_main = ms_shapeObjFromWkt( $wktstreng  );
$new_shape = $ms_shapeFromWKT_main->Buffer(1);
echo($new_shape->toWKT() . "<br>");


Jeppe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081010/87716c9d/attachment.html


More information about the mapserver-users mailing list