Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1641 closed defect (invalid)

Adding to an expression with PHP ( help! )

Reported by: calmeida@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: unspecified
Severity: normal Keywords:
Cc:

Description

I've been trying to use this USA/States map that have predefined classes for 
every color that you would want to make each state/county.

Snip:

    LAYER
        NAME "co"
        TYPE POLYGON
        STATUS OFF
        DATA         co99_d00
        LABELITEM "NAME"

        PROJECTION
            "proj=latlong"
            "ellps=GRS80"
            "datum=NAD83"
        END
        CLASS
            NAME "Aqua counties"
            EXPRESSION ([STATE]=56 AND %aquaexpr%)
            COLOR 0 255 255
            OUTLINECOLOR 99 101 99
        END

I've used the mapserv cgi to get what I want, but I really need to get the PHP 
version working. The syntax for aquaexpr is [COUNTY]=34 <-- state fips number.

I've gotten this far:

$map = ms_newMapObj($map_path."state-wy.map");
$outLayer = $map->getlayerbyname("co");
$outLayer->set("status", 1);

    $oClass = $outLayer->getClass(0);
    $oClass->set("aquaexpr","[COUNTY]=15");  // Does not work.


$image=$map->draw();
$image_url=$image->saveWebImage();

Please give me some advice as to how I should either reset the expression or 
set that %aquaexpr% var.

Thanks!

- Chris

Change History (2)

comment:1 by assefa, 18 years ago

Resolution: invalid
Status: newclosed
Hi There,

 php works diffrently from the cgi in the sense that there is no varibale
substitution.

 What you have is functions on the class object setexpression and getexpression
that let's you extract and set the values of the expression
(http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class). 
 If you need know the value of the expression, just use the setexpression to do
what you want. If you need to parse/maipulate the string before setting the
expression, you should do it using php string functions (php.net)

 I am closing this bug since It is noit really a bug :) 
 This kind of questions should go on the mapserver user list. 

comment:2 by assefa, 18 years ago

*** Bug 1640 has been marked as a duplicate of this bug. ***
Note: See TracTickets for help on using tickets.