[Mapserver-users] Mapscript problem with MS401
Valerio Noti
noti at ciaoweb.it
Fri Nov 14 06:46:22 PST 2003
This is a multi-part message in MIME format.
------=_NextPart_000_002A_01C3AAC6.74184520
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I solved the problem with the following code:
$map =3D ms_newMapObj("bound.map");=20
$image=3D$map->draw();
$path =3D "C:\Inetpub\wwwroot\gall\\\\".$HTTP_GET_VARS["layer"];
$shapefile =3D ms_newShapefileObj($path,-1);
It seems that ms_newShapefileObj() doesn't work with relative paths.
Thanks
Valerio Noti
----- Original Message -----=20
From: Valerio Noti=20
To: Daniel Morissette=20
Cc: mapserver-users at lists.gis.umn.edu=20
Sent: Wednesday, November 12, 2003 11:46 AM
Subject: Re: [Mapserver-users] Mapscript problem with MS401
Hi Daniel,
Nothing to do:
CAT_VETT.shp, mapfile.map and bound.php are in the same directory.
A copy of CAT_VETT.shp is also in "shape" subfolder.
This is the mapfile:
*******************
...
SHAPEPATH "shape"
....
LAYER
NAME CAT_VETT
TYPE POLYGON
STATUS ON
DATA CAT_VETT
CLASS
COLOR 110 50 100
OUTLINECOLOR 200 200 200
END
END
......
*******************
I tried also:
$path =3D "http://192.168.1.51/gall/CAT_VETT";
$shapefile =3D ms_newShapefileObj($path,-1);
but the error is always the same:
****************************************
Warning: [MapServer Error]: msSHPOpenFile(): (CAT_VETT) in =
c:\inetpub\wwwroot\gall\bound.php on line 19
Fatal error: Failed to open shapefile CAT_VETT in =
c:\inetpub\wwwroot\gall\bound.php on line 19
****************************************
Thank you very much
Valerio Noti
----- Original Message -----=20
From: "Daniel Morissette" <morissette at dmsolutions.ca>
To: "Valerio Noti" <noti at ciaoweb.it>
Cc: <mapserver-users at lists.gis.umn.edu>
Sent: Tuesday, November 11, 2003 8:00 PM
Subject: Re: [Mapserver-users] Mapscript problem with MS401
> One difference between V3.6 and 4.0 is the way relative paths are=20
> handled. Is the CAT_VETT.shp in the same directory as the mapfile?=20
> Perhaps try using an absolute path in the call to =
ms_newShapefileObj()=20
> and see if that makes a difference.
>=20
> Daniel
>=20
> Valerio Noti wrote:
> > Hello,
> > =20
> > I've upgraded mapscript version from 366 to 401 downloaded from =
DMsolutions.
> > My old application seems to work well without applying changes to=20
> > mapfile or code.
> > However I got an error when I try to get the feature extent of a=20
> > selected object.
> > =20
> > Code of bound.php:
> > =20
> > ....
> > $map =3D ms_newMapObj("mapfile.map");
> > $image=3D$map->draw();
> > $shapefile =3D ms_newShapefileObj($HTTP_GET_VARS["layer"],-1);
> > $shape =3D $shapefile->getShape($HTTP_GET_VARS["ShapeIndex"]);
> > =20
> > //feature extension
> > $ShapeIndex =3D $HTTP_GET_VARS["ShapeIndex"];
> > $shapeExt =3D $shapefile->getExtent($ShapeIndex);
> > $minx =3D $shapeExt->minx;
> > $miny =3D $shapeExt->miny;
> > $maxx =3D $shapeExt->maxx;
> > $maxy =3D $shapeExt->maxy;
> > ....
> > =20
> > I passed layer and shapeindex by a form and retrieved them with=20
> > HTTP_GET_VARS.
> > I located shapefile in "shape" folder (as saved in mapfile.map) =
but I=20
> > also tried
> > copying shapefile in the same directory of bound.php.
> > =20
> > The error is:
> > *****************************
> > Warning: [MapServer Error]: msSHPOpenFile(): (CAT_VETT) in=20
> > c:\inetpub\wwwroot\gall\bound.php on line 16
> > =20
> > Fatal error: Failed to open shapefile CAT_VETT in=20
> > c:\inetpub\wwwroot\gall\bound.php on line 16
> > *****************************
> > CAT_VETT is the right name of shapefile, line 16 is:
> > =20
> > $shapefile =3D ms_newShapefileObj($HTTP_GET_VARS["layer"],-1);
> > =20
> > All this works fine changing reference to PHP_MAPSCRIPT_36.dll =
instead=20
> > of PHP_MAPSCRIPT_4.0.1.dll.
> > =20
> > Any help appreciated
> > Thanks
> > =20
> > Valerio Noti
>=20
>=20
>
------=_NextPart_000_002A_01C3AAC6.74184520
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV>I solved the problem with the following code:<BR><BR>$map =3D=20
ms_newMapObj("bound.map"); </DIV>
<DIV>$image=3D$map->draw();<BR>$path =3D=20
"C:\Inetpub\wwwroot\gall\\\\".$HTTP_GET_VARS["layer"];<BR>$shapefile =3D =
ms_newShapefileObj($path,-1);<BR><BR>It seems that ms_newShapefileObj() =
doesn't=20
work with relative paths.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV> </DIV>
<DIV>Valerio Noti</DIV></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Dnoti at ciaoweb.it href=3D"mailto:noti at ciaoweb.it">Valerio =
Noti</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dmorissette at dmsolutions.ca=20
href=3D"mailto:morissette at dmsolutions.ca">Daniel Morissette</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20
title=3Dmapserver-users at lists.gis.umn.edu=20
=
href=3D"mailto:mapserver-users at lists.gis.umn.edu">mapserver-users at lists.g=
is.umn.edu</A>=20
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, November 12, =
2003 11:46=20
AM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Mapserver-users] =
Mapscript=20
problem with MS401</DIV>
<DIV><BR></DIV>
<DIV><FONT face=3DArial size=3D2>Hi Daniel,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Nothing to do:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>CAT_VETT.shp, mapfile.map and =
bound.php are=20
in the same directory.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>A copy of CAT_VETT.shp is also in =
"shape"=20
subfolder.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This is the mapfile:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>*******************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...<BR>SHAPEPATH =
"shape"<BR>....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>NAME CAT_VETT<BR>TYPE =
POLYGON<BR>STATUS=20
ON<BR>DATA CAT_VETT<BR> CLASS<BR> COLOR 110 50=20
100<BR> OUTLINECOLOR 200 200 =
200<BR> END<BR>END</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>*******************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I tried also:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$path =3D "</FONT><A=20
href=3D"http://192.168.1.51/gall/CAT_VETT"><FONT face=3DArial=20
size=3D2>http://192.168.1.51/gall/CAT_VETT</FONT></A><FONT =
face=3DArial=20
size=3D2>";<BR>$shapefile =3D =
ms_newShapefileObj($path,-1);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>but the error is always the =
same:</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>****************************************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Warning: [MapServer Error]: =
msSHPOpenFile():=20
(CAT_VETT) in c:\inetpub\wwwroot\gall\bound.php on line 19<BR>Fatal =
error:=20
Failed to open shapefile CAT_VETT in c:\inetpub\wwwroot\gall\bound.php =
on line=20
19</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>****************************************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you very much</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Valerio Noti</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>----- Original Message ----- </FONT>
<DIV><FONT face=3DArial size=3D2>From: "Daniel Morissette" =
<</FONT><A=20
href=3D"mailto:morissette at dmsolutions.ca"><FONT face=3DArial=20
size=3D2>morissette at dmsolutions.ca</FONT></A><FONT face=3DArial=20
size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>To: "Valerio Noti" <</FONT><A=20
href=3D"mailto:noti at ciaoweb.it"><FONT face=3DArial=20
size=3D2>noti at ciaoweb.it</FONT></A><FONT face=3DArial =
size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Cc: <</FONT><A=20
href=3D"mailto:mapserver-users at lists.gis.umn.edu"><FONT face=3DArial=20
size=3D2>mapserver-users at lists.gis.umn.edu</FONT></A><FONT =
face=3DArial=20
size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sent: Tuesday, November 11, 2003 8:00 =
PM</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Subject: Re: [Mapserver-users] =
Mapscript problem=20
with MS401</FONT></DIV></DIV>
<DIV><FONT face=3DArial><BR><FONT size=3D2></FONT></FONT></DIV><FONT =
face=3DArial=20
size=3D2>> One difference between V3.6 and 4.0 is the way relative =
paths are=20
<BR>> handled. Is the CAT_VETT.shp in the same directory as =
the=20
mapfile? <BR>> Perhaps try using an absolute path in the call to=20
ms_newShapefileObj() <BR>> and see if that makes a =
difference.<BR>>=20
<BR>> Daniel<BR>> <BR>> Valerio Noti wrote:<BR>> >=20
Hello,<BR>> > <BR>> > I've upgraded mapscript =
version from=20
366 to 401 downloaded from DMsolutions.<BR>> > My old =
application seems=20
to work well without applying changes to <BR>> > mapfile or=20
code.<BR>> > However I got an error when I try to get the =
feature extent=20
of a <BR>> > selected object.<BR>> > <BR>> > =
Code of=20
bound.php:<BR>> > <BR>> > ....<BR>> > $map =3D =
ms_newMapObj("mapfile.map");<BR>> > =
$image=3D$map->draw();<BR>> >=20
$shapefile =3D ms_newShapefileObj($HTTP_GET_VARS["layer"],-1);<BR>> =
>=20
$shape =3D =
$shapefile->getShape($HTTP_GET_VARS["ShapeIndex"]);<BR>>=20
> <BR>> > //feature extension<BR>> > $ShapeIndex =
=3D=20
$HTTP_GET_VARS["ShapeIndex"];<BR>> > $shapeExt =3D=20
$shapefile->getExtent($ShapeIndex);<BR>> > $minx =3D=20
$shapeExt->minx;<BR>> > $miny =3D $shapeExt->miny;<BR>> =
>=20
$maxx =3D $shapeExt->maxx;<BR>> > $maxy =3D =
$shapeExt->maxy;<BR>>=20
> ....<BR>> > <BR>> > I passed layer and =
shapeindex by a=20
form and retrieved them with <BR>> > HTTP_GET_VARS.<BR>> > =
I=20
located shapefile in "shape" folder (as saved in mapfile.map) but I =
<BR>>=20
> also tried<BR>> > copying shapefile in the same directory =
of=20
bound.php.<BR>> > <BR>> > The error is:<BR>> > =
*****************************<BR>> > Warning: [MapServer Error]: =
msSHPOpenFile(): (CAT_VETT) in <BR>> > =
c:\inetpub\wwwroot\gall\bound.php=20
on line 16<BR>> > <BR>> > Fatal error: Failed to =
open=20
shapefile CAT_VETT in <BR>> > c:\inetpub\wwwroot\gall\bound.php =
on line=20
16<BR>> > *****************************<BR>> > CAT_VETT is =
the=20
right name of shapefile, line 16 is:<BR>> > <BR>> >=20
$shapefile =3D ms_newShapefileObj($HTTP_GET_VARS["layer"],-1);<BR>> =
> <BR>> > All this works fine changing reference to=20
PHP_MAPSCRIPT_36.dll instead <BR>> > of =
PHP_MAPSCRIPT_4.0.1.dll.<BR>>=20
> <BR>> > Any help appreciated<BR>> > =
Thanks<BR>>=20
> <BR>> > Valerio Noti<BR>> <BR>> <BR>>=20
</FONT></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_002A_01C3AAC6.74184520--
More information about the MapServer-users
mailing list