Join shape and dbms data: OGR?

Michael Schulz mschulz at WEBGIS.DE
Tue Nov 16 04:16:07 EST 2004


Hi,

yes this is working, i haven't tried regexps but string and logical expressions are working and
mapserver is classifying the shapefile according to the joined attributes. fnpf.shp only has the
relation key PID in its .dbf attribute table.

   ...
     CONNECTIONTYPE OGR
     CONNECTION "c:\mstest\data\fnpf.shp"  # shapefile holding only geometry and PID in .dbf
     DATA "SELECT * FROM fnpf LEFT JOIN 'ODBC:fnp'.fnp ON fnpf.PID=fnp.PID"
     CLASS
       EXPRESSION ([AZJAHR] = 0)
       STYLE
         COLOR 255 0 150
       END
     END
     CLASS
       EXPRESSION ([AZJAHR] = 1)
       STYLE
         COLOR 255 150 0
       END
     END
     CLASS
       EXPRESSION ([AZJAHR] > 1)
       STYLE
         COLOR 0 150 150
       END
     END
   ...

Cheers, Michael



Emil Zegers schrieb:
> Hello Michael,
>
> I have a question for you about this approach: when using this kind of join were you able to classify data based on the joined attributes and display this in the map image?
>
> I'm asking this because with normal join operation it is not possible to create thematic maps based on the joined attributes.
>
> If classifcation works based on this approach the enhancement request I put in bugzilla (http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=674) can be closed.
>
> I would be very happy if classifying on joined attributes works this way (had no time to test this approach yet).
>
> Regards,
>
> Emil Zegers
>
>
> Hi Frank,
>
> thanks for your answer. It is working perfectly now.
>
> For the moment it is only one table i want to join to the geometry of the shp-file, so at first
> sight performance is good, but i will play with the indexes a little.
>
> For all who have to use a similar approach here's a mapfile snipplet:
>
>    LAYER
>      ...
>      CONNECTIONTYPE OGR
>      CONNECTION "c:\mstest\data\fnpf.shp"  # shapefile holding only geometry and PID in .dbf
>      DATA "SELECT * FROM fnpf LEFT JOIN 'ODBC:fnp'.fnp ON fnpf.PID=fnp.PID"
>       # join to systemDSN fnp (here msaccess-db "fnp.mdb" with table fnp) on attribute PID,
>       # now all fields of the db are also accessible for mapserver, e.g. "AZJAHR"
>      LABELITEM "AZJAHR"
>      ...
>    END
>
> Thanks, Michael
>
>

--
-----------------------------------------------------------
Michael Schulz                                in medias res
Dipl.-Geologe                              Gesellschaft für
                                 Informationstechnologie mbH
                                      In den Weihermatten 66
                                             79108 Freiburg
                                      0761 55695-95 (Fax 96)
mschulz at webgis.de              www.webgis.de/www.zopecms.de



More information about the mapserver-users mailing list