[postgis-users] another mapserver/postgis question

ttsai at pobox.com ttsai at pobox.com
Sun Sep 12 15:16:10 PDT 2004


Hello.  I've researched all that I could on mapserver/postgis but
am still unable to make a simple example work.  After quite a bit
of debugging, I have narrowed down the statements at the end of this
message.  Is this the correct behavior using cursors?  Without cursors,
I am getting some binary data back.  Without cursors, it appears to
be blank.  I do not know if this is simply psql trying not to display
binary data, or if this is what's causing my problem.

PostgreSQL 7.4.3
PostGIS 0.8.2
Mapserver 4.0.2
Proj 4.4.5

Basically, I am getting a blank page (just a png file) with mapserver.

Thanks,

Tim

-- sql statements --
select asbinary(force_collection(force_2d(centerline)),'NDR'), OID::text
from ro
ad_segments where centerline && setSRID('BOX3D(-100 -100, 200
200)'::BOX3D, find
_srid('', 'road_segments', 'centerline'));
begin transaction;
    declare mycursor binary cursor for select
asbinary(force_collection(force_2d
(centerline)),'NDR'), OID::text from road_segments where centerline &&
setSRID('
BOX3D(-100 -100, 200 200)'::BOX3D, find_srid('', 'road_segments',
'centerline'))
;
    fetch all in mycursor;
end transaction;

-- statement results --
               asbinary
                                      |  oid
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------+-------
 0107000000010000000102000000050000000000000000000000000000000000324000000000000
024400000000000003540000000000000304000000000000037400000000000003C4000000000000
03A4000000000000046400000000000003F40 | 17671
 01070000000100000001020000000300000000000000000046400000000000003F4000000000000
04C40000000000000414000000000008051400000000000004340
                                      | 17672
 0107000000010000000102000000020000000000000000805140000000000000434000000000000
052400000000000004840
                                      | 17673
 0107000000010000000102000000020000000000000000805140000000000000434000000000000
055400000000000004540
                                      | 17674
 0107000000010000000102000000020000000000000000003C400000000000003A4000000000000
03C400000000000000000
                                      | 17675
(5 rows)

BEGIN
DECLARE CURSOR
 asbinary |  oid
----------+-------
        | 17671
        | 17672
        | 17673
        | 17674
        | 17675
(5 rows)

-- mapfile --
MAP
    NAME DEMO
    SIZE 400 400
    IMAGETYPE PNG
    IMAGECOLOR 240 240 240
    EXTENT 0 0 100 100
    WEB
        LOG /tmp/mapserver.log
    END
    DEBUG ON
    LAYER
        CONNECTIONTYPE postgis
        NAME "DEMO"
        # Connect to a remote spatial database
        CONNECTION "user=user dbname=db host=127.0.0.1"
        DATA "centerline from road_segments"
        TYPE POLYGON
        STATUS DEFAULT
    END
END




More information about the postgis-users mailing list