Ticket #3843 (closed defect: fixed)
Join from SHP file to DBF file documentation
| Reported by: | are | Owned by: | hobu |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Documentation - MapServer | Version: | 5.6 |
| Severity: | normal | Keywords: | join, CSV |
| Cc: | havatv |
Description
The Mapserver Website documentation for joining data from shapefile to DBF is a bit poor (http://mapserver.org/mapfile/join.html). Please find here a working example:
LAYER
NAME "population" TYPE POLYGON STATUS DEFAULT DATA "../data/countries.shp" TEMPLATE '../data/pop.html' CLASS
NAME "pop" STYLE
OUTLINECOLOR 120 120 120 COLOR 255 255 0
END
END JOIN
NAME "pop" CONNECTIONTYPE CSV TABLE "/home/webdev/mapfiles/data/pop.csv" FROM "ISO" # Shapefile attribute TO "2" # CSV join code doesn't use the first row as column names,instead you refer to the columns by number (1, 2, 3, ..., n) TYPE ONE-TO-ONE
END
END # layer
The CSV format should look sth like this:
1,AFG,2176
2,ALA,2600
And the html template "pop.html" should include [pop_1], [pop_2], ... to access joined values.
Regards,
Juan Arevalo
