MapTools.org

[maplab-users] Need a adult's assistance

Dean Gadoury gadoury@dmsolutions.ca
Wed, 26 Mar 2003 15:19:30 -0500
Andrew,
I'll cover parts of your questions here. I'm still looking into others.

The CLASSITEM is used only if you want to apply separate display 
characteristics to different features in your data based on an 
attribute, as in a thematic map. You set the attribute you want to use 
to differentiate features as the CLASSITEM in the LAYER object, then you 
use an EXPRESSION in each CLASS object. For example if you wanted to 
make each country a different colour you could use CNTRY_NAME as the 
CLASSITEM, add a class for each country with an appropriate expression 
in each class. Here's an example, showing two countries that would 
achieve this effect:

  LAYER
    NAME "global countries region"
    GROUP "countries"
    STATUS ON
    DATA "global/pan-global/Global_Countries_region"
    TYPE POLYGON
    CLASSITEM "CNTRY_NAME"
    LABELITEM "CNTRY_NAME"
    UNITS DD
    SIZEUNITS DD
    TEMPLATE "ttt.html"
    METADATA
      "name"    "cntry_name"
    END
    CLASS
      NAME "USA"
      EXPRESSION "United States"
      COLOR 153 255 176
      OUTLINECOLOR 49 177 109
      LABEL
        TYPE TRUETYPE
        FONT "fritqat-italic"
        SIZE 8
        POSITION AUTO
        COLOR 0 0 0
      END
    END
    CLASS
      NAME "Canada"
      EXPRESSION "Canada"
      COLOR 255 255 0
      OUTLINECOLOR 49 177 109
      LABEL
        TYPE TRUETYPE
        FONT "fritqat-italic"
        SIZE 8
        POSITION AUTO
        COLOR 0 0 0
      END
    END
  END

This example uses your existing layer. It would result in a map showing 
USA in green and Canada in Yellow. Notice also that I added a LABELITEM 
to your LAYER. That is necessary for labeling - without it MapServer has 
no way of knowing what to use to label features. Hopefully that covers 
two of your questions below.

In terms of query results, all that should be necessary to get query 
results for a layer is a value (any value, even  "x")  for TEMPLATE in 
your LAYER object. Since you have one in your map file and the query is 
still not working there might be a bug or some other problem. I'll have 
someone more technical look into this for you.  I hope this helps.

Dean Gadoury


Andrew Bailey wrote:

>Could someone please give me a basic run through of adding a vector layer to
>a map file? Setting it up so all objects in the layer appear, and the query
>tool returns all attribute information associated with an object...
>
>My current dataset is a polygon layer called 'global countries region' with
>a attribute called 'cntry_name' that i would like to use as a label, other
>attribute information is also present that i would like to appear in the
>query tool results.
>
>I know this is covered in the maplab tutorial but i've found it confusing. I
>would like the relationship between a layer and a class object, and a
>layer's classitem to be clarified. Where names of objects must match
>attribute names for example.
>
>Additionally to my simple brain aches, i can't get the query tool to work.
>When using it with the tutorial.map i always get the following;
>The following layers did not return any results:
>bathymetry, land_fn, drain_fn, drainage, prov_bound, fedlimit, popplace
>
>When i try querying my countries layer i get a fatal php error but i suspect
>it has more to do with my map setup. (winXP, IIS5, php4.2.3, mapserver3.6.3)
>Error details: "szAppName : php.exe szAppVer : 0.0.0.0 szModName :
>php_mapscript_36.dll
>szModVer : 0.0.0.0 offset : 001f96b4"
>
>Regards,
>Andrew Bailey
>
>PS: I've contained the majority of my map file below if that's any help;
>  NAME "PLANETNOMAD"
>  STATUS ON
>  EXTENT -180 -90 180 90
>  SIZE 800 400
>  SHAPEPATH "./data"
>  SYMBOLSET "./etc/symbols.sym"
>  FONTSET "./etc/fonts.txt"
>  IMAGECOLOR 255 255 255
>  UNITS DD
>  IMAGETYPE PNG
>  #
>  # Start of web interface definition
>  #
>  WEB
>    MINSCALE 2000000
>    MAXSCALE 5000000000
>    #
>    # On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the
>root
>    # of the drive where the .MAP file resides.
>    #
>    IMAGEPATH "C:/msapps/tmp_img_path/"
>    IMAGEURL "/ms_tmp/"
>  #  LOG "/tmp/gmap.log"
>  END
>  #
>  # Start of reference object (keymap)
>  #
>  REFERENCE
>    STATUS ON
>    IMAGE "images/keymap.gif"
>    SIZE 200 100
>    EXTENT -180 -90 180 90
>    COLOR -1 -1 -1
>    OUTLINECOLOR 255 0 0
>  END
>  #
>  # Start of querymap object
>  #
>  QUERYMAP
>    COLOR 255 0 0
>    STYLE HILITE
>  END
>  #
>  # Start of legend object
>  #
>  LEGEND
>    STATUS ON
>    KEYSIZE 18 12
>    TEMPLATE "ttt"
>    LABEL
>      TYPE BITMAP
>      SIZE MEDIUM
>      COLOR 0 0 89
>    END
>  END
>  #
>  # Start of scalebar object
>  #
>  SCALEBAR
>    STATUS ON
>    COLOR 255 255 255
>    OUTLINECOLOR 0 0 0
>    BACKGROUNDCOLOR 0 0 0
>    IMAGECOLOR 255 255 255
>    UNITS KILOMETERS
>    INTERVALS 5
>    SIZE 400 5
>    LABEL
>      SIZE SMALL
>      COLOR 0 0 0
>    END
>  END
>  LAYER
>    NAME "global countries region"
>    GROUP "countries"
>    STATUS ON
>    DATA "global/pan-global/Global_Countries_region"
>    TYPE POLYGON
>    CLASSITEM "CNTRY_NAME"
>    UNITS DD
>    SIZEUNITS DD
>    TEMPLATE "ttt.html"
>    METADATA
>      "name"    "cntry_name"
>    END
>    CLASS
>      NAME "cntry_name"
>      COLOR 153 255 176
>      OUTLINECOLOR 49 177 109
>      LABEL
>        TYPE TRUETYPE
>        FONT "fritqat-italic"
>        SIZE 8
>        POSITION AUTO
>        COLOR 0 0 0
>      END
>    END
>  END
># Layer
>
>_______________________________________________
>Maplab-users mailing list
>Maplab-users@dmsolutions.ca
>http://lists.dmsolutions.ca/mailman/listinfo/maplab-users
>
>  
>

-- 
___________________________

Dean Gadoury

DM Solutions Group
72 Chamberlain Ave. Third Floor
Ottawa, Ontario. K1S 1V9
613 565-5056 ext. 24

gadoury@dmsolutions.ca
www.dmsolutions.ca






This archive was generated by Pipermail.