mapfile join

Richard Greenwood richard.greenwood at GMAIL.COM
Thu Jan 27 16:24:33 PST 2005


On Wed, 26 Jan 2005 13:01:21 +0200, John Spotten
<John.Spotten at capetown.gov.za> wrote:
>
>
> Hi,
>
> looking for some sample code showing a join use successfully. get a parsing
> error when using it under class.  put it under layer, no parsing error but
> then  XP tells me mapserv.exe has found a problem and is closing down.
> using mapserver 4.4.0 on XP and I get error on html page msDBFJoinConnect():
> Unable to access file. (c:\ms4w\apps\mapserver_demos\ct\data\join.dbf).  any
> clues.    can i use a dbf file.
>
> I am trying to join to a shape file a seperate independent dbf file on a
> common field that is indexed in the shape file.  the field is text type.
>
> I take it it can be accessed using the [join_<join_name>] template in a
> query template file for a one to many join where [join_<join_name>] gets
> replaced with the join header template and footer files and I assume that
> the template within the query template file is
> [<join_name>_<dbf_field_name>].
>
> Is it possible to refer to the qlayer as [join_<join_name>]?
>
> bye
> john
>
> John Spotten
> Transport Modeller/GIS Developer
> Directorate of Transport, Roads and Stormwater
> City of Cape Town
> Tel : +27 21 4067325
> Fax : +27 21 4186989
> Cell : +27 846678901
> Email : john.spotten at capetown.gov.za
> Web : www.capetown.gov.za
>  <<John Spotten.vcf>>
>

I was hoping somebody else would respond to this with a better
example, but here's an sloppy example that I dug out:

LAYER
        NAME  "join_query"
        GROUP "ownership"
        TYPE QUERY
        STATUS ON
        DATA  "/Tc/temp/parcel_region"
        HEADER "attribute_header.html"
        FOOTER "attribute_footer.html"
        TEMPLATE "attribute_display.html"
#       FILTERITEM "PID"
#       FILTER  /./             # regular expression - match anything
        JOIN    # JOIN no longer lives inside of CLASS or inside a QUERY object
                NAME "test"
                TABLE "/Tc/temp/assessor2.DBF"
                FROM PIDP
                TO      PIDA
                TYPE single # multiple
        #       TEMPLATE  cat.html      # required only for one-to-many joins
        END # of JOIN Object
END  # LAYER "join_region"

Yes, you can use a dbf file. In your TABLE clause, try replacing your
"\" with "/" and/or qouting the string.

HTH
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the MapServer-users mailing list