<head><title></title></head>
<body><div class="iw_mail" dir="ltr">There is actually two ways to do this with Mapserver:<br><br>You could join them with a ogrtindex. Then You are not actually merging the polygons but that doesn't matter<br>since You will only display the polygon and not the outline.<br><br>To do the ogrtindex You will do something like this with a bash script<br><br>#/bin/sh<br>#<br># make an ogr index file for mapserver for the S57 data<br># this example shows how to do chart level 2 and DEPARE layer<br>DIR=.<br>CL=2<br>IFS=$'\n' read -r -d "" -a files <<< "$(find "$DIR" -name "??${CL}*.000" -type f)"<br>ogrtindex -lname DEPARE Chartindex_${CL}_depare.shp ${files[@]}<br>--------------------------------------------------------------------------------------------------------<br><br>To display in mapserver:<br><br>LAYER<br> NAME DEPARE_2<br> TYPE POLYGON<br> CONNECTIONTYPE OGR<br> TILEINDEX "Chartindex_2_depare.shp"<br> TILEITEM "Location"<br> STATUS ON<br> CLASS<br> NAME "<= 0"<br> EXPRESSION ([DRVAL2] <= 0)<br> STYLE<br> COLOR 155 200 163<br> END<br> END<br> CLASS<br> NAME "0-10"<br> EXPRESSION (([DRVAL2]> 0) AND ([DRVAL2] < 10))<br> STYLE<br> COLOR 145 202 243<br> END<br> END<br> CLASS<br> NAME "10-20"<br> EXPRESSION (([DRVAL2] >= 10) AND ([DRVAL2] < 20))<br> STYLE<br> COLOR 180 218 247<br> END<br> END<br> CLASS<br> NAME "Deep water > 20"<br> EXPRESSION (([DRVAL2] >= 20) AND ([DRVAL2] < 30))<br> STYLE<br> COLOR 210 234 231<br> END<br> END<br> CLASS<br> NAME "Deep water > 30"<br> EXPRESSION ([DRVAL2] >= 30)<br> STYLE<br> COLOR 234 255 243<br> END<br> END<br>END # Layer<br><br>The second option to really join the depare areas is to run ogr2ogr two or three times.<br>(all this should of course be scripted)<br><br>First: ogr2ogr to convert all S57 DEPARE layers to shape (or sqlite ) - one by one<br>Second step: merge all shape files with ogr2ogr (make a loop and merge one by one)<br>Third step: join the polygons with a vrt file:<br><br>Something like this (file called "depare_join.vrt"):<br><br> <OGRVRTDataSource><br> <OGRVRTLayer name='DEPARE_VRT'><br> <SrcDataSource relativeToVRT='1' shared='1'>./combined_2_depare.shp</SrcDataSource><br> <SrcSQL dialect='sqlite'><br> SELECT ST_union(geometry), DRVAL1, DRVAL2<br> FROM DEPARE group by DRVAL1<br> </SrcSQL><br> </OGRVRTLayer><br></OGRVRTDataSource><br><br>The third step could be used both with ogr2ogr or directly with Mapserver<br><br>In Mapserver it would look something like this when using the vrt file directly:<br><br>LAYER<br> NAME DEPARE_2<br> TYPE POLYGON<br> CONNECTIONTYPE OGR<br> CONNECTION './depare_join.vrt'<br> DATA DEPARE_VRT<br><br>The rest is the same in the Mapserver layer<br><br>I haven't found a good way to combine ogrtindex with vrt:s<br><br>Have fun /Lars S.<br><br><blockquote class="reply_block" dir="ltr" style="border-left: 2px solid blue; margin: 5pt 0 5pt 10pt; padding: 0 0 0 5pt; font-size: 13px; font-family: tahoma,helvetica,sans-serif;">
<hr size="1">-----Originalmeddelande-----<br>Från: "Milis Inpo" <<a href="mailto:milis.inpo@gmail.com">milis.inpo@gmail.com</a>><br>Till: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>Datum: 2015-09-12 19:52<br>Ämne: [mapserver-users] [ASK] Merge polygon from multiple source files<br><br><div dir="ltr">Hi,<div><br></div>
<div>I would like to find a way to merge polygon from multiple source files. I have one set of ENC S57 files which contains 13 files. I would like to extract the DEPARE layer from each file and merge it with other polygon if it is side by side and has same depth value.</div>
<div><br></div>
<div>Is there anyway for me to do that in Mapserver ?</div>
<div>TIA</div>
<div><br></div>
<div><br></div>
<div>Best Regards,</div>
<div><br></div>
<div>Tenlee</div>
</div>
<hr>_______________________________________________<br>mapserver-users mailing list<br><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a>
</blockquote>
<br><br><div class="signature"><div class="separator">--</div></div>
</div></body>