Ticket #3843 (closed defect: fixed)

Opened 2 years ago

Last modified 15 months ago

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

Change History

Changed 16 months ago by havatv

  • component changed from Documentation - mapserver.org to Documentation - MapServer

Changed 15 months ago by havatv

  • cc havatv added
  • status changed from new to closed
  • resolution set to fixed

There was a note already. I have made some more changes to the join document to emphasize current behaviour (r13218). Closing.

Will CSV attribute names be handled properly in the future?

Note: See TracTickets for help on using tickets.