[ka-Map-users] queries with postgis

Agustina Buccella agustina_buccella at yahoo.com.ar
Mon Feb 26 11:06:26 EST 2007


Thanks!! now I could change colors!!
 
 But now I have another question... I want to use the query tool (i) in ka-map... I want the user can click the map and the system can make a query to my database!  I read several docs but I cannot understand how to configure it....
 
 my .map file is the following:
 
 -------------------------------------------------------------------------------------
 MAP
     EXTENT -73.577781 -55.061313 -53.591835 -21.781276
     SIZE 400 400
  #   IMAGECOLOR 255 22 22
     UNITS METERS
     IMAGETYPE PNG
   #  TRANSPARENT ON
 
 
     SYMBOLSET ../etc/symbols.sym
     UNITS METERS
     IMAGECOLOR 255 255 255
     FONTSET ../etc/fonts.txt
 
 
 
 
 
 LEGEND
   TRANSPARENT TRUE
 END
 
 SCALEBAR
    TRANSPARENT TRUE
 END
 
 WEB
 
    METADATA
        max_extents "-73.577781 -55.061313 -53.591835 -21.781276"
    END
  #  MINSCALE 20.00000
  #  MAXSCALE 500.00000
    IMAGEPATH "/usr/local/apache2/htdocs/tmp"
    IMAGEURL "/tmp/"
 END
 
 
 #
 # Start of reference map
 #
 REFERENCE
    IMAGE ../images/keymap.png
    EXTENT -73.577781 -55.061313 -53.591835 -21.781276
    STATUS ON
   COLOR -1 -1 -1
   OUTLINECOLOR  95 158 160
   SIZE 120 90      
 END
 
 #
 # Start of legend
 #
 LEGEND
   KEYSIZE 18 12
   LABEL
     TYPE BITMAP
     SIZE MEDIUM
     COLOR 0 0 89
   END
   STATUS ON
 END
 
 #
 # Start of scalebar
 #
 SCALEBAR
   IMAGECOLOR 255 255 255
   LABEL
     COLOR 0 0 0 
     SIZE SMALL
   END
   SIZE 150 5
   COLOR 255 255 255
   BACKGROUNDCOLOR 0 0 0
   OUTLINECOLOR 0 0 0
   UNITS kilometers
   INTERVALS 5
   STATUS ON
 END
 
 
 QUERYMAP
   STYLE HILITE
   COLOR 255 0 0
 END
 
 
 #
 # Start of layer definitions
 #
 
 LAYER
   NAME "contorno"
   GROUP "CONTORNO"
   CONNECTIONTYPE postgis
   CONNECTION "host=10.0.3.218 port=5432 dbname=argentina password=*** user=****"
   DATA "the_geom FROM argentina1"
   TYPE POLYGON
   STATUS ON
 #  DEBUG ON
   METADATA
     "DESCRIPTION" "Contorno"
   END
 
   METADATA
     #this must be enabled to use ka-Map! query - map_query.php
     "queryable" "true"
   END
   TOLERANCE 3
 
   CLASS
     NAME "Contorno"
     TEMPLATE "query/contorno_template.html"
   STYLE
       COLOR  205 92 92
       OUTLINECOLOR  64 224 208
       SYMBOL 0
   END
 END
 END
 
 LAYER
   NAME "limites provincia"
   GROUP "PROVINCIAS"
   CONNECTIONTYPE postgis
   CONNECTION "host=10.0.3.218 port=5432 dbname=argentina password=**** user=****"
   DATA "the_geom FROM argentina2"
   TYPE POLYGON
   STATUS ON
 #  DEBUG ON
    METADATA
     "DESCRIPTION" "Provincias"
   END
   CLASS
    NAME "Provincias"
   STYLE
       COLOR 184 134 11
       OUTLINECOLOR 120 120 120
       SYMBOL 0
   END
 END
 END
 
 LAYER
   NAME "limites ciudad"
   GROUP "DISTRITOS"
   CONNECTIONTYPE postgis
   CONNECTION "host=10.0.3.218 port=5432 dbname=argentina password=**** user=****"
   DATA "the_geom FROM argentina3"
   TYPE POLYGON
   STATUS ON
 #  DEBUG ON
   CLASS
     NAME "Ciudades"
   STYLE
       COLOR 147 112 219
       OUTLINECOLOR 199 199 199
       SYMBOL 0
   END
 END
 END
  END 
 --------------------------------------------------------------------------
 
 I added to the first layer (contorno) the "queryable true" sentence and the template in which I have the column I want to query... (in the table "argentina1")... here is my contorno_template.html file
 
 ---------------------------------------------------------------------------------
 <html> 
 <head> 
 <title>MapServer Probando query</title> 
 </head>
 <body>
 <tr>
           <td>[lrn]</td>
           <td>[adm0]</td>
 </tr>
 </body>
 </html>
 -----------------------------------------------------------------------------------
 
 adm0 contains the information of the area clicked... (it is a colum in the argentina0 table)
 but now when I click in the map, only the information in the .map file is returned, in this case, the name of the layer (contorno).... may be I have to do more changes....
 
 Thanks!!
 Agustina
 
 
 		
---------------------------------
 Preguntá. Respondé. Descubrí.
 Todo lo que querías saber, y lo que ni imaginabas,
 está en Yahoo! Respuestas (Beta).
 Probalo ya! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070226/3a7c68ea/attachment.html


More information about the ka-Map-users mailing list