[mapserver-users] Display TAB point layer but get label from a second tab file
Daniel Morissette
dmorissette at mapgears.com
Tue Jun 7 07:30:46 PDT 2011
On 11-06-06 06:29 PM, Peter Girgis wrote:
> Hi all
>
> I wonder if anyone can assist me with this issue.
> I have a TAB file which contains points and a second TAB file which
> contains the labels.
> The two TAB files are relational so I can look up the label using a
> unique id however I cannot work out whether it is in fact possible to
> display labels from a second TAB file based on a query.
>
> This is similar to JOIN where you would lookup labels from a csv or
> database however I canot see an option to do this from a TAB file.
>
You could use a OGR SQL statement in the DATA parameter of your layer to
join the two tables. This won't be very efficient since I don't think
OGR will take advantage of any index in this case, but could be worth a
try if your files are not too large.
e.g. something like the following (untested)
LAYER
NAME "mylayer"
TYPE POINT
CONNECTIONTYPE OGR
CONNECTION "/path/to/points.tab"
DATA "SELECT * from points LEFT JOIN '/path/to/labels.tab'.labels on
points.id = labels.id"
STATUS ON
CLASS
...
END
...
END
For more info on OGR SQL, see:
http://www.gdal.org/ogr/ogr_sql.html
... and use the ogrinfo utility to experiment and test your SQL statement.
Another option may be to setup a VRT to join the two tables... that
would be doing essentially the same thing internally, except that the
SQL statement would be inside the VRT file:
http://www.gdal.org/ogr/drv_vrt.html
http://mapserver.org/input/vector/VirtualSpatialData.html
--
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000
More information about the MapServer-users
mailing list