[mapserver-users] Join from SHP file to PostgreSQL table

Brent Fraser bfraser at geoanalytic.com
Mon Nov 29 10:46:16 EST 2010


Flavio,

   I think that if you have CONNECTIONTYPE OGR, the connection string 
must have "PG:" (unlike the native mapserver Postgres connections?):

     CONNECTIONTYPE ogr
     CONNECTION "PG:dbname='testdb' host=GSERVER1 port=5432 user='test' 
password='test' sslmode=disable"

If this works let me know, and I'll change the join documentation

Best Regards,
Brent Fraser


On 11/29/2010 7:43 AM, flaviocarmo wrote:
> Hi,
>
> I need to make a layer with a join between a shapefile and a non-spatial
> table, stored on PostgreSQL. I've found this documentation
> (http://mapserver.org/mapfile/join.html) but i could make it work, so, can u
> guys help me looking at this configuration and tell me whats wrong?
>
> LAYER
>           NAME "join_shape"
>           TYPE POLYGON
>           STATUS DEFAULT
>           DATA "join_shapefile.shp"
>           CLASS
>                 NAME "Joined Shapes"
>                 STYLE
>                   OUTLINECOLOR 120 120 120
>                   COLOR 0 30 255
>                 END
>           END
>           TOLERANCE 20
>           JOIN
>                 NAME "teste"
>                 CONNECTION "dbname='testdb' host=GSERVER1 port=5432
> user='test'
> password='test' sslmode=disable"
>                 CONNECTIONTYPE ogr
>                 TABLE '"test"."nonspatial"'
>                 FROM "code"
>                 TO "code"
>                 TYPE ONE-TO-ONE
>           END
>         END # layer
>
> In this layer, i want to show only the geometrys in the shapefile
> "join_shapefile.shp" that have a CODE column that is the same the CODE
> column in the test.nonspatial table, stored on Postgre.
>
> That is possible?
>
> Thanks again
>
> Regards,
>
> Flavio Carmo



More information about the mapserver-users mailing list