[mapserver-users] RE: Highlight
Moen, Paul T.
pmoen at nd.gov
Thu Apr 9 14:13:40 PDT 2009
Yes, that looks feasible.
On 4/9/09 3:49 PM, "Jay Kapalczynski" <jkapalczynski at ci.maple-grove.mn.us> wrote:
That's what I was figuring....right now I have some code that is in a while loop building the table from the query...
I think maybe here I can build a list of PID values that can be sent to a PHP page
Once at the PHP page I can then write code that will highlight the features in the map based off of the Parcels Shapefile...
Does that make sense?
Is that feasible???
Something like this?
THANKS
<?php
$conn=odbc_connect('PDS_Access_db','','');
switch ($varPropertyFactor)
{
case 'lessthan':
$sql_str="SELECT * FROM dbo_DISPLAY_RESIDENTIAL_CHARS WHERE Dwelling_Type = '$varPropertyType' AND FF_GBA < $varPriceArea ORDER BY PID";
//echo $sql_str;
break;
}
$rs=odbc_exec($conn,$sql_str);
if (!$conn)
{exit("Connection Failed: " . $conn);}
if (!$rs)
{exit("Error in SQL");}
while (odbc_fetch_row($rs))
{
$PID=odbc_result($rs,1);
$AssessmentYr=odbc_result($rs,2);
$YrBuilt=odbc_result($rs,109);
$Bedrooms=odbc_result($rs,116);
$DwellingType=odbc_result($rs,8);
$Style=odbc_result($rs,7);
$Construction=odbc_result($rs,10);
$Exterior=odbc_result($rs,11);
$RoofType=odbc_result($rs,14);
$Air=odbc_result($rs,19);
$GarageCars=odbc_result($rs,29);
$SqFootage=odbc_result($rs,142);
$Electric=odbc_result($rs,48);
$Heating=odbc_result($rs,49);
$Path=odbc_result($rs,147);
$Image=odbc_result($rs,149);
$Print=odbc_result($rs,150);
echo "
<tbody class='scrollContent bodyFormat' style='height:160px;'>
<tr class='alternateRow'>
<td align=Center>$PID</td>
<td align=Center>$AssessmentYr</td>
<td align=Center>$YrBuilt</td>
<td align=Center>$Bedrooms</td>
<td align=Center>  $DwellingType  </td>
<td align=Center>  $Style  </td>
<td align=Center><strong><a href='$Path' target='main'>Map</a></strong></td>
<td align=Center><strong><a href='$Print' target='_blank'>Print</a></strong></td>
<td align=Center><a href='javascript:Map.itemQueryLayer('Highlight', 'Parcels', 'PID', '$PID', '/ms4w/apps/GeoMOOSE/Maple_Grove_GeoMoose/select.map'); Map.zoomToViewString(([shpminx]-100)+','+([shpminy]-100)+','+([shpmaxx]+100)+','+([shpmaxy]+100))'><img src='../shared/images/view.png' border='0' title='Click to Zoom Map to PID'></a></td>
</tr>
</tbody>
";
BUILD THE COMMA DELIMITED LIST RIGHT HERE
} // end while
AFTER ALL HAVE BEEN SELECTED and THE LIST BUILT
SEND THE LIST TO ANOTHER PHP PAGE TO HANDLE THE HIGHLIGHTING OF THE FEATURES
?>
From: Fawcett, David [mailto:David.Fawcett at state.mn.us]
Sent: Thursday, April 09, 2009 3:34 PM
To: Jay Kapalczynski; Moen, Paul T.; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] RE: Highlight
Or a string variable containing a comma-delimited list of the ID numbers that you really want?
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: Thursday, April 09, 2009 3:31 PM
To: 'Moen, Paul T.'; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] RE: Highlight
Thanks for your response...
$qlayer->queryByAttributes('PID','PID IN (1, 2,7,9,23,87)',MS_MULTIPLE);
Is the 1, 2,7,9,23,87 examples of PID values, if so I assume that these can be replaced with variables?
Thanks again
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090409/c2e7c445/attachment.htm>
More information about the MapServer-users
mailing list