[mapserver-dev] Adding a time index stamp to returned image.

James Klassen klassen.js at gmail.com
Fri Aug 7 11:47:30 PDT 2015


Just for the record, this is what we ended up with.

    LAYER
        NAME 'timestamp'
        TYPE POINT
        STATUS ON

        TRANSFORM FALSE
        UNITS PIXELS

        VALIDATION
            'time_idx1' "^'[0-9]{4}-[0-9]{2}-[0-9]{2}
[0-9]{2}:[0-9]{2}:[0-9]{2}'$"
            'min' '^[0-9]+$'
        END

        CONNECTIONTYPE PostGIS
        CONNECTION "..."
        PROCESSING "CLOSE_CONNECTION=DEFER"

        DATA "bbox from (
            SELECT
                0 id,
                (%time_idx1%::timestamp + INTERVAL '%min% minute') as
tstamp,
                ST_MakePoint(5, 5) as bbox
        ) as subquery using unique id using srid=-1"

        LABELITEM tstamp
        CLASS
            LABEL
                TYPE TRUETYPE
                FONT calibri
                COLOR 254 254 254
                OUTLINECOLOR 0 0 0
                #OUTLINEWIDTH 1
                SIZE 12
                POSITION lr
            END
        END
    END

On Fri, Jul 24, 2015 at 4:08 PM, Lime, Steve D (MNIT) <
Steve.Lime at state.mn.us> wrote:

> Should be very doable – I like a challenge. You’re not saying much about
> how you were going about it. I created a quick test that drops the current
> time in the center of the map where the time is from the now() function in
> PostgreSQL. See:
>
>
>
>
> http://maps1.dnr.state.mn.us/cgi-bin/mapserv64?mode=map&map=/usr/local/mapserver/apps/test/timestamp/test.map
>
>
>
> If you refresh it you’ll get the timestamp associated. Presumably you
> could format this to your liking using the various utilities in PostgreSQL.
> To do this I had to create a dummy table in my database that contained a
> single dummy column, and I added 1 row to it. That allowed me to get useful
> SQL generated via MapServer. The timestamp layer looks like:
>
>
>
>  LAYER
>
>     NAME “timestamp”
>
>     TYPE POINT
>
>     STATUS DEFAULT
>
>
>
>     TRANSFORM FALSE
>
>     UNITS PERCENTAGES
>
>
>
>     CONNECTIONTYPE POSTGIS
>
>     CONNECTION “database of your choice”
>
>     DATA "the_geom FROM (SELECT ST_MakePoint(.50, .50) AS the_geom, NOW()
> AS tstamp, dummy_column FROM dummy_table) AS foo USING UNIQUE dummy_column
> USING SRID=-1"
>
>     LABELITEM tstamp
>
>     CLASS
>
>       LABEL
>
>         TYPE TRUETYPE
>
>         FONT “verdana-bold”
>
>         COLOR 0 0 0
>
>         SIZE 12
>
>         POSITION CC
>
>       END
>
>     END
>
>   END
>
>
>
> To change the location of the point you’d edit the coordinates inside the
> ST_MakePoint() function. Hope it helps.
>
>
>
> Steve
>
>
>
> *From:* mapserver-dev-bounces at lists.osgeo.org [mailto:
> mapserver-dev-bounces at lists.osgeo.org] *On Behalf Of *Basques, Bob
> (CI-StPaul)
> *Sent:* Tuesday, July 21, 2015 4:09 PM
> *To:* mapserver-dev at lists.osgeo.org
> *Subject:* [mapserver-dev] Adding a time index stamp to returned image.
>
>
>
> All,
>
>
>
> I’m using a POSTGRES connection an trying to place a timestamp text chunk
> into the corner of a image from Postgres.
>
>
>
> I’ve got a method for generating a set of images for a time-lapse movie (
> https://www.dropbox.com/s/7spkctc2mmtfmhc/out4.mp4?dl=0), but need to add
> a timestamp to each of the images upon output.  I’m not having much luck
> though outputting a seemingly simple item from Postgres.  Fro some reason
> TimeStamps are not completely understood by MapServer.  Maybe I need to
> cast the timestamp to a text string or something . . .
>
>
>
> Thoughts??
>
>
>
> Thanks
>
>
>
> bobb
>
>
>
>
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20150807/95c25e1d/attachment.html>


More information about the mapserver-dev mailing list