Is it possible that the layers status is OFF (seems like that looking at the layer definition)? It should be set to ON or DEFAULT

Later,

Gilles Bassière wrote:
Hi list

I try to use the generateSLD method but can't get it to work.

I have the following code (adapted from Mapserver how-to) :

<?php

// define variables
define("MAPFILE", "/home/gba/public_html/and/test.map");
define("MODULE", "php_mapscript.so");

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

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

foreach ( $oMap->getAllLayerNames() as $layerName )
{
  $oLayer = $oMap->getLayerByName($layerName);

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

  // return SLD to client
  echo $SLD ;
}
?>

I have several layers which are very simple and all look like this one :

  # LAYER golf -------------------------------------
  LAYER
     NAME             "golf"
     GROUP            "background"
     CONNECTIONTYPE   postgis
CONNECTION "host=localhost dbname=test user=test password=xxx port=5432"
     DATA             "wkb_geometry FROM golf"
     STATUS           off
     TYPE             polygon

     CLASS
        NAME          "Golf courses"
        STYLE
           COLOR      203 216 195
           ANTIALIAS  true
        END
     END

     PROJECTION
        "init=epsg:4326"
     END

     METADATA
        "wms_title"   "Golf courses"
        "wms_srs"     "EPSG:4326"
        "wms_extent"  "3.3 50.75 7.25 53.6"
     END
  END

The PHP script above returns the following output :

<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"; xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
</StyledLayerDescriptor>

This output is a valid SLD, I agree... But I expected to find the parameters set up in the CLASS element, how should I proceed ? What is going wrong there ?



--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: [EMAIL PROTECTED]
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------

Reply via email to