[mapserver-users] MapServer Map Files and GeoTools

Tim Heuer HeuerT at landcareresearch.co.nz
Tue Sep 20 22:15:08 EDT 2011


Hi All,
Was great to see some of you at Foss4G. As you might know, I'm a committer on the MapFish print module and am really interested in excelling the development of that. Hopefully I can get some time to do so. To get to the point:
We use MapServer as our main WMS to build our caches and for printing maps. Currently an SVG is downloaded by the print module and then rendered onto a Graphics2D object inside the module and then rendered onto a PDF document with iTextPDF. We would like to make this process a bit slicker and render from PostGIS directly with the help of the style defined inside the map files. An idea inspired by Jesse Eichar was that we use GeoTools and include it as a dependency to do the heavy work for us. But does this mean we would need to implement parsing the map files somehow or is there already functionality for that inside GeoTools?
I found this on the MapServer docs (sorry for the HTML email, but I thought it's more readable... http://mapserver.org/ogc/sld.html):
PHP/MapScript Example that Generates an SLD from a Mapfile
The following is a small script that calls the generateSLD() function to create an SLD for a specific layer in a mapfile:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

<?php

// define variables
define( "MAPFILE", "D:/ms4w/apps/cadastra/map/cadastra.map" );
define( "MODULE", "php_mapscript.dll" );

// load the mapscript module
if (!extension_loaded("MapScript")) dl(MODULE);

// open map
$oMap = ms_newMapObj( MAPFILE );

// get the parcel layer
$oLayer = $oMap->getLayerByName("parcel");

// force visibilty of the layer
$oLayer->set('status', MS_ON);

// generate the sld for that layer
$SLD = $oLayer->generateSLD();

// save sld to a file
$fp = fopen("parcel-sld.xml", "a");
fputs( $fp, $SLD );
fclose($fp);

?>

Is there a way to use this functionality with GeoTools or another Java library?
Thoughts are appreciated.

Cheers,
Tim

________________________________
Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110921/e0f6cea6/attachment-0001.html


More information about the mapserver-users mailing list