thematic mapping from external db
Nolte, Tim
Tim.Nolte at IPCSWIRELESSINC.COM
Mon Jan 14 13:31:17 PST 2008
Ben,
I do this before doing my $oMap->draw(), that call is usually at the end
of the process and makes your final image. Here is an example of what I
use to set layer data on-the-fly.
$layer_data = "geom FROM (";
$layer_data .= " SELECT st.bts_nbr,";
$layer_data .= " sgt.geom";
$layer_data .= " FROM site_tab st, site_geom_tab sgt";
$layer_data .= " WHERE st.site_id =".$_GET['site_id'];
$layer_data .= " AND st.site_id = sgt.site_id";
$layer_data .= " ) USING SRID 8307";
//plot site
$point_layer = $oMap->getLayerByName("Point");
$site_layer = ms_newLayerObj($oMap, $point_layer);
$site_layer->set("group", "Cell Sites");
$site_layer->set("name", "Selected Site");
$site_layer->set("connectiontype",MS_ORACLESPATIAL);
$site_layer->set("connection","username/password");
$site_layer->set("data", $layer_data);
$site_layer->set("status",MS_ON);
I think in your case your layers are probably Shapefiles, in this case
you'd need to set the data parameters on the layer. You might need to
use an OGR connection for you Shapefile layer to do a spatial query.
I'll be honest that I haven't done Shapefile queries but mostly spatial
database queries. I'm quite certain however that you can spatially query
a Shapefile. Anyone else care to chime in?
----
Timothy J Nolte - tnolte at ilpcs.com
Associate Network Planning Engineer
iPCS Wireless, Inc.
4717 Broadmoor Ave, Suite G
Kentwood, MI 49512
Office: 616-656-5163
PCS: 616-706-2438
Fax: 616-554-6484
Web: www.ipcswirelessinc.com
-----Original Message-----
From: Ben Thompson [mailto:benftee at gmail.com]
Sent: Monday, January 14, 2008 3:50 PM
To: Nolte, Tim
Subject: Re: [UMN_MAPSERVER-USERS] thematic mapping from external db
I have php_mapscript_4.10.0.dll - is that the version number?
Anyway, how and where in the process do you change the data values?
I suspect that changing it in the shape object in a widget's parseUrl
(as I'm doing) is either too late (map already drawn),
or, the change does not persist (is made in a copy of the data in the
shape object)
Thanks...
On Jan 14, 2008 3:45 PM, Nolte, Tim < Tim.Nolte at ipcswirelessinc.com
<mailto:Tim.Nolte at ipcswirelessinc.com> > wrote:
Ben,
I think what you need to be doing is actually use a spatial
query on
your shape data using the results of your external database. I'm
not
sure which MapScript you are using, but I've done this with PHP
MapScript do dynamically change the data in my layers using
separate
database queries.
----
Timothy J Nolte - tnolte at ilpcs.com
Associate Network Planning Engineer
iPCS Wireless, Inc.
4717 Broadmoor Ave, Suite G
Kentwood, MI 49512
Office: 616-656-5163
PCS: 616-706-2438
Fax: 616-554-6484
Web: www.ipcswirelessinc.com
-----Original Message-----
From: UMN MapServer Users List
[mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Ben Thompson
Sent: Monday, January 14, 2008 2:35 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
<mailto:MAPSERVER-USERS at LISTS.UMN.EDU>
Subject: [UMN_MAPSERVER-USERS] thematic mapping from external db
Hello mappers,
We're trying to color shapes on the map according to values from
an extenal database.
I tried adding 5 classes to the mapfile layer, each with a
different color (and no expression)then
setting $oShape->classindex to this or that value in the widget
parseUrl function. This has no
effect. Anyone know why? Am I wrongly assuming that shapindex is
supposed to dictate which class
the shape belongs to? Ideas for another way?
Thanks,
Ben Thompson
More information about the MapServer-users
mailing list