[Mapserver-users] 4.0 JOIN problem
Steve Lime
steve.lime at dnr.state.mn.us
Thu Dec 11 10:46:20 PST 2003
I'm using CSV joins successfully at:
http://maps.dnr.state.mn.us/deli/
A typical layer definition looks like:
# 1:100k Digital Raster Graphic - Collars Removed
LAYER
NAME "L380000020906"
STATUS OFF
TYPE QUERY
# data access information
DATA "/r01/data/drs/metadata/mapserver/gen_q100k"
FILTERITEM "C380020906"
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/map_drg100im2_stat.txt"
FROM "TILE_ID"
TO "1"
END
END
and the query result template looks like (only 1 line). There is some
nasty javascript going on but you can see how the 3rd column in the CSV
file is accessed. With DBF files you have the advantage of a field
name:
queryResults[queryResults.length] = new
QueryResult(queryResults.length, layer.id, '[TILE_ID]', '[TILE_NAME]',
'[stats_3]');
The one thing I notice is that your trying to do a one-to-one join. The
syntax us actually TYPE ONE_TO_ONE. With those types of joins you don't
use a seperate template, you'd just use the join'd values in the regular
query template
Let me know if you have questions.
Steve
BTW CSV joins are only available in the CVS version (4.1)...
>>> <AJackson at realtors.org> 12/10/2003 4:43:43 PM >>>
>Joins live at the LAYER level now. Move it outside the CLASS and you
> should be ok.
I tried moving the JOIN into the LAYER level (as below) with no
success.
I know the join code is being called, because if I monkey with the
values for TABLE, TO, and FROM, I get errors in the log. Also,
the data matches. I even tried placing the same match value in every
record of the databases. No luck. Can anyone point me to a working
sample I can look at?
LAYER
NAME "state_sel"
TYPE QUERY
STATUS DEFAULT
DATA "st_combined"
FILTER "%SELECTED_STATE%"
FILTERITEM 'STATE'
JOIN
NAME "state_history"
TABLE "/var/www/html/maps/data/us_st_avg.dbf"
TYPE SINGLE
FROM "STYPE"
TO "HTYPE"
TEMPLATE "ImpactTemplates/historic_data.html"
END
CLASS
TEMPLATE "empty.html"
END
END
_______________________________________________
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