[mapserver-users] RE: Highlight
Steve Lime
Steve.Lime at dnr.state.mn.us
Tue Apr 14 14:18:23 PDT 2009
This is an example of how to highlight a feature (click on a dot in the application I sent) without
doing query maps or anything like that. You're manipulating a layer filter on-the-fly based on your
search result. This can work with multiple results but is best suited to just a few results. With more
than that you really need to look at some other way to cache features- a queryfile or some sort
of a temp table.
Sorry if I've confused things.
Steve
>>> On 4/14/2009 at 3:23 PM, in message
<D7A5EAC385604446AB1DD24BF4F5A9184FB90EE805 at MG-Mail.ci.maple-grove.mn.us>, Jay
Kapalczynski <jkapalczynski at ci.maple-grove.mn.us> wrote:
> I am having a hard time trying to understand how that applies to what I am
> doing....I do appreciate the help here.
> Just trying to find a solution here...
>
>>From my main page I run a query in PHP that returns specific records
> I then move to a different web page that has a couple frames.
> I display the map in one frame and build a table in the 2nd frame that shows
> the results.
> In the table I have a field that will zoom to and identify that feature in
> the main map
>
> The only thing I am missing is after I run the query none of the parcels are
> highlighted in the map...
> I want to create the table and highlight the returned parcels in the map...
>
> Getting pretty confused right now...dont know the best way to accomplish
> this...going in 4 different directions right now..
> The Query is being done in PHP, so I somehow need to take that result (comma
> delimited string) and get a the PID values from that to show up highlighted
> in my map..
>
> Before I go on does anyone have a suggestion as to what would be the best
> course of action...
> Like Steve said, Like I am doing...
>
> Thanks Guys...you help is appreciated...
>
>
>
>
>
> -----Original Message-----
> From: Fawcett, David [mailto:David.Fawcett at state.mn.us]
> Sent: Tuesday, April 14, 2009 2:39 PM
> To: Jay Kapalczynski; Steve Lime; mapserver-users at lists.osgeo.org; Paul T.'
> 'Moen
> Subject: RE: [mapserver-users] RE: Highlight
>
> Steve is using CGI MapServer instead of php.
>
> When you click on a station, you will notice that the outline of the
> station turns yellow.
>
> Here is the URL to a tile with a highlighted symbol on it:
> http://maps.dnr.state.mn.us/cgi-bin/mapserv52?map=/usr/local/mapserver/a
> pps/waters/csg/csg.map&layers=active_site&map_transparent=true&id=0&mode
> =map&map_imagetype=png&station=63023001&mapext=-27687.5+4793250+941687.5
> +5480750&imgext=-27687.5+4793250+941687.5+5480750&map_size=705+500&imgx=
> 352.5&imgy=250&imgxy=705+500
>
> Notice that he has a layer called 'active_site' and he is passing in the
> station ID use in a class in that layer to turn only that feature
> yellow.
>
> When no station is selected, no stations are drawn in the 'active_site'
> layer.
>
> David.
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jay
> Kapalczynski
> Sent: Tuesday, April 14, 2009 2:30 PM
> To: 'Steve Lime'; mapserver-users at lists.osgeo.org; Paul T.' 'Moen
> Subject: RE: [mapserver-users] RE: Highlight
>
>
> Thanks....but little confused as to what I am look at...
>
> How is this working?
>
>
>
> -----Original Message-----
> From: Steve Lime [mailto:Steve.Lime at dnr.state.mn.us]
> Sent: Tuesday, April 14, 2009 1:02 PM
> To: Jay Kapalczynski; mapserver-users at lists.osgeo.org; Paul T.' 'Moen
> Subject: RE: [mapserver-users] RE: Highlight
>
> This is probably too late to be of use but I've been using a highlight
> layer to achieve this. The layer takes input from a URL so that layer
> filter allows just the desired feature through. Works quite nicely and
> is relatively simple to implement. Here's an OpenLayers site that uses
> this:
>
> http://www.dnr.state.mn.us/waters/csg/index_copy.html
>
> In this case the highlight is a separate layer but you could just as
> easily return a single map.
>
> Steve
>
>>>> On 4/13/2009 at 11:17 AM, in message
> <D7A5EAC385604446AB1DD24BF4F5A91841F1A74D7A at MG-Mail.ci.maple-grove.mn.us
>>, Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us> wrote:
>> So say I have a Database that I am querying...
>> I get the results back with a PID number (unique)
>> This number exists in the Parcels Shapefile so I can go after that
>> field. I have a map file that is set up for the Parcels, but this is
>> just there to draw the Parcels... I assume that I would have to modify
>
>> this one for this to work?
>>
>> I am just a bit confused on how to get this to work...
>> When I run the code that creates the Table below I want the parcels to
>
>> also
>> highlight in the map....
>>
>> Attached is my code that I am using to get the resulting PID Values,
>> build
>> the table, and populate the last frame showing the Comma Delimited
> String.
>> I just don't know how to apply that to my map?
>>
>> I attached my code from my PHP page which I hope that someone can at
>> least
>> put their eyes on...
>> Towards to bottom you will see highlighted in RED the code that I am
>> building a comma delimited string to populate a variable with all the
> PID
>> numbers...
>> I assume that I would not need the comma delimited string as I could
> place
>> the highlighting code inside the while loop to get the parcels
> highlighted...
>> I don't really know...
>>
>> Any thoughts?
>>
>> Thanks
>>
>>
>> This inside the while loop????
>>
>> $map = ms_newMapObj(PATH TO YOU MAPFILE);
>> $qlayer = $map->$map->getLayerByName(NAME OF PARCEL LAYER);
>> $qlayer->queryByAttributes('PID','PID IN (MY COMMA DELIMITED STRING
>> VARIABLE')',MS_MULTIPLE); $img = $map->drawQuery();
>> header('Content-Type: image/jpeg');
>> $img->saveImage("");
>>
>>
>> [cid:image001.jpg at 01C9BC29.7A1ECE10]
>>
>> From: mapserver-users-bounces at lists.osgeo.org
>> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Moen,
> Paul T.
>> Sent: Thursday, April 09, 2009 3:15 PM
>> To: mapserver-users at lists.osgeo.org
>> Subject: Re: [mapserver-users] RE: Highlight
>>
>>
>> If the database that you are querying has the same attributes as the
>> shape
>> file, you can query the Layer that points to the shape file and
> display the
>> highlighted results on your map. I know nothing about GeoMOOSE but I
> know it
>> can be done with php-mapscript.
>>
>> Regardless of what you are using, you need a map file layer for the
>> shape
>> file with the parcels.
>> You will then need to use php-mapscript to query that layer with
> something
>> like
>> $map = ms_newMapObj(PATH TO YOU MAPFILE);
>> $qlayer = $map->$map->getLayerByName(NAME OF PARCEL LAYER);
>> $qlayer->queryByAttributes('PID','PID IN (1,
> 2,7,9,23,87)',MS_MULTIPLE);
>> You will then need to create the output image from query using
> something
>> like
>> $img = $map->drawQuery();
>> header('Content-Type: image/jpeg');
>> $img->saveImage("");
>>
>> I can't give you specifics without knowing how GeoMOOSE works, so the
>> best
>> thing is to look at the documentation for GeoMOOSE if that is what you
> are
>> using.
>>
>> On 4/9/09 2:17 PM, "Jay Kapalczynski"
>> <jkapalczynski at ci.maple-grove.mn.us>
>> wrote:
>> Dang I misspoke...I am sorry...
>>
>> I am querying a Database for records, these records have a PID (unique
>> Number).
>> These are the records that show up in the Table.
>>
>> As this happens I have to take the results and run the query against
>> the
>> parcels to get the features in the Shapefile, then highlight..
>>
>> If that makes any sense...
>>
>> If I am in a PHP file and have the records returned from the query
>> (database)...what would I have to do next to take those records and
> run a
>> query to highlight the parcels (PID to PID)?
>>
>> Can all of this be accomplished in the PHP file?
>>
>> Thanks...and sorry for my ignorance...
>>
>>
>>
>>
>> From: mapserver-users-bounces at lists.osgeo.org
>> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Moen,
> Paul T.
>> Sent: Thursday, April 09, 2009 1:57 PM
>> To: mapserver-users at lists.osgeo.org
>> Subject: Re: [mapserver-users] RE: Highlight
>>
>> Set the mapfile QUERYMAP style to highlight
>> http://mapserver.org/mapfile/querymap.html. Draw the map using
> drawQuery()
>> instead of draw().
>>
>> $img = $map->drawQuery();
>> header('Content-Type: image/jpeg');
>> $img->saveImage("");
>>
>> On 4/9/09 1:31 PM, "Jay Kapalczynski"
>> <jkapalczynski at ci.maple-grove.mn.us>
>> wrote:
>> Basically what I have is a query that runs on a shapefile...
>> It returns the records into a table, which I then have the option to
> zoom
>> to.
>>
>> I am looking for a bit more....after I run the query (php) I want the
>> returned records to highlight in the map...
>> I can get the Unique identifier but don't know if I can write some
> code in
>> PHP to highlight those features
>>
>> I don't even know where to start here...
>>
>> The query and returning records into the table, as well as, the zoom
>> to work
>> great...just need the highlight part
>>
>> Thanks
>>
>>
>>
>> From: Jay Kapalczynski
>> Sent: Thursday, April 09, 2009 1:03 PM
>> To: 'mapserver-users at lists.osgeo.org<mapserver-users at lists.osgeo.org>
>> <mapserver-users at lists.osgeo.org> '
>> Subject: Highlight
>>
>> Any way to highlight a feature in my map in PHP?
>>
>> I can grab a unique identifier but can figure out how to highlight
>> it...
>>
>> THanks
>>
>>
>> Paul
>>
>> Paul
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list