[mapserver-users] RESULT from DB SQL call on map output as a label

Stephen Woodbridge woodbri at swoodbridge.com
Thu Mar 22 13:09:36 EDT 2012


On 3/22/2012 10:51 AM, Bob Basques wrote:
> All,
>
>
> Was wondering about putting a STAT line on a Mapserver image that is
> coming from POSTGIS. What's involved in sending something like "SELECT
> COUNT(*) from <table>" from inside of the same mapfile, and adding the
> RESULT as a TEXT element to the map. is this a legend thing, a map thing
> or something in between??
>
>
> Is it as simple as creating a point on the fly and using a SQL call
> (from a separate LAYER) to label with? (hmm, I think I just talked
> through the process . . .)

Do it like this:

select count(*), 'POINT(1 3)'::geometry as the_geom from tfeed;

where the POINT() value is in pixels on the image and then you TRANSFORM 
FALSE when you place the point and label.

-SteveW


More information about the mapserver-users mailing list