|
Home | Products | Issue Tracker | FAQ | Download |
|
|
Warning
Cette page de documentation n’est pas a jour, avec au moins 397 jours de retard sur la version originale. Nous vous conseillons fortement de naviguer vers la version anglaise de cette page.
| Revision: | $Revision: 10895 $ |
|---|---|
| Last Updated: | 04/02/2011 |
Les jointures sont définies au sein d’un objet LAYER. Il est important de comprendre que les jointures sont UNIQUEMENT disponibles une fois qu’une requête a été exécutée. Vous ne pouvez pas utiliser les jointures pour modifier l’apparence d’une carte. L’objectif principal est de permettre de lier une table à des données codées (par exemple 1 => Forêt) mais d’autres utilisations sont possibles.
CONNECTION "host=127.0.0.1 port=5432 user=postgres password=postgres dbname=somename"
CONNECTIONTYPE ogr
LAYER
NAME "prov_bound"
TYPE POLYGON
STATUS DEFAULT
DATA "prov.shp"
CLASS
NAME "Province"
STYLE
OUTLINECOLOR 120 120 120
COLOR 255 255 0
END
END
TEMPLATE "../htdocs/cgi-query-templates/prov.html"
HEADER "../htdocs/cgi-query-templates/prov-header.html"
FOOTER "../htdocs/cgi-query-templates/footer.html"
JOIN
NAME "test"
TABLE "../data/lookup.dbf"
FROM "ID"
TO "IDENT"
TYPE ONE-TO-ONE
END
END # layer
>ogrinfo lookup.dbf lookup -summary
INFO: Open of `lookup.dbf'
using driver `ESRI Shapefile' successful.
Layer name: lookup
Geometry: None
Feature Count: 12
Layer SRS WKT:
(unknown)
IDENT: Integer (2.0)
VAL: Integer (2.0)
>ogrinfo prov.shp prov -summary
INFO: Open of `prov.shp'
using driver `ESRI Shapefile' successful.
Layer name: prov
Geometry: Polygon
Feature Count: 12
Extent: (-2340603.750000, -719746.062500) - (3009430.500000, 3836605.250000)
Layer SRS WKT:
(unknown)
NAME: String (30.0)
ID: Integer (2.0)
<tr bgcolor="#EFEFEF"><td align="left">[NAME]</td><td align="left">[test_VAL]</td></tr>
LAYER
NAME "prov_bound"
TYPE POLYGON
STATUS DEFAULT
DATA "prov.shp"
CLASS
NAME "Province"
STYLE
OUTLINECOLOR 120 120 120
COLOR 255 255 0
END
END
TOLERANCE 20
TEMPLATE "../htdocs/cgi-query-templates/prov.html"
HEADER "../htdocs/cgi-query-templates/prov-header.html"
FOOTER "../htdocs/cgi-query-templates/footer.html"
JOIN
NAME "test"
CONNECTION "host=127.0.0.1 port=5432 user=postgres password=postgres dbname=join"
CONNECTIONTYPE ogr
TABLE "lookup"
FROM "ID"
TO "ident"
TYPE ONE-TO-ONE
END
END # layer
>ogrinfo -ro PG:"host=127.0.0.1 port=5432 user=postgres password=postgre dbname=join" lookup -summary
INFO: Open of `PG:host=127.0.0.1 port=5432 user=postgres password=postgres dbname=join'
using driver `PostgreSQL' successful.
Layer name: lookup
Geometry: Unknown (any)
Feature Count: 12
Layer SRS WKT:
(unknown)
ident: Integer (0.0)
val: Integer (0.0)
<tr bgcolor="#EFEFEF"><td align="left">[NAME]</td><td align="left">[test_val]</td></tr>
Note
Quand vous testez cette jointure postgreSQL avec MapServer 4.10.0 sur Windows entraîne un crash de mapserv.exe. Cependant si vous testez ceci avec une version > 4.10.0 ce crash n’arrive pas.
LAYER
NAME "prov_bound"
TYPE POLYGON
STATUS DEFAULT
DATA "prov.shp"
CLASS
NAME "Province"
STYLE
OUTLINECOLOR 120 120 120
COLOR 255 255 0
END
END
TOLERANCE 20
TEMPLATE "../htdocs/cgi-query-templates/prov.html"
HEADER "../htdocs/cgi-query-templates/prov-header.html"
FOOTER "../htdocs/cgi-query-templates/footer.html"
JOIN
NAME "test"
TABLE "../data/lookup.csv"
FROM "ID"
TO "IDENT"
TYPE ONE-TO-ONE
END
END # layer
"IDENT","VAL"
1,12
2,11
3,10
4,9
5,8
6,7
7,6
8,5
9,4
10,3
11,2
12,1
>ogrinfo lookup.csv lookup -summary
INFO: Open of `lookup.csv'
using driver `CSV' successful.
Layer name: lookup
Geometry: None
Feature Count: 12
Layer SRS WKT:
(unknown)
IDENT: String (0.0)
VAL: String (0.0)
<tr bgcolor="#EFEFEF"><td align="left">[NAME]</td><td align="left">[test_VAL]</td></tr>