queryable layer

piero cavalieri piero.cavalieri at GMAIL.COM
Sun May 6 08:29:46 EDT 2007


Your TEMPLATE should be a valid html/xml file. For example, in a .map file:

LAYER
  NAME park
  METADATA
    "DESCRIPTION"   "Parks"
    "RESULT_FIELDS" "NAME_E YEAR_EST AREA_KMSQ"
  END
  TYPE POLYGON
  STATUS OFF
  DATA park
  CLASS
    NAME "Parks"
    COLOR 200 255 0
    OUTLINECOLOR 120 120 120
    TEMPLATE "templates/park.xml"
  END
  TOLERANCE 5
  HEADER "templates/layer_header.xml"
  FOOTER "templates/layer_footer.xml"
END # Layer

In TEMPLATE "templates/park.xml":

<record>
    <field name="Nome e." tooltip="1">[NAME_E]</field>
    <field name="Area [Km2]" tooltip="1">[AREA_KMSQ]</field>
</record>

[NAME_E] and [AREA_KMSQ] are replaced with  your 2 dbf field values for 
the query (i.e in your case you should use [CENTER] and [MYTEXT])

In this case, I also have:

HEADER "templates/layer_header.xml"
FOOTER "templates/layer_footer.xml"

With layer_header.xml:
<layer layerName="[cl]" resultsNumber="[nlr]">

and

layer_footer.xml:
</layer>

You need header and footer if you have multiple results for your query 
(because header and footer must be processed only once). For an html 
template file, footer is at the minimum </body></html> and header is 
<hml><head>aaa</head><body>. Than in TEMPLATE file you write html you 
use to have formatted info. The resulting output file must be a valid 
html file (if you use html template files, but you could define your own 
format, has I done, if you have to do some kind of processing before 
presenting results to the user).
I suggest you try with simple html template file. It should works. Also 
there should be an "Itasca" demo application,
if you look for that in Mapserver site.

Cheers
 Piero

Giuseppe De Rossi wrote:
> Hi all,
> I'm trying to implement a quaryable layer . The data are stored in three
> files .shp .shp and dbf. In the last one there is the following  structure:
> ADMAPKEY(int) , CENTER(string) , MYTEXT (string)
> 1 , 70282.3193,-20782.0280,this is a point of interest
>
> I've added the following Layer in the .map file:             
>
> LAYER 
> NAME "Pointofint"
> STATUS ON 
> DATA "Pointofint"
> TEMPLATE "ttt"
> TYPE POINT 
> UNITS METERS 
> SIZEUNITS PIXELS 
> LABELITEM "MYTEXT"
> METADATA
> "exported_values" "recenter_name_string,id_attribute_string"
> "id_attribute_string" "ADMAPKEY"
> "query_returned_attributes" "MYTEXT" 
> END 
> CLASS 
> NAME "Pointofint"
> STYLE 
> SYMBOL "circle"
> COLOR 255 0 0
> OUTLINECOLOR 0 0 0
> SIZE 20
> END 
> END 
> END 
>
> I can see the layer but unfortunately no data has been returned . Is it
> correct the layer definition ?
> How can I check the chain to see where is the broken ring ?
>
> Thanks in advantage and best regards
>
> Giu 
>  
>  --
>  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>  
>  Sponsor:
>  Logos Finanziaria SPA. Società di credito ad erogazione diretta. Fino a
> 30.000 euro in 24 ore! Clicca e scopri come
>
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2909&d=20070505
>
>   



More information about the mapserver-users mailing list