<div dir="ltr"><div><div><div>I took the plpgsql way. Created a set of functions that generates the mapfile blocks and store the tokens in several postgresql tables(using traditional SQL relations).<br></div><br>Then I invoke the mapfile( id ) from database and pass the mapfile text direct to mapscript.<br>
</div>With this, the mapfile creation has been managed by the database and did not need any files.<br><br></div><div>Since all layers are already at database, I do not think those generation steps take some much processing.<br>
</div><div>It is working for a few layers already loaded.<br><br></div><div>Current postgresql could also store them as XML. Recent mapserver could parse xml mapfiles. But never implemented something this way.<br></div><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-13 15:08 GMT-03:00 Alex Lopes <span dir="ltr"><<a href="mailto:alexlopespereira@gmail.com" target="_blank">alexlopespereira@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you everybody who helped me. I'll study all the suggestions and post here the complete source code of my solution.<div>
<br></div><div>Alex</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

2014-08-13 9:34 GMT-04:00 Jeff McKenna <span dir="ltr"><<a href="mailto:jmckenna@gatewaygeomatics.com" target="_blank">jmckenna@gatewaygeomatics.com</a>></span>:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Definitely leverage mapfile INCLUDEs (<a href="http://mapserver.org/mapfile/include.html" target="_blank">http://mapserver.org/mapfile/<u></u>include.html</a>). In your case, each LAYER could be an include, and you could have a mapfile template file that your shell script writes those include layers into.<br>



<br>
I recently saw a presentation at FOSS4G-Europe from PropertyShark, who manages thousands of layers, using includes, and generates them through custom Perl scripts (you can read about that discussion, or contact them, through the recent Google+ discussion <a href="https://plus.google.com/communities/103841604654304099367" target="_blank">https://plus.google.com/<u></u>communities/<u></u>103841604654304099367</a>).<span><font color="#888888"><br>



<br>
-jeff<br>
<br>
<br>
-- <br>
Jeff McKenna<br>
MapServer Consulting and Training Services<br>
<a href="http://www.gatewaygeomatics.com/" target="_blank">http://www.gatewaygeomatics.<u></u>com/</a></font></span><div><div><br>
<br>
On 2014-08-13 10:03 AM, Alex Lopes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Everybody,<br>
<br>
<br>
I need to create a script shell to build thousands of mapfiles based on<br>
postgis layers.<br>
<br>
Which is the best way to accomplish this task?<br>
<br>
Best regards,<br>
Alex<br>
<br>
<br>
</blockquote>
<br></div></div><div><div>
______________________________<u></u>_________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/mapserver-<u></u>users</a><br>
</div></div></blockquote></div></div></div><br></div>
<br>_______________________________________________<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" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></blockquote></div><br></div>