[Mapserver-users] bug postgis query alias

Vladimir Guzmán bigfoot at main-task.com
Tue Jun 1 17:07:47 PDT 2004


I've resolved this with a cast:

gps_geom from (select gid,'>'::text 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

Thanks to Mike Merret for his help with the debugging function.

Thanks a lot,

-- 
Vladimir Ilich Guzmán R.
------------------------
http://maintask.com

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?
>
> 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.
>




More information about the MapServer-users mailing list