[Mapserver-users] Join Query error

Richard Greenwood rich at greenwoodmap.com
Wed Jul 7 08:46:16 EDT 2004


Emil,

Thanks! I did not have the join name prefix on my filed names. That's 
new since 3.3, no?

I appreciate your help.

Rich


Emil Zegers wrote:

> Hello Rich,
> 
> In the layer you define TYPE QUERY, better change this to TYPE POLYGON?
> 
> Could you send the template you use too?
> 
> Make sure in the template you put the join name in front of each field name that comes from the joined table.
> 
> Eg.
> 
> Map file:
> 
> LAYER
>   NAME "rapporten"
>   METADATA
>     wms_title "rapporten"
>   END
>   STATUS ON
>   TYPE POLYGON
>   DATA bis_rapv
>   TOLERANCE 8
>   LABELITEM rap_code
> 
>   CLASS
>     NAME "BIS Rapporten"
>     COLOR 255 0 0
>     OUTLINECOLOR 0 0 255
>     TEMPLATE "C:\websites\dbf_join\bis_rapv.htm"
>   END
> 
>   JOIN
>     TABLE "Rapport.dbf"
>     TO "RAP_CODE"
>     NAME "bis_rapv_join"
>     FROM "rap_code"
>   END
> END
> 
> Part of template file:
> 
> rapportcode: [rap_code]
> <br>
> rapportcode: [bis_rapv_join_RAP_CODE]
> <br>
> locatiecode: [bis_rapv_join_LOC_CODE]
> <br>
> nu LDB: [bis_rapv_join_NUT_LDB]
> <br>
> conclusie: [bis_rapv_join_CONCLUSIE]
> <br>
> conclusie verwacht: [bis_rapv_join_CONCL_VERW]
> <br>
> XCOORD: [XCOORD]
> <br>
> YCOORD: [YCOORD]
> <br>
> 
> Name of the join is "bis_rapv_join". Fields from the joined table should start with this name.
> 
> The other fields are attributes directly from the dataset.
> 
> Regards,
> 
> Emil
> 
> 
> 
>>>>Richard Greenwood <rich at greenwoodmap.com> 07/07/04 12:59am >>>
> 
> Steve,
> 
> As always, thanks for your help.
> 
> Removing the query object solves the first problem. Unfortunately the 
> 4.2 docs still says "Joins are defined within a query object." I think I 
> could fix that in CVS if you like.
> 
> Unfortunately I'm still not getting data from my joined table, even in a 
> one-to-one join. It works with an OGR join, but ultimately I need to get 
> a one-to-many join going, so I don't think I can use the OGR join. I've 
> tried the obvious stuff with field name case, etc. Do you see anything 
> wrong with the layer definition and query string below?
> 
> Rich
> 
> LAYER
> 	NAME  "join_query"
> 	TYPE QUERY
> 	STATUS ON
> 	DATA  "parcel_region"			
> 	HEADER "attribute_header.html"
> 	FOOTER "attribute_footer.html"
> 	TEMPLATE "attribute_display.html"
> 	JOIN
> 		NAME "test"
> 		TABLE "/Tc/temp/assessor2.DBF"
> 		FROM PIDP
> 		TO PIDA
> 		TYPE single
> 	END
> END
> 
> Query string:
>    imgext=2410773.068182+1413684.318182+2424682.613636+1424109.318182
>    map=tc/tc.map
>    mode=query
>    template=tc.html
>    layer=join_query
>    imgxy=219.5+164.5
>    img.x=188
>    img.y=168
> 
> 
> 
> Steve Lime wrote:
> 
> 
>>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
> 
> 


-- 
Richard Greenwood
www.greenwoodmap.com



More information about the mapserver-users mailing list