Hi everyone, 
I successfully queried the same view twice in two separate layers in order to 
show two related shapes, but now I have decided that there are too many options 
(and thus too many mapfiles to create and combinations for the developers on 
the other end to handle) so I am trying to write a php script to generate the 
two new layers according to the parameters passed into the script via url. 
 
I'll paste in my code currently.  I have issues with oraclespatial, and I just 
keep getting errors that the layer can't be drawn.  I'm having a hard time 
finding examples of this use, so I'm just hoping someone might be able to point 
out where I'm going wrong.  The lack of error reporting from php hasn't been 
helping matters either ;) 
 
Please forgive me if I have made a (or several) silly mistake.  I'm new to php, 
oracle, and mapserver. 
 
Cheers, 
Jess
 
URL:  http://local/multiLayer2.php?map=base2.map&map_name="Asset Survey related 
map"orig_type=POLYGON&orig_name=ASSET&orig_id=19117&rel_type=LINE&rel_name=SURVEY&rel_id=42
 ( 'http://local/multiLayer2.php?map=base2.map&map_name="Asset Survey related 
map"orig_type=POLYGON&orig_name=ASSET&orig_id=19117&rel_type=LINE&rel_name=SURVEY&rel_id=42'
 )
This is what I want the url to look like, but currently, I've hardcoded the 
values into the script.
 
MAPFILE:
MAP
 NAME base
 STATUS ON
 SIZE 800 600
 EXTENT 227154 5165779 627108 5614539
 UNITS METERS
 IMAGECOLOR 234 255 255
 SYMBOLSET "base.sym"
 FONTSET "base.list"
 PROJECTION
  "proj=utm"
[..................]
##Changeable layers 
 LAYER
  NAME layer1
  TYPE POINT
  STATUS OFF
 END
 
 LAYER
  NAME layer2
  TYPE POINT
  STATUS OFF
 END
## end ##
[..............]
END
 
PHP:
<?php
if(!extension_loaded('Mapscript'))
 dl('php_mapscript.dll');
 
//open the mapfile and change the mapname
$map = ms_newMapObj($map_file);
$map -> set("name", $_GET['map_name']);
 
//set up layer 1
//set the parameters
 //temp setup
$orig_name = "ASSET";
$orig_id = "19117";
$orig_type = "MS_LAYER_POLYGON";
 
$rel_name = "SURVEY";
$rel_id = "42";
$rel_type = "MS_LAYER_LINE";
 
 //temporary data created 
$orig_data = "asset_shape FROM  FOD.ASSET_RELATED_SHP_MAP USING UNIQUE 
ASSET_ID";
$rel_data = "rel_shape from fod.asset_related_shp_map using unique shape_id";
 
//create the original shape layer
$orig_layer = $map->getLayerByName("layer1");
$orig_layer->set("name", $orig_name);
$orig_layer->set("status", MS_ON);
$orig_layer->set("type", $orig_type);
$orig_layer->set("connectiontype", MS_ORACLESPATIAL);
$orig_layer->set("connection", "mapserver/mapserver@gistest");
$orig_layer->set("data", $orig_data); 
$orig_layer->setProcessing("CLOSE_CONNECTION=DEFER");
$orig_layer->setProjection('+proj=utm +zone=55 +south +ellps=GRS80 
+towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
 //create class within the layer 
  //set the symbology and style

//create the related layer
$rel_layer = $map->getLayerByName("layer2");
$rel_layer->set("name", $rel_name);
$rel_layer->set("status", MS_ON);
$rel_layer->set("type", $rel_type);
$rel_layer->set("connectiontype", MS_ORACLESPATIAL);
$rel_layer->set("connection", "mapserver/mapserver@gistest");
$rel_layer->set("data", $rel_data); 
$rel_layer->setProcessing("CLOSE_CONNECTION=DEFER");
$rel_layer->setProjection('+proj=utm +zone=55 +south +ellps=GRS80 
+towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
 //create class within the layer
  //set the symbology and stylee
 

//draw the map
ms_ResetErrorList();
$map_image=$map->drawQuery();
$error=ms_GetErrorObj();
while($error && $error->code != MS_NOERR)
{
 printf("Error in %s: %s<br>\n", $error->routine, $error->message);
 $error = $error->next();
}
echo $map_image->saveWebImage();
 
?>

---------------------------------------------------------------------------------------------------------------------------------------------
This transmission is intended solely for the person or organisation to whom it 
is addressed.
It is confidential and may contain legally privileged information.
If you have received this transmission in error, you may not use, copy or 
distribute it.
Please advise us by return e-mail or by phoning 61 3 6235 8333 and immediately 
delete the transmission in its entirety.
We will meet your reasonable expenses of notifying us.
Despite our use of anti-virus software, Forestry Tasmania cannot guarantee that 
this transmission is virus-free.
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to