<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font size="2" face="Arial">Hi,<br>
      <br>
      I've come to the same conclusion this morning about using a
      different layer for each style.  It should work with the way my
      data is arriving from the client. It just seems like a more
      complicated method.<br>
      <br>
      I cannot change to the SWIG MapScript at the moment. Too much to
      change. That will happen when we build the next server with an OS
      version jump.<br>
      <br>
      Thanks for your suggestions.<br>
      <br>
    </font>
    <div class="moz-signature"><b>Worth Lutz</b><br>
      <br>
      <br>
    </div>
    <div class="moz-cite-prefix">On 10/16/23 10:29, Seth G wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:8e15822f-6ab6-43a2-bbc1-8fa2fe6bd58f@app.fastmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title></title>
      <style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
      <div>Hi,<br>
      </div>
      <div><br>
      </div>
      <div>You could probably achieve this with the new SWIG MapScript.
        <br>
      </div>
      <div><br>
      </div>
      <div>Alternatively how about creating an individual LAYER for each
        set of features with a single CLASS (I'm not sure how the CLASS
        is determined if the features have no attributes in the first
        place), and adding features to the relevant layer. <br>
      </div>
      <div><br>
      </div>
      <div>If you then want to combine these into a single layer you
        could try a UNION LAYER [1], and use the <span
style="color:rgb(62, 67, 73);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgb(255, 255, 255);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none;"><span
            class="font" style="font-family:Arial, sans-serif;"><span
              class="size" style="font-size:12.8px;">STYLEITEM AUTO to
              pick up the styles from the layers.</span></span></span><br>
      </div>
      <div><br>
      </div>
      <div><span
style="color:rgb(62, 67, 73);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgb(255, 255, 255);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none;"><span
            class="font" style="font-family:Arial, sans-serif;"><span
              class="size" style="font-size:12.8px;">Seth</span></span></span><br>
      </div>
      <div><br>
      </div>
      <div>[1] <a href="https://mapserver.org/mapfile/union.html"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://mapserver.org/mapfile/union.html</a><br>
      </div>
      <div>[2] <a
href="https://mapserver.org/mapfile/union.html#classes-and-styles"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://mapserver.org/mapfile/union.html#classes-and-styles</a></div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div id="sig62266145">
        <div class="signature">--<br>
        </div>
        <div class="signature">web:<a href="https://geographika.net"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://geographika.net</a>
          & <a href="https://mapserverstudio.net"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://mapserverstudio.net</a><br>
        </div>
        <div class="signature">twitter: @geographika<br>
        </div>
      </div>
      <div><br>
      </div>
      <div>On Mon, Oct 16, 2023, at 2:57 PM, Worth Lutz wrote:<br>
      </div>
      <blockquote type="cite" id="qt" style="">
        <div><span class="font" style="font-family:Arial;"><span
              class="size" style="font-size:13px;">Hi,<br>
              <br>
              I had thought of trying that but the attributes in the
              values are read-only. Since i created the shapeObj from
              WTK there are no values.<br>
              <br>
              I'm using v7 of MapServer and the old PHP mapscript. There
              does not appear to be a way for me to set attributes on
              these shapes which are being passed down from an
              OpenLayers client app.<br>
              <br>
              I had thought of setting a single class and putting the
              different colors, etc, in as attribute values in the
              shapeObj but cannot find a way to write them to the
              object.<br>
              <br>
              I'll try any suggestions given.<br>
              <br>
              Thanks,<br>
              <br>
            </span></span></div>
        <div class="qt-moz-signature">
          <div><b>Worth Lutz</b><br>
          </div>
          <div><br>
          </div>
        </div>
        <div class="qt-moz-cite-prefix">On 10/16/23 03:59, Seth G wrote:<br>
        </div>
        <blockquote type="cite"
cite="mid:d99a0c90-5c23-4033-a475-ab6d36394f6d@app.fastmail.com">
          <div>Hi,<br>
          </div>
          <div><br>
          </div>
          <div>The rendering code could be reassigning the classindex
            for the shapes based on their attributes. You will probably
            need to make sure the CLASS is assigned based on an
            attribute of the feature - e.g. add a CLASSITEM to the layer
            and add a value to the feature that will match the correct
            CLASS.<br>
          </div>
          <div><br>
          </div>
          <div>Seth<br>
          </div>
          <div><br>
          </div>
          <div id="qt-sig62266145">
            <div class="qt-signature">--<br>
            </div>
            <div class="qt-signature">web:<a
                href="https://geographika.net"
                class="qt-moz-txt-link-freetext moz-txt-link-freetext"
                moz-do-not-send="true">https://geographika.net</a>
              & <a href="https://mapserverstudio.net"
                class="qt-moz-txt-link-freetext moz-txt-link-freetext"
                moz-do-not-send="true">https://mapserverstudio.net</a><br>
            </div>
            <div class="qt-signature">twitter: @geographika<br>
            </div>
          </div>
          <div><br>
          </div>
          <div>On Sun, Oct 15, 2023, at 3:12 PM, Worth Lutz via
            MapServer-users wrote:<br>
          </div>
          <blockquote type="cite" id="qt-qt" style="">
            <div><span class="font" style="font-family:Arial;"><span
                  class="size" style="font-size:13px;">HI,<br>
                  <br>
                  I'm trying to create a layer to insert into a map. I
                  have shapes in WKT and am trying to insert them into a
                  layer and draw it to a pdf.<br>
                  <br>
                  It works fine if I only have one class for the shapes.
                  I am trying to add several classes to the layer to
                  draw in different colors. I cannot get the shapes to
                  use the proper class.<br>
                  <br>
                  Here is what I'm doing.<br>
                  <br>
                  After creating a layer and adding all the classes, I
                  add the shapes.</span></span></div>
            <blockquote>
              <div><span class="font" style="font-family:monospace;">for
                  (i = 0, ii = count($features); $i < $ii; i++) {</span><br>
              </div>
              <div><span class="font" style="font-family:monospace;">   
                  $shape = ms_shhapeObjFrom
                  Wkt($features[$i]->geometry);</span><br>
              </div>
              <div><span class="font" style="font-family:monospace;">   
                  $shape->set('classindex',
                  $features[$i]->classindex);</span><br>
              </div>
              <div><span class="font" style="font-family:monospace;">   
                  $success = $layer->addFeature($shape);</span><br>
              </div>
              <div><span class="font" style="font-family:monospace;">}</span><br>
              </div>
            </blockquote>
            <div><span class="font" style="font-family:Arial;"><span
                  class="size" style="font-size:13px;">The shapes draw
                  but all use $class[0].<br>
                  <br>
                  If I add this line in before the draw,<br>
                  <br>
                      $layer-moveclassup(1);<br>
                  <br>
                  all the shapes are drawn with that class.<br>
                  <br>
                  I have been able to verify that the classes exist in
                  the layerObj and that the classindex in the shapeObj
                  points to the proper class.<br>
                  <br>
                  Does anyone have any ideas why the drawing code is not
                  using the classindex to draw these shapes in different
                  colors?<br>
                  <br>
                  What am I doing wrong?<br>
                </span></span></div>
            <div class="qt-qt-moz-signature">
              <div>--<br>
              </div>
              <div><b>Worth Lutz</b><br>
              </div>
              <div><br>
              </div>
            </div>
            <div>_______________________________________________<br>
            </div>
            <div>MapServer-users mailing list<br>
            </div>
            <div><a href="mailto:MapServer-users@lists.osgeo.org"
                class="qt-moz-txt-link-freetext moz-txt-link-freetext"
                moz-do-not-send="true">MapServer-users@lists.osgeo.org</a><br>
            </div>
            <div><a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-users"
                class="qt-moz-txt-link-freetext moz-txt-link-freetext"
                moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
            </div>
            <div><br>
            </div>
          </blockquote>
          <div><br>
          </div>
        </blockquote>
      </blockquote>
      <div><br>
      </div>
    </blockquote>
    <br>
  </body>
</html>