[mapserver-users] plotting points dynamically

Nolte, Tim Tim.Nolte at ipcswirelessinc.com
Tue Jun 30 08:23:25 PDT 2009


I generally do this all via MapScript, I'm using PHP. I add some basic
layers with the styling that I want to my mapfile. Then using MapScript
I make a copy or modify the mapfile layers. I even do this with Oracle
Spatial layers. Here is a sample of my code:

		$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
		if (!$oMap->getLayerByName("Selected Sites")) {
			$point_layer = $oMap->getLayerByName("Point");
			$site_layer = ms_newLayerObj($oMap,
$point_layer);
			$site_layer->set("name", "Selected Sites");
			$start = $point_layer->index;
			$end = $site_layer->index;
			for ($x=$start;$x<=$end;$x++) {
				$oMap->moveLayerUp($site_layer->index);
			}
		} else {
			$site_layer = $oMap->getLayerByName("Selected
Sites");
		}
		$site_layer->setConnectionType(MS_ORACLESPATIAL);
		$site_layer->set("connection",$spatialconn);
		$site_layer->set("data", $layer_data);
		$site_layer->set("status",MS_ON);

This let's me do a lot dynamically.

- Tim

----
Timothy J Nolte - tnolte at ilpcs.com
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: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Suman
Chatterjee
Sent: Tuesday, June 30, 2009 10:58 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] plotting points dynamically

Hi all,

I am working on a project which requires adding points to a basic map
dynamically. That means  the basic map will be read from the map file.
Then the points will be queried from a database preferably PostGreSQL
and then plotted on the map. I cannot add the query to the map file
because the points will be generated dynamically at regular intervals. 

Is there any way I can do this in mapserver?

 

************************************************************************
******************************************* 

This e-mail and any files or attachments transmitted with it contains
Information that is confidential and privileged. This document may
contain Protected Health Information (PHI) or other information that is
intended only for the use of the individual(s) and entity(ies) to whom
it is addressed. If you are the intended recipient, further disclosures
are prohibited without proper authorization. If you are not the intended
recipient, any disclosure, copying, printing, or use of this information
is strictly prohibited and possibly a violation of federal or state law
and regulations. If you have received this information in error, please
delete it and notify Hamid Khaleghipour at 972-450-2868 immediately.
Thank you. 

************************************************************************
******************************************* 




More information about the MapServer-users mailing list