swig mapscript generateSLD does not work for 50% of layers #4380

Closed
woodbri opened this Issue Jul 6, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@woodbri

woodbri commented Jul 6, 2012

Only 16 of 32 layers generated useful SLD files using perl mapscript. using mapserver 6.2.0-beta1. I can supply the whole mapfile if it is needed.

MapServer version 6.2.0-beta1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=GD 
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=GEOS INPUT=JPEG 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Here is my perl script:

woodbri@mappy:~/work/geoserver$ cat mapfile2sld
#!/usr/bin/perl -w
use strict;
use mapscript;

sub Usage {
    die "Usage: mapfile2sld mapfile out_dir\n";
}

my $mf  = shift @ARGV || Usage();
my $dir = shift @ARGV || Usage();

mkdir $dir, 0777;
die "Directory '$dir' does not exist or failed to create it! : $!\n"
    unless -d $dir;

my $oMap = new mapscript::mapObj( $mf );

for (my $i=0; $i<$oMap->{numlayers}; $i++) {

    my $oLay = $oMap->getLayer($i);

    my $SLD = $oLay->generateSLD();

    my $fname = "$dir/" . $oLay->{name} . ".xml";
    open(OUT, ">$fname") || die "Failed to create '$fname'! : $!\n";
    print OUT $SLD;
    close(OUT);
}

16 of the files contain nothing more than this:

woodbri@mappy:~/work/geoserver/tiger2011-mc$ cat linear_water.xml
<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>

Here is the layer definition:

    LAYER
        NAME "linear_water"
        METADATA
            "ows_title"     "Streams and Rivers"
            "ows_srs"       "EPSG:4269 EPSG:4326"
            "ows_abstract"  "Streams and Rivers from the U.S. Census LINEARWATER data layer."
        END
        TYPE LINE
        TILEINDEX "tidx-LINEARWATER"
        PROJECTION
            "+proj=longlat +ellps=GRS80 +datum=NAD83" #EPSG: 4269
        END
        #INCLUDE "map-LINEARWATER.inc"
  # map-LINEARWATER.inc
  MAXSCALEDENOM 15000
  CLASS  # water
    STYLE
      COLOR "#a5bfdd"
      WIDTH 1.0
    END
    LABEL
      MAXSCALEDENOM 10000
      TYPE TRUETYPE
      FONT "sans-italic"
      SIZE 8
      COLOR "#627A9D"
      OUTLINECOLOR "#B3C9E2"
      PARTIALS FALSE
      MINDISTANCE 250
      MINFEATURESIZE 10
      BUFFER 4
      ANGLE FOLLOW
      PRIORITY 4
    END
  END
    END
@woodbri

This comment has been minimized.

Show comment Hide comment
@woodbri

woodbri Jul 6, 2012

Also I noticed that none of the PointSymbolizer objects in the XML are filled in.

woodbri commented Jul 6, 2012

Also I noticed that none of the PointSymbolizer objects in the XML are filled in.

@woodbri

This comment has been minimized.

Show comment Hide comment
@woodbri

woodbri Jul 6, 2012

Ok, the layer must have STATUS ON to be output as SLD.

So the PointSymbolizer objects in the XML are not filled in.

woodbri commented Jul 6, 2012

Ok, the layer must have STATUS ON to be output as SLD.

So the PointSymbolizer objects in the XML are not filled in.

@mapserver-bot

This comment has been minimized.

Show comment Hide comment
@mapserver-bot

mapserver-bot Feb 23, 2016

This is an automated comment

This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen with missing/relevant information if still valid.

Typically, issues fall in this state for one of the following reasons:

  • Hard, impossible or not enough information to reproduce
  • Missing test case
  • Lack of a champion with interest and/or funding to address the issue

This is an automated comment

This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen with missing/relevant information if still valid.

Typically, issues fall in this state for one of the following reasons:

  • Hard, impossible or not enough information to reproduce
  • Missing test case
  • Lack of a champion with interest and/or funding to address the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment