[Mapserver-users] bug postgis query alias

Merrett, Mike mike.merrett at city.whitehorse.yk.ca
Tue Jun 1 11:55:32 EDT 2004


Try putting calls to the following function around the error lines
and printing the results  i.e. echo mapserver_error();




function mapserver_error() {

	$ms_err_msg ="";
	$ms_error = ms_GetErrorObj();

	while($ms_error && $ms_error->code != MS_NOERR)
	{
	    $ms_err_msg  .= "MapServer Error in :" . $ms_error->routine . "
" .  $ms_error->message ."\n";
	    $ms_error = $ms_error->next();
	}
	return $ms_err_msg;
}



Hope this helps,
	Mike Merrett


-----Original Message-----
From: mapserver-users-admin at lists.gis.umn.edu
[mailto:mapserver-users-admin at lists.gis.umn.edu]On Behalf Of strk
Sent: June 1, 2004 5:06 AM
To: Vladimir Guzmán
Cc: mapserver-users at lists.gis.umn.edu
Subject: Re: [Mapserver-users] bug postgis query alias


On Tue, Jun 01, 2004 at 06:56:45AM -0500, Vladimir Guzmán wrote:
> Yes, the query runs fine in the pgsql monitor:
> gps=> select gid,'>' as sentido,tiempo,360-rumbo+90 as 
> rumbo,velocidad,gps_geom,oid from gps_vehi where tiempo>='2004-05-31 
> 05:00:00' and tiempo<='2004-06-02 04:59:59';
>  gid  | sentido |       tiempo        | rumbo | velocidad |            
> gps_geom             |   oid
>
-------+---------+---------------------+-------+-----------+----------------
-----------------+---------
> 46275 | >       | 2004-05-31 15:16:09 |   450 |         0 | 
> SRID=1;POINT(-74.06318 4.67302) | 7731018
> 46276 | >       | 2004-05-31 15:16:15 |   450 |         0 | 
> SRID=1;POINT(-74.06318 4.67302) | 7731019
> 46277 | >       | 2004-05-31 15:16:21 |   450 |         0 | 
> SRID=1;POINT(-74.06319 4.67301) | 7731020
> ...
> ...
> 
> The error is just:
> 
> *Warning*:  MapServer Error in msDrawMap(): Failed to draw layer named 
> 'puntosgps'.
> in */usr/local/apache/htdocs/gps/index.phtml* on line *33*

Ooh.. I see.. php involved!
There are lot's of auto handling of special chars with php...
Showing that line '33' would also be useful.

--strk;


> 
> 
> Vladimir Ilich Guzmán R.
> ------------------------
> http://maintask.com 
> 
> 
> 
> strk wrote:
> 
> >On Mon, May 31, 2004 at 03:29:45PM -0500, Vladimir Guzmán wrote:
> > 
> >
> >>Hello.
> >>I'm implementing a gps tracking system.
> >>I want to show the car's orientation like this:
> >>http://maintask.com/test.png
> >>The layer's data is something like this:
> >>-----------------------------
> >>gps_geom from (select gid,sentido,tiempo,360-rumbo+90 as 
> >>rumbo,velocidad,gps_geom,oid from gps_vehi where tiempo>='2004-05-29 
> >>05:00:00' and tiempo<='2004-05-30 04:59:59') as foo using unique gid 
> >>using srid=1
> >>-----------------------------
> >>The field 'sentido' contains '>'.
> >>
> >>The problem is that if I use something like this:
> >>-----------------------------
> >>gps_geom from (select gid,'>' as sentido,tiempo,360-rumbo+90 as 
> >>rumbo,velocidad,gps_geom,oid from gps_vehi where tiempo>='2004-05-29 
> >>05:00:00' and tiempo<='2004-05-30 04:59:59') as foo using unique gid 
> >>using srid=1
> >>-----------------------------
> >>The query doesn't work.
> >>
> >>So I had to create a column in potgres called 'sentido' and all the rows

> >>containing '>'.
> >>
> >>Is this a bug?
> >>   
> >>
> >
> >What's the error message ?
> >Can you run the query from the pgsql monitor ?
> >--strk;
> >
> > 
> >
> >>The rest of the layer:
> >>
> >>LAYER
> >>NAME "puntosgps"
> >>CONNECTIONTYPE postgis
> >>CONNECTION "user=gps password=gps dbname=gps host=localhost"
> >>DATA "gps_geom from (select gid,sentido,tiempo,360-rumbo+90 as 
> >>rumbo,velocidad,gps_geom,oid from gps_vehi where tiempo>='2004-05-29 
> >>05:00:00' and tiempo<='2004-05-30 04:59:59') as foo using unique gid 
> >>using srid=1"
> >>TYPE POINT
> >>PROJECTION
> >>"proj=latlong"
> >>"datum=WGS84"
> >>END
> >>LABELANGLEITEM 'rumbo'
> >>LABELITEM 'sentido'
> >>CLASS
> >>  NAME 'Parado'
> >>  EXPRESSION ([velocidad] = 0)
> >>  SIZE 14
> >>  SYMBOL 'circle'
> >>  COLOR 0 0 215
> >>  OUTLINECOLOR 204 204 204
> >>END
> >>CLASS
> >>  NAME '0-10'
> >>  EXPRESSION ([velocidad] > 0 AND[velocidad] <= 10)
> >>  SIZE 14
> >>  SYMBOL 'circle'
> >>  COLOR 255 255 204
> >>  OUTLINECOLOR 204 204 204
> >>  LABEL
> >>    TYPE TRUETYPE
> >>    FORCE TRUE
> >>    FONT arial
> >>    ANTIALIAS TRUE
> >>    COLOR 0 0 0
> >>    OUTLINECOLOR 255 255 255
> >>    SIZE 8
> >>  END
> >>END
> >>...
> >>...
> >>
> >>Thanks a lot.
> >>
> >>-- 
> >>Vladimir Ilich Guzmán R.
> >>------------------------
> >>http://maintask.com 
> >>
> >>
> >>_______________________________________________
> >>Mapserver-users mailing list
> >>Mapserver-users at lists.gis.umn.edu
> >>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >>   
> >>
> >_______________________________________________
> >Mapserver-users mailing list
> >Mapserver-users at lists.gis.umn.edu
> >http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
> >
> > 
> >
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list