[Geomoose-users] Identify tool not work in Postgis layers‏

Fernando nando_gcia at hotmail.com
Mon May 25 00:46:44 PDT 2015


Hello, I have installed on a Windows PC, MS4W - MapServer 4 Windows version 3.0.4, PHP 5.3.10, CGI MapServer 6.0.2, Apache 2.2.21, PostgreSQL 9.4, PostGIS 2.1 and GeoMOOSE 2.7.1.

Postgis layers displayed correctly but doesn't work the Identify tool. I read all the documentation and I can not figure out what fails. I modified the example of "parcels" that brings GeoMOOSE to guide me.

My configs are the folowing:

mapbook Describing the query and the select services:

<?xml version="1.0" encoding="ISO-8859-1"?>
<mapbook version="2.7.1">
    <configuration>
        <param name="links_bar_html"><![CDATA[
            <b>Our Stack:</b>
            <a target="_blank" href="http://www.geomoose.org">GeoMOOSE.org</a> |
            <a target="_blank" href="http://www.mapserver.org">MapServer</a> |
            <a target="_blank" href="http://www.openlayers.org">OpenLayers</a> |
            <a target="_blank" href="http://www.dojotoolkit.org">Dojo</a>
        ]]></param>
        <param name="projection">EPSG:3857</param>

        <param name="zoomto"><![CDATA[
        {
            "Zoom a plantas:" : {
                "PLANTA BAJA Y PATIOS" : [60,240,170,350],
                "PRIMERA" : [-80,120,18,218],
                "PLANTA SEGUNDA" : [70,120,160,215],
                "PLANTA TERCERA" : [-80,0,10,100],
                "PLANTA SÓTANO" : [-90,242,36,350],
                "PLANTA CUBIERTAS" : [90,-2,160,108]
            }
        }
        ]]></param>

        <param name="max_extent">-136,-1,227,362</param>
        <param name="initial_extent">-136,-1,227,362</param>
        <param name="measure_tool.show_area_segments">false</param>
        <param name="layer_controls.legend.on">false</param>
        <param name="layer_controls.metadata.on">false</param>       
        <param name="layer_controls.legend.on">true</param>   
        <param name="ground_units">m</param>
        <param name="maxResolution">1000</param>
        <param name="numZoomLevels">20</param>
        <param name="layer_controls.fade.on">true</param>
        <param name="coordinate_display.usng">true</param>
        <param name="jumpto_scales"><![CDATA[
        {
            "1:1000" : 1000,
            "1:500" : 500,
            "1:240" : 240,
            "1:100" : 100,
            "1:50" : 50
        }
    ]]></param>   

    </configuration>
    <!--
        The mapping services define the source of the mapping data.
    -->

    <map-source name="highlight" type="mapserver">
        <file/>
        <layer name="highlight"/>
        <param name="TRANSPARENT" value="TRUE"/>
    </map-source>

        <!-- C2-ALBERT_EINSTEIN -->
    <map-source name="edificio_c2_espacios" type="mapserver">
        <file>./c2_postgis.map</file>
        <layer name="C2-ALBERT_EINSTEIN" status="on"/>
        <param name="FORMAT" value="image/png; mode=8bit"/>
       <param name="TRANSPARENT" value="true"/>
    </map-source>

------------------------------------------------------------------------------------------------------------------

    <service name="identify" title="Identify" display="true" display-submit="false" clear-highlight="true">
        <url>php/identify.php</url>
        <step type="spatial" name="shape" line="false" polygon="false" jump-start="true" default="point" box="true" pan="false">
            <header>
                Click on the map to see more detailed information.
            </header>
            <!--
            Uncomment this line to test "hidden" layers working with identify.  This will
            leave the layers listed here always identified despite their visibility.
            <input type="hidden" name="hidden_layers" value="edificio_c2_espacios/C2-ALBERT_EINSTEIN"/>
            -->
            <input type="visiblelayers" name="layers"/>
            <input type="projection" name="projection"/>
        </step>
    </service>

-----------------------------------------------------------------------------------------------------------------------

    <!--
        The catalog defines how the layers will be displayed in the catalog tab.
    -->
    <catalog>
            <group title="PLANOS DISTRIBUCIÓN" expand="true">
                <layer title="ESPACIOS" src="edificio_c2_espacios/C2-ALBERT_EINSTEIN" metadata="true" legend="true" tip="Plano de las ubicaciones poligonadas" show-legend="true" popups="true" fade="true" unfade="true">
                    <metadata>http://www.geomoose.org/docs/</metadata>
                </layer>
            </group>
    </catalog>

------------------------------------------------------------------------------------------------------------------------

Map file "edificio_c2.map" of the postgis layer in C:\ms4w\apps\geomoose2\maps

MAP                                                                    # DEFINICIÓN DEL MAPA
    NAME EDIFICIO_C2_MAP                            # nombre del Mapa
    STATUS ON                                                    # estado activado
    SIZE 800 800                                            # tamaño en píxeles
    EXTENT -136 -1 227 362                          # extensión gráfica de la imagen. Es un área rectangular marcada por las coordenadas de
                                                                        # dos lados opuestos (el inferior izquierdo y el superior derecho).
    UNITS METERS                                             # unidad de medida
    #SHAPEPATH "../data"                          # directorio origen de datos
   
    INCLUDE "./geomoose_globals.map"
       
    IMAGECOLOR 255 255 255                        # color de background
    IMAGETYPE PNG                                            # tipo de salida de imagen
    SYMBOLSET "./symbols/symbol.sym"  
    FONTSET "./fonts/fontset.list"
    TRANSPARENT FALSE
    RESOLUTION 100
    DEFRESOLUTION 100
    CONFIG "MS_ERRORFILE" "/ms4w/ms_error_c2.txt"

  OUTPUTFORMAT
  NAME png
  DRIVER "AGG/PNG"
  MIMETYPE "image/png"
  IMAGEMODE PC256
  EXTENSION "png"
  FORMATOPTION "GAMMA=0.75"
END

OUTPUTFORMAT
  NAME "gif"
  DRIVER GD/GIF
  MIMETYPE "image/gif"
  IMAGEMODE PC256
  EXTENSION "gif"
END

OUTPUTFORMAT
  NAME "jpeg"
  DRIVER AGG/JPEG
  MIMETYPE "image/jpeg"
  IMAGEMODE RGB
  EXTENSION "jpg"
  FORMATOPTION "GAMMA=0.75"
END  

    #
    # Start of web interface definition
    #
    WEB                                                                # ESTE OBJETO NOS PERMITIRÁ VISUALIZAR LA IMAGEN CREADA POR MAPSERVER
      #MINSCALE 10
      #MAXSCALE 1000
    #
    # On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the root
    # of the drive where the .MAP file resides.
    #
      IMAGEPATH "/ms4w/tmp/ms_tmp/"
      IMAGEURL "/ms_tmp/"
      #LOG "/ms4w/gmap.log"
      METADATA
          "wms_title" "WMS SIG-UCO SERVER - EDIFICIO C2 ALBERT EINSTEIN"
          "wms_abstract" "SERVIDOR WMS DE LOS PLANOS DEL EDIFICIO ALBERT EINSTEIN (C2)."
            "wms_onlineresource"    "http://localhost/cgi-bin/mapserv?map=/ms4w/apps/geomoose2/maps/c2_postgis.map"
            "wms_srs" "epsg:3857"
            "wms_enable_request" "*"   #necessary
             "wms_feature_info_mime_type" "text/html"      
     END
    END
   
    #
    # Start of reference map
    #
    REFERENCE                                                                            # DEFINE EL MAPA DE REFERENCIA
       IMAGE "../htdocs/images/keymap_c2.png"                        # imagen de referencia
       EXTENT -136 -1 227 362                                             # extensión   
       STATUS ON                                                                    # estado activado
       COLOR -1 -1 -1                                                            # color de background
       OUTLINECOLOR 255 0 0                                                # color de línea de caja
       SIZE 210 210                                                                # tamaño en píxeles     
    END
   
    #
    # Start of legend
    #
    LEGEND                                # DEFINE LA LEYENDA DEL MAPA. MUESTRA LAS CAPAS ACTIVAS Y LAS ETIQUETAS DEFINIDAS
                                                # A TRAVÉS DE LA ETIQUETA LABEL
      STATUS ON                        # estado on/off
      KEYSIZE 18 12               
      LABEL
        TYPE BITMAP                # tipo de salida
        SIZE MEDIUM                # tamaño
        COLOR 0 0 89            # color del texto
      END
    END
   
    QUERYMAP
        STATUS ON
      STYLE HILITE
      COLOR 255 255 0
    END
   
#
# Start of ScaleBar definition
#
SCALEBAR
  STATUS EMBED
  TRANSPARENT OFF
  INTERVALS 3
  SIZE 200 5
  UNITS meters
  COLOR 250 250 250
  OUTLINECOLOR 0 0 0
  BACKGROUNDCOLOR 100 100 100
  STYLE 0
  POSTLABELCACHE true
  LABEL
    COLOR 0 0 90
    #OUTLINECOLOR 200 200 200
    SIZE MEDIUM
  END  # Label
END  # Reference

    PROJECTION                                                # DEFINICIÓN DE LA PROYECCIÓN DEL MAPA
        "init=epsg:3857"
    END
   
# SYMBOLS USED
# - 'circle' always necessary (used e.g. for highlight)
# - 'square' used in currecnt map file
# Symbols can also be defined via tag SYMBOLSET (see above)
Symbol
  Name 'circle'
  Type ELLIPSE
  Filled TRUE
  Points
    1 1
  END
END

Symbol
  Name 'square'
  Type VECTOR
  Filled TRUE
  Points
    0 1
    0 0
    1 0
    1 1
    0 1
  END
END

    SYMBOL
        NAME "tabiqueria"
        TYPE vector
        POINTS
        0 0
        1 1
        END
    END

    SYMBOL
        NAME "tejado"
        TYPE vector
        POINTS
        1 0
        0 1
        END
    END
   
    SYMBOL
        NAME "terraza"
        TYPE vector
        POINTS
        0 1
        0 0
        1 0
        1 1
        0 1
        END
    END

###
   
LAYER
 CONNECTIONTYPE postgis
 CONNECTION "user=postgres password=************** dbname=edificio_c2 host=localhost port=5432"
 DATA "the_geom FROM c2_shape USING UNIQUE gid USING SRID=3857"
 
 GROUP "C2-ALBERT_EINSTEIN"                                            # grupo de la capa
 NAME "C2-ALBERT_EINSTEIN"                                                # nombre de la capa
 METADATA
   "DESCRIPTION" "ESPACIOS POLIGONADOS"
   "GROUP" "C2-DISTRIBUCION"
   "LAYER" "C2-ALBERT_EINSTEIN"
   "TRANSPORTATION" "TRUE"
   "RESULT_FIELDS" "dxf_text,area,perimeter,tipo_ubica,tipo_uso,contenido,practica,investigac,docente,otros,departamen,area_depto,profesor,pas"
   "RESULT_HEADERS" "IDENTIFICADOR, SUPERFICIE (m2), PERIMETRO (m), TIPO UBICACION, TIPO USO, DESCRIPCION, %PRACTICAS, %INVESTIGACION, %DOCENCIA, %OTROS USOS, DEPARTAMENTO, AREA DEPARTAMENTAL, PROFESOR, PERSONAL"
   "SPATIALSEARCH" "dxf_text"                                                                        # Otra opción: "DXF_TEXT, AREA, PERIMETER" ó "AREA|PERIMETER|KELURAHAN|KECAMATAN|KABUPATEN|PROPINSI"
   "SPATIALSEARCHLIST" "dxf_text,area,perimeter"                                # Otra opción: "DXF_TEXT, AREA, PERIMETER"
     "wms_group_title"   "C2-DISTRIBUCION"
     "wms_title" "Plano con filtro C2 ALBER EINSTEIN"
     "wms_name" "C2-ALBERT_EINSTEIN"
     "wms_format" "image/png"          
     "wms_abstract" "C2 ALBERT EINSTEIN - Plano de la distribución del edificio"
     "wms_srs" "epsg:3857"
     "wms_enable_request" "*"                            # otras opciones son: "wms_enable_request" "GetMap GetFeatureInfo"
     "wms_server_version" "1.1.1"
     "wms_extent"    "-136 -1 227 362"
     "gml_include_items"   "all"
     "wms_include_items"   "all"

            # drill-down identify service record.
        'identify_record'    './templates/identify.html'

            # query.php / "Search Parcels" functionality.
            'itemquery'    'templates/search_result.html'
            'itemquery-filter'    '/.*[qstring].*/i'
            'qstring_validation_pattern' '.'
           
            # Feature reports are stored in the conf/feature_report directory.
            'feature_report' 'parcel.xml'

        'select_record'    'templates/select_result.html'
            'select_header' 'templates/select_header.html'
            'popups' 'parcels_popup.html'
 END
 
 VALIDATION
   # %filtro% subtituciones sólo pueden tener letras minúsculas, mayúsculas y números
   'filtro'     '^[a-zA-Z0-9]+'
 END       

 STATUS ON
 TYPE POLYGON
      #LABELITEM "DXF_TEXT"                                                    # define la columna de la tabla atributos que se va mostrar en el mapa
         #LABELMAXSCALE 500                                                            # establece la escala máxima a la que las etiquetas serán dibujadas

        CLASSITEM 'dxf_text'
      CLASS                                                                                    # NOS PERMITE AGRUPAR O SELECCIONAR DIFERENTES PARTES O TIPOS DE UNA CAPA
        NAME "TABIQUERIA"                                                        # nombre de leyenda
        EXPRESSION ('[dxf_text]' eq 'TABIQUERIA')        # es la regla que define la pertenencia a una clase
            STYLE
            COLOR 246 158 4                                                      # estilo del CLASS
            OUTLINECOLOR 100 100 100
            BACKGROUNDCOLOR 254 202 112
            SYMBOL "tabiqueria"
            SIZE 7
            # COLOR 255 0 0
            # OUTLINECOLOR 0 0 0
        END #end style
      END
     
      CLASS                                                                                    # NOS PERMITE AGRUPAR O SELECCIONAR DIFERENTES PARTES O TIPOS DE UNA CAPA
        NAME "ESCALERA EMERGENCIA"                                                        # nombre de leyenda
        EXPRESSION (('[dxf_text]' eq 'ESCALERA EMERGENCIA') or ('[dxf_text]' eq 'RAMPA') or ('[dxf_text]' eq 'ESCALERA OBRA') or ('[dxf_text]' eq 'C1'))        # es la regla que define la pertenencia a una clase
            STYLE
            COLOR 150 196 150                                                      # estilo del CLASS
            OUTLINECOLOR 100 100 100
            BACKGROUNDCOLOR 254 202 112
            #SYMBOL "tabiqueria"
            SIZE 7
            # COLOR 255 0 0
            # OUTLINECOLOR 0 0 0
        END #end style
           LABEL                                                                                # define el estilo de las etiquetas LABELITEM
              FONT "vera_sans-bold"
              TYPE truetype
              SIZE 7
               COLOR 0 0 0
               OUTLINECOLOR 255 255 0              
               ALIGN CENTER
               FORCE FALSE                                                                # indica que no muestre todas las etiquetas para que no se solapen hasta que no se haga zoom
               PARTIALS TRUE
               POSITION AUTO
               MAXSCALEDENOM 600              
           END
            #TEXT ([dxf_text])                                                        # SINTAXIS PARA MAPSERVER 5.6.6
           TEXT ('[dxf_text]')                                                # SINTAXIS PARA MAPSERVER 6.0.1
      END
     
      CLASS                                                                                    # NOS PERMITE AGRUPAR O SELECCIONAR DIFERENTES PARTES O TIPOS DE UNA CAPA
        NAME "BUSQUEDAS"                                                    # nombre de leyenda
        EXPRESSION ('[dxf_text]' IN '%filtro%')        # es la regla que define la pertenencia a una clase
            STYLE                                                                                # estilo del CLASS
            COLOR 255 125 125
            OUTLINECOLOR 255 0 0
           END #end style
           LABEL                                                                                # define el estilo de las etiquetas LABELITEM
              FONT "vera_sans-bold"
              TYPE truetype
              SIZE 7
               ALIGN CENTER
               COLOR 0 0 0
               FORCE TRUE                                                                # indica que no muestre todas las etiquetas para que no se solapen hasta que no se haga zoom
               PARTIALS TRUE
               POSITION AUTO
               WRAP ':'
           END
            #TEXT ([dxf_text]:[tipo_ubica])                            # SINTAXIS PARA MAPSERVER 5.6.6
           TEXT ('[dxf_text]' + ':' + '[tipo_ubica]')    # SINTAXIS PARA MAPSERVER 6.0.1
        END # end class
         
      CLASS                                                                                    # NOS PERMITE AGRUPAR O SELECCIONAR DIFERENTES PARTES O TIPOS DE UNA CAPA
        NAME "UBICACIONES"                                                    # nombre de leyenda
            STYLE                                                                                # estilo del CLASS
            COLOR 235 235 235
            OUTLINECOLOR 100 100 100
           END #end style
           LABEL                                                                                # define el estilo de las etiquetas LABELITEM
              FONT "vera_sans"
              TYPE truetype
              SIZE 7               ALIGN CENTER
               COLOR 0 0 0
               OUTLINECOLOR 255 255 128
               FORCE TRUE                                                                # TRUE: indica que si muestre todas las etiquetas aunque se solapen sin tener que esperar a hacer zoom
               PARTIALS FALSE
               POSITION AUTO
               MAXSCALEDENOM 600
               WRAP ':'
           END
            #TEXT ([dxf_text])                                                    # SINTAXIS PARA MAPSERVER 5.6.6
            #TEXT ([dxf_text]:[tipo_ubica])                            # SINTAXIS PARA MAPSERVER 5.6.6
           TEXT ('[dxf_text]' + ':' + '[tipo_ubica]')    # SINTAXIS PARA MAPSERVER 6.0.1
        END # end class

        TOLERANCE 0
        TOLERANCEUNITS PIXELS
    TEMPLATE "building_popup.html" # sin plantilla, no hace bien las consultas
       
 PROJECTION
    "init=epsg:3857"
 END
END
 
END ## end Map



---------------------------------------------------------------------------------------------------------------

My postgis table:

CREATE TABLE c2_shape
(
  gid serial NOT NULL,
  area numeric,
  perimeter numeric,
  cover_ double precision,
  cover_id double precision,
  dxf_layer character varying(31),
  dxf_color smallint,
  dxf_thickn double precision,
  dxf_type character varying(10),
  dxf_elevat double precision,
  dxf_handle character varying(16),
  dxf_angle double precision,
  dxf_size double precision,
  dxf_text character varying(40),
  dxf_attrib character varying(16),
  dxf_iid double precision,
  contenido character varying(254),
  departamen character varying(254),
  area_depto character varying(254),
  tipo_ubica character varying(254),
  tipo_uso character varying(254),
  profesor character varying(254),
  pas character varying(254),
  investigac character varying(254),
  docente character varying(254),
  practica character varying(254),
  otros character varying(254),
  the_geom geometry(MultiPolygon,3857),
  CONSTRAINT c2_shape_pkey PRIMARY KEY (gid)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE c2_shape
  OWNER TO postgres;

-- Index: c2_shape_the_geom_idx

-- DROP INDEX c2_shape_the_geom_idx;

CREATE INDEX c2_shape_the_geom_idx
  ON c2_shape
  USING gist
  (the_geom);


---------------------------------------------------------------------------------------------------------------

File "parcels_popup.html" in C:\ms4w\apps\geomoose2\maps

<!-- MapServer Template -->
<div>
<b>Identificador:</b> [dxf_text]<br/>
<b>Contenido:</b> [contenido]<br/>
<br/>

<a href="javascript:GeoMOOSE.startService('feature_report', {'src' : 'edificio_c2_espacios/C2-ALBERT_EINSTEIN', 'dxf_text' : '[dxf_text]'});">View Parcel Report</a>
</div>

---------------------------------------------------------------------------------------------------------------


Here are the files that i have in the templates folder -> C:\ms4w\apps\geomoose2\maps\templates, modified to my postgis layer

identify.html

<!-- MapServer Template -->
<tr bgcolor="#DEE5EB"><td colspan="2"><b><u>ESPACIOS</u></b></tr>
<tr>
<td align="right"><b>IDENTIFICADOR:</b></td>
<td>[dxf_text]</td>
</tr>
<tr>
<td align="right"><b>CONTENIDO:</b></td>
<td>[contenido]</td>
</tr>
<tr>
<td align="right"><b>TIPO UBICACIÓN:</b></td>
<td>[tipo_ubica]</td>
</tr>
<tr>
<td align="right"><b>TIPO USO:</b></td>
<td>[tipo_uso]</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>


identify.map

<!-- MapServer Template -->
<a id="[dxf_text]" class='sprite-control sprite-control-find-selected' style="padding-left: 22px" parcel-shape="[shpxy]" href="javascript:GeoMOOSE.zoomToPointsList(dojo.byId('[dxf_text]').getAttribute('dxf_text'), 'EPSG:3857');">[dxf_text]</a><br/>
[contenido]<br/>
<br/>

search_result.html

<!-- MapServer Template -->
<b>Identificador:</b> <a data-pin="[dxf_text]" id="gm-parcel-[dxf_text]" class='sprite-control sprite-control-find-selected' style="padding-left: 22px" parcel-shape="[shpxy]" href="javascript:GeoMOOSE.zoomToPointsList(dojo.byId('[dxf_text]').getAttribute('parcel-shape'), 'EPSG:3857');">[dxf_text]</a><br/>
<b>Contenido:</b> [contenido]<br/>
<hr/>

search_header.html

<!-- MapServer Template -->
<a target="_blank" href="php/mailing_labels.php?queryid=[QUERYID]&output=pdf">PDF Mailing Labels</a><br/>
<a target="_blank" href="php/mailing_labels.php?queryid=[QUERYID]&output=html">HTML Mailing Labels</a><br/>
<a target="_blank" href="php/mailing_labels.php?queryid=[QUERYID]&output=csv">CSV Mailing Labels</a><br/>
<br/>
<div style="display: [SHOW_FOLLOWUP]"/>
<a href="javascript:GeoMOOSE.startService('buffered_select_followup', {shape: '[SHAPE_WKT]', select_layer: '[SELECT_LAYER]', query_layer: '[SELECT_LAYER]', selection_buffer: [SELECTION_BUFFER]})">Buffer these results</a>
<br/><br/>
</div>


select_result.html

<!-- MapServer Template -->
<table>
<tr>
<td><b>IDENTIFICADOR:</b></td><td>[dxf_text]</td>
</tr>
<tr>
<td><b>Contenido:</b></td>
<td>[contenido]</td>
</tr>
<tr>
<td><b>Tipo Ubicación:</b></td>
<td>[tipo_ubica]</td>
</tr>
<tr>
<td><b>Tipo Uso:</b></td>
<td>[tipo_uso]</td>
</tr>
<tr>
<td colspan="2"><hr/></td>
</tr>
</table>

----------------------------------------------------------------------------------------------------------

When I use the "Identify" tool, the result is always the same, only the ground coordinates of the point is displayed but does not display information postgis layer. For example:

Detailed information for the area you clicked on the map ...
Ground Coordinates
X: 108.95263671875
Y: 300.091796875
  
Disclaimer: This information is distributed as Being demonstation data only. You should not use the data for any other purposes.

Can anyone please help me? 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20150525/80a34aaa/attachment-0001.html>


More information about the Geomoose-users mailing list