<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Hi Andreas (and others), </DIV>
<DIV>Thank you for your assistance. </DIV>
<DIV>I have moved past my oracle issues now, but I'm having trouble with Mapserver. </DIV>
<DIV>The only error I get is </DIV>
<DIV> </DIV>
<DIV>"Error in getString(): Parsing error near (DD):(line 463)"</DIV>
<DIV> </DIV>
<DIV>I'll attach my code to help, but I'm not sure why I'm having this issue. </DIV>
<DIV> </DIV>
<DIV>Any advice is very welcome. </DIV>
<DIV>Thank you. </DIV>
<DIV>Jess</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>###PHP###</DIV>
<DIV><?php<BR>//Call like: <A href="http://tippy/relshptest/multiLayer3.php?shape_name=ASSET&shape_id=19117&shape_type=MS_LAYER_POLYGON&rel_name=SURVEY&rel_id=42&rel_type=MS_LAYER_LINE">shape_name=ASSET&shape_id=19117&shape_type=MS_LAYER_POLYGON&rel_name=SURVEY&rel_id=42&rel_type=MS_LAYER_LINE</A><BR>//<BR>$oracle_user='user';<BR>$oracle_pass='pass';<BR>$oracle_db='db;<BR>if(!extension_loaded('MapScript'))<BR>{<BR> dl('php_mapscript.dll');<BR>}</DIV>
<DIV> </DIV>
<DIV>$buffer=50;</DIV>
<DIV> </DIV>
<DIV>if ($_GET['shape_name'])<BR>{<BR> //original shape<BR> $shape_name = $_GET['shape_name'];<BR> $shape_id = $_GET['shape_id'];<BR> $shape_type = $_GET['shape_type'];</DIV>
<DIV> </DIV>
<DIV> //related shape<BR> $rel_name = $_GET['rel_name'];<BR> $rel_id = $_GET['rel_id'];<BR> $rel_type = $_GET['rel_type'];</DIV>
<DIV> </DIV>
<DIV> switch ($shape_name)<BR> {<BR> //take the shape name input via the url and use this information to set the appropriate table view<BR> //then to find the extent values using the select statement<BR> //then set the data, and related data according to the type<BR> case "ASSET":<BR> $rel_view = $shape_name;<BR> $query = "SELECT a.asset_id, <BR> SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 1), <BR> SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 2), <BR> SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 1), <BR> SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 2) <BR> FROM fod.asset a, fod.related_asset_shape b <BR> WHERE a.asset_id = b.asset_id <BR> AND b.shape_id = ".$rel_id;<BR> $data = "shape from (select asset_id, shape from fod.asset where asset_id = ".$shape_id.") using unique asset_id";<BR> $rel_data = "shape from (select asset_id, shape_id, shape from fod.related_asset_shape where asset_id = ".$rel_id.") using unique shape_id";<BR> break;<BR> case "SURVEY":<BR> $rel_view = $shape_name;<BR> $query = "SELECT a.survey_id, SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 1), SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 2), SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 1), SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 2) FROM fod.survey a, fod.related_survey_shape b WHERE a.survey_id = b.survey_id AND b.shape_id = ".$rel_id;<BR> $data = "shape from (select survey_id, shape from fod.survey where survey_id = ".$shape_id.") using unique asset_id";<BR> $rel_data = "shape from (select survey_id, shape, shape_id from fod.related_survey_shape where survey_id = ".$rel_id.") using unique shape_id";<BR> break;<BR> case "OPERATION":<BR> $rel_view = "opn";<BR> $query = "SELECT a.operation_id, SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 1), SDO_GEOM.SDO_MIN_MBR_ORDINATE(a.shape, 2), SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 1), SDO_GEOM.SDO_MAX_MBR_ORDINATE(a.shape, 2) FROM fod.operation a, fod.related_opn_shape b WHERE a.operation_id = b.operation_id AND b.shape_id = ".$rel_id;<BR> $data = "shape from (select operation_id, shape from fod.operation where operation_id = ".$shape_id.") using unique operation_id";<BR> $rel_data = "shape from (select operation_id, shape, shape_id from fod.related_opn_shape where operation_id = ".$rel_id.") using unique shape_id";<BR> break;<BR> default:<BR> }</DIV>
<DIV> </DIV>
<DIV> //echo $rel_view;</DIV>
<DIV> </DIV>
<DIV> $conn=OCILogon($oracle_user, $oracle_pass, $oracle_db);<BR> //check connection<BR> if(!$conn)<BR> {exit("connection failed:" . $conn);}<BR> else<BR> //{ echo "hooray - connected: ". $conn;}</DIV>
<DIV> </DIV>
<DIV> $asset_query = OCIParse($conn, $query);<BR> oci_execute($asset_query);<BR> $target_asset=oci_fetch_array($asset_query);<BR> </DIV>
<DIV> </DIV>
<DIV> //Create new map object and set up some parameters<BR> $map=ms_newMapObj('base2.map');<BR> //Set map extent to target asset MBR +/- buffer value<BR> $map->setExtent($target_asset[1]-$buffer, $target_asset[2]-$buffer, $target_asset[3]+$buffer, $target_asset[4]+$buffer);<BR> <BR> //Set up original shape layer<BR> $shape_layer=$map->getLayerByName("layer1");<BR> $shape_layer->set("status", MS_ON);<BR> $shape_layer->set("type", $shape_type); <BR> $shape_layer->set("connectiontype", MS_ORACLESPATIAL);<BR> $shape_layer->set("connection", $oracle_user."/".$oracle_pass."@".$oracle_db);<BR> $shape_layer->set("data", $data);<BR> //echo $data;<BR> $shape_layer->setProcessing("CLOSE_CONNECTION=DEFER");<BR> $shape_layer->setProjection('+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');<BR> //$shape_layer->set("maxscaledenom", 250001);<BR> $shape_class=ms_newClassObj($shape_layer);<BR> $shape_style=ms_newStyleObj($shape_class);<BR> $shape_style->color->setRGB(199, 140, 218);<BR> $shape_style2=ms_newStyleObj($shape_class);<BR> $shape_style2->outlinecolor->setRGB(147, 37, 178);<BR> $shape_style2->set("width", 2);</DIV>
<DIV> </DIV>
<DIV> //Set up related shape layer<BR> /*$rel_layer=$map->getLayerByName("layer2");<BR> $rel_layer->set("status", MS_ON);<BR> $rel_layer->set('type', $rel_type);<BR> $rel_layer->set("connectiontype", MS_ORACLESPATIAL);<BR> $rel_layer->set("connection", $oracle_user."/".$oracle_pass."@".$oracle_db);<BR> $rel_layer->set("data", $rel_data);<BR> //echo $rel_data;<BR> $rel_layer->setProcessing("CLOSE_CONNECTION=DEFER");<BR> $rel_layer->setProjection('+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');<BR> $rel_class=ms_newClassObj($rel_layer);<BR> $rel_style=ms_newStyleObj($rel_class);<BR> $rel_style->color->setRGB(199, 140, 218);<BR> $rel_style->set("width", 3);<BR> //echo 'layer2 done';<BR>*/</DIV>
<DIV> </DIV>
<DIV>//draw the map<BR>$map_image=$map->draw();<BR>$error=ms_GetErrorObj();<BR>while($error && $error->code != MS_NOERR)<BR>{<BR> printf("Error in %s: %s<br>\n", $error->routine, $error->message);<BR> $error = $error->next();<BR>}<BR>$map_image->saveWebImage(); //send image to web browser</DIV>
<DIV>}<BR>?></DIV>
<DIV> </DIV>
<DIV>###MAPFILE###</DIV>
<DIV>MAP<BR> NAME base2<BR> STATUS ON<BR> SIZE 800 600<BR> EXTENT 227154 5165779 627108 5614539<BR> UNITS METERS<BR> IMAGECOLOR 234 255 255<BR> SYMBOLSET "base.sym"<BR> FONTSET "base.list"<BR> PROJECTION<BR> "proj=utm"<BR> "zone=55"<BR> "south"<BR> "ellps=GRS80"<BR> "towgs84=0,0,0,0,0,0,0"<BR> "units=m"<BR> "no_defs"<BR> END<BR> SHAPEPATH "E:\tilelib\"<BR> QUERYMAP<BR> STATUS ON<BR> STYLE SELECTED<BR> END<BR> <BR> OUTPUTFORMAT<BR> NAME 'AGG'<BR> DRIVER AGG/PNG<BR> IMAGEMODE RGB<BR> END<BR> <BR> WEB<BR> IMAGEPATH "C:\htdocs\tmp\"<BR> IMAGEURL "/tmp/"<BR> END<BR> <BR> LEGEND<BR> STATUS OFF<BR> END<BR> <BR> SCALEBAR<BR> STATUS EMBED<BR> POSITION lr<BR> STYLE 1<BR> UNITS meters<BR> TRANSPARENT ON<BR> LABEL<BR> COLOR 0 0 0<BR> OUTLINECOLOR 255 255 255<BR> FONT "verdana"<BR> TYPE TRUETYPE<BR> POSITION AUTO<BR> PARTIALS FALSE<BR> SIZE 8<BR> BUFFER 1<BR> END<BR> END</DIV>
<DIV> </DIV>
<DIV>[.....]</DIV>
<DIV>LAYER<BR> NAME layer1<BR> TYPE POLYGON<BR> STATUS OFF<BR> END<BR> <BR> LAYER<BR> NAME layer2<BR> TYPE LINE<BR> STATUS OFF<BR> END</DIV>
<DIV>[.....]</DIV>
<DIV> </DIV>
<DIV>LAYER<BR> NAME "grid"<BR> TYPE LINE<BR> STATUS ON<BR> CLASS<BR> STYLE<BR> OUTLINECOLOR 0 0 0<BR> WIDTH 1<BR> END<BR> LABEL<BR> COLOR 255 0 0<BR> FONT "verdana"<BR> TYPE truetype<BR> SIZE 8<BR> POSITION CC<BR> PARTIALS FALSE<BR> BUFFER 0<BR> OUTLINECOLOR 255 255 255<BR> SHADOWCOLOR 60 60 60<BR> SHADOWSIZE 2 2<BR> END<BR> END<BR> PROJECTION<BR> "proj=utm"<BR> "zone=55"<BR> "south"<BR> "ellps=GRS80"<BR> "towgs84=0,0,0,0,0,0,0"<BR> "units=m"<BR> "no_defs"<BR> END<BR> GRID<BR> LABELFORMAT DD<BR> MAXARCS 4<BR> MAXSUBDIVIDE 8<BR> END<BR> END</DIV>
<DIV> </DIV>
<DIV>>>> "Eichner, Andreas - SID-NLKM" <Andreas.Eichner@sid.sachsen.de> 6/07/2012 5:56 PM >>><BR><BR>Hello Jessica,<BR><BR>I've tested your code successfully on PHP MapScript v5.2.0.<BR><BR>> I have issues with <BR>> oraclespatial, and I just keep getting errors that the layer <BR>> can't be drawn.<BR><BR>What errors do you get? Something like "[...] Error: ORA-12154:<BR>TNS:could not resolve the connect identifier specified"? Then you<BR>might need to set some environment variables first. For example,<BR>I set ORACLE_HOME, TNS_ADMIN, LC_CTYPE and NLS_LANG.<BR><BR>> The lack of error reporting from <BR>> php hasn't been helping matters either ;) <BR><BR>You can execute your script on the command line via "php <scriptname>".<BR>This will display errors as long as error_reporting(E_ALL) or similar<BR>is set:<BR> $ php test.php <BR><BR> Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named<BR>'ASSET'.<BR> in /tmp/foo/test.php on line 53<BR><BR> Warning: [MapServer Error]: msOracleSpatialLayerOpen(): Cannot create<BR>OCI Handlers. Connection failure. Check the connection string. Error:<BR>ORA-12154: TNS:could not resolve the connect identifier specified<BR> .<BR> in /tmp/foo/test.php on line 53<BR> Error in msDrawMap(): Failed to draw layer named 'ASSET'.<br><BR><BR>HTH<BR></DIV><BR>
<p>
<font face="Arial" size="1">---------------------------------------------------------------------------------------------------------------------------------------------
</font><br>
</p>
<p>
<font face="Arial" size="1">This transmission is intended solely for the
person or organisation to whom it is addressed. </font>
</p>
<p>
<font face="Arial" size="1">It is confidential and may contain legally
privileged information. </font>
</p>
<p>
<font face="Arial" size="1">If you have received this transmission in
error, you may not use, copy or distribute it. </font>
</p>
<p>
<font face="Arial" size="1">Please advise us by return e-mail or by
phoning 61 3 6235 8333 and immediately delete the transmission in its
entirety. </font>
</p>
<p>
<font face="Arial" size="1">We will meet your reasonable expenses of
notifying us. </font>
</p>
<p>
<font face="Arial" size="1">Despite our use of anti-virus software,
Forestry Tasmania cannot guarantee that this transmission is virus-free. </font>
</p>
<p>
<font face="Arial" size="1">--------------------------------------------------------------------------------------------------------------------------------------------
</font>
</p>
</BODY></HTML>