PHP Highlight list of Parcels Passed In

Abe Gillespie agillesp at VT.EDU
Sat Jan 22 17:21:39 PST 2005


Something else I noticed.  You shouldn't even have to setup a separate
layer to show queried parcels (though there are ways to do this).  I
suggest starting out with one layer that renders queried and
non-queried parcels at the same time.  Once you get the hang of that
then you can do two different layers (if you still even want to).  Make
the layer like this:

LAYER
  NAME "parcels"
  DATA "parcels"
  STATUS on
  TYPE polygon
  CLASS
   OUTLINECOLOR 0 255 0
  END
  TEMPLATE "x"  # Must be present to query on (though "x" means
absolutely nothing).
END

The above layer will render all your parcels green outline with hollow
fill.  Then when you use the PHP code to query it will render your
queried parcels red.  This assumes you have QUERYMAP setup correctly.

-Abe

On Jan 22, 2005, at 7:12 PM, Steve Lehr wrote:

> Abe I've never used the QUERY MAP before, I tried putting it in the
> layer
> and it did not like that?
>
> My initial layer looks like:
>
> I changed my code to pass Pipe delimited.
>
> But I'm not quite certian I'm still getting what I need to do to my
> .map.
>
> Thanks for the help..below is the layer repeated my EXPRESSION is
> trashed I
> realize.
>
>>   LAYER
>>     NAME "selected_parcels"
>>     DATA parcels
>>     STATUS DEFAULT
>>     TYPE POLYGON
>>     CLASSITEM QPID
>>     CLASS
>>       EXPRESSION "/%parcels%/"
>>       COLOR 255 0 0
>>     END
>>   END
>
>
> Steven Lehr
> Assistant Professor
> Freshmen Program
> College of Engineering
> Embry-Riddle Aeronautical University (LB159)
> 600 S. Clyde Morris Blvd.
> Daytona Beach, FL 32114-3900
> 386-226-7740
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
> Behalf Of Abe Gillespie
> Sent: Saturday, January 22, 2005 7:05 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] PHP Highlight list of Parcels Passed
> In
>
>
> For the red you need to setup the QUERYMAP.  For the PHP it will be
> something like this:
>
> $target = use_appropriate_string_func_to_conver_semi_to_pipe($parcels);
> // $target should look like "1|2|3|4" ... where the numbers are the
> IDs.
> $layer = $map->getLayerByName("parcels");
> $layer->queryByAttributes("parcel_id_field", "/".$target."/",
> MS_MULTIPLE);
>
> Also, don't forget to add the TEMPLATE "x" tag in your LAYER
> definition.
>
> I'm not a RegEx expert, so someone please put me in check if I'm
> leading Steven astray.
>
> -Abe
>
> On Jan 22, 2005, at 6:37 PM, Steve Lehr wrote:
>
>> I'm trying to write some PHP that I can send extents and list of
>> parcels to
>> get it to highlight the parcels.
>>
>> I'd like to highlight all the found parcels in RED.
>>
>> My php gets a variable by post called parcels and contains at this
>> time a
>> semi colon delimited list of ids in the attribute column QPID of the
>> parcels.dbf.
>>
>>   LAYER
>>     NAME "selected_parcels"
>>     DATA parcels
>>     STATUS DEFAULT
>>     TYPE POLYGON
>>     CLASSITEM QPID
>>     CLASS
>>       EXPRESSION "/%parcels%/"
>>       COLOR 255 0 0
>>     END
>>   END
>>
>>
>> I've got my extents.  I've got the list of parcels.  Now I want to
>> highlight
>> the list of parcels with something like the below.  But I have to do
>> something in php to take that ; delimited list and the turn on all the
>> matching attributes.  (I belive its a QUERYMAP with MULTIPLE_SELECT)
>> but I'm
>> having trouble getting my brain around what I need to code - might
>> someone
>> have a sample.
>>
>> Thanks
>>
>> Steven Lehr
>> Assistant Professor
>> Freshmen Program
>> College of Engineering
>> Embry-Riddle Aeronautical University (LB159)
>> 600 S. Clyde Morris Blvd.
>> Daytona Beach, FL 32114-3900
>> 386-226-7740
>>
>



More information about the MapServer-users mailing list