[postgis-users] java libraries

TECHER Jean David davidtecher at yahoo.fr
Tue Dec 30 03:07:19 PST 2003


         > Hi:

         > I have a question, What do you recommend? Geotools or Gistoolkit,
and do you have any example on How I have to use this libraries in order >
display the data in a web page or something similar.

        Why don't you use MapServer? It let you display your data in a
webpage. Mapserver (version >= 3.6) can deal with PostGIS. You can go to

        - http://mapserver.gis.umn.edu to download it

        - http://postgis.refractions.net/docs/x556.html  from PostGIS
documentation in order to use it with PostGIS.

        Suppose that your table is 'geomtable', your database is 'myGIS' and
your user name is talledo

        I ) you had to specifiy the extent of the image you want to display.
So  do

        select
xmin(extent(the_geom)),ymin(extent(the_geom)),xmax(extent(the_geom)),
ymax(extent(the_geom)) from geomtable

        will give you 4 numbers: Xmin, Ymin, Xmax, Ymax. Suppose now that
you want an image with width=700. The height will be

        height = 700 * abs(Ymax-Ymin)/abs(Xmax-Xmin)

        II) In a file (for example)  C:\mymap.map, put

        MAP
          IMAGETYPE PNG
          EXTENT Xmin Ymin Xmax Ymax
          SIZE 700 height
          IMAGECOLOR 255 255 255
        LAYER
          NAME " mylayer "
          CONNECTIONTYPE postgis
          CONNECTION "user=talledo dbname=myGIS host=localhost"
          DATA "the_geom from geomtable"
          STATUS default
          TYPE POLYGON
          CLASS
            COLOR 45 251 103
            OUTLINECOLOR 255 0 0
            LABEL
              FORCE TRUE
              POSITION CC
              SIZE large
              OUTLINECOLOR 255 255 0
              BACKGROUNDCOLOR 255 255 204
              BACKGROUNDSHADOWCOLOR 221 221 221
              BACKGROUNDSHADOWSIZE 1 1
              MINDISTANCE 2
              COLOR 0 0 0
            END #End of LABEL
          END #End of Class
          END #Layer
        END

        III) To display your data , type the URL
http://yourserver/cgi-bin/mapserv.exe?map=C:\mymap&mode=map

         > This is because there are a lot of examples on how to display
data from a shape but I haven't found any example about How I can display
the data   > using Postgis as my DB

         > Thanks in Advance.

         Gistoolkit (http://gistoolkit.sourceforge.net)   can display data
from PostGIS.   I''ve already tried Gistoolkit but I had to use others java
libraries in order to use it:batik....



        TECHER Jean David
        Tél: 06-85-37-36-75
        e-mail: davidtecher at yahoo.fr












----------------------------------------------------------------------------
--
  MSN Amor Busca tu ½ naranja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20031230/95f76c68/attachment.html>


More information about the postgis-users mailing list