[Mapserver-users] Join Query error

Steve Lime steve.lime at dnr.state.mn.us
Fri Jul 2 17:01:19 EDT 2004


Hi Rich: Joins live by themselves inside layers. Query objects are long
gone. Here's an 
example for a  one-to-one join with a csv file. In the case of a
one-to-many join you'd 
have a template defined in the join.

  # 1 by 1/2 Degree (100K) Quadrangle Index
  LAYER
    NAME "L210000030201"
    STATUS OFF
    TYPE QUERY

    # data access information
    DATA  "/r01/data/drs/metadata/mapserver/gen_state"
    FILTERITEM  "C210030201"
    FILTER /./

    # result presentation information
    TEMPLATE "query_result.html"
    HEADER "query_layer_header.html"
    FOOTER "query_layer_footer.html"
    JOIN
      NAME "stats"
      CONNECTIONTYPE CSV
      TABLE
"/r01/data/drs/metadata/data_def/layer_stat/indx_q100kpy4_stat.txt"
      FROM "TILE_ID"
      TO "1"
    END
  END

Steve


>>> Richard Greenwood <rich at greenwoodmap.com> 7/2/2004 1:43:38 PM >>>
I'm struggling with a join, type multiple. First off I get:
   loadLayer(): Unknown identifier. Parsing error near (QUERY):(line
428)
(see map file below). If I comment out the QUERY and corresponding END,

I get rid of the error, but still no data from the joined dbf. The data

from the base table is displayed, but then "[CATS]" is displayed rather

than the cat.html template.

Seems like maybe I shouldn't have a CLASS in a layer with a QUERY, but

removing it doesn't really effect things much.

Can anybody point me to a working example that I could examine?

Thanks,
Rich

=== map file ====

LAYER
   NAME  "ownership"
   STATUS ON
   TYPE POLYGON
   DATA  "ownership"
   HEADER "attribute_header.html"
   FOOTER "attribute_footer.html"
   QUERY
     JOIN
       NAME CATS
       TABLE "/fc/data/cat.dbf"
       FROM DESCRIPTOR
       TO CAPKEY
       TYPE multiple
       TEMPLATE cat.html
     END # of JOIN Object
   END # of query
   CLASS
     Name "Lot and Parcel Lines"
     TEMPLATE "attribute_display.html"
     SYMBOL "Solid"
     OUTLINECOLOR 0 0 0
     SIZE 2
   END  # class		
END  # layer

=== attribute_display.html ====

<li>Name : [NAME]</li>
<li>Mailing Address : [ADDRESS1]</li>
<li>Mailing Address : [ADDRESS2]</li>
<li>Mailing Address : [CITY], [STATE] [ZIPCODE]</li>
<li>Street Address  : [ST_NUM1] [ST_NUM1_2] [ST_DIR_PRE] [ST_NAME] 
[ST_DIR_SUF]</li>
<li>Descript : [DESCRIPT]</li>
<li>Area_tax : [ACRES_TAX]</li>
<li>Area_calc : [AREA]</li>
<li>Code Area : [CODE_AREA]</li><BR>
[CATS]

=== cat.html ===

<li>Category : [Cacat] [Descript]</li>

-- 
Richard Greenwood
www.greenwoodmap.com 
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu 
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list