AW: [mapserver-users] shp/dbf file's name
arnd.wippermann at web.de
Sat Aug 21 17:37:24 EDT 2010
Haven't thought, that it is possible to style by joined fields. But your
example works. First I had some trouble to get the right syntax, and that
causes in MapServer crashes. But finally it worked! (Mapserver 5.2, 5.6.1)
With connection to shape and dbase folder
CONNECTION "C:\mypath\BRD" #path were the data resides
DATA "SELECT * FROM DEU_adm1 LEFT JOIN DEU_adm1_EDICHTE ON DEU_adm1.HASC_1 =
With connection to shape and dbase by fullpath
DATA "SELECT * FROM DEU_adm1 LEFT JOIN 'C:\mypath\BRD\EDICHTE.dbf'.EDICHTE
ON DEU_adm1.HASC_1 = EDICHTE.HASC_1"
But now I have the problem, that WMS GetFeatureInfo returns no results. The
queried features are the states of Germany, so I can't miss them. Can you
confirm that it should work.
Von: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von Johan
Gesendet: Freitag, 20. August 2010 18:22
An: Clément MONIER
Cc: mapserver-users at lists.osgeo.org
Betreff: RE: [mapserver-users] shp/dbf file's name
If I understand your question correctly you are attempting to do something
similar to what I have where I am coloring polygons in a shapefile based on
a numeric value stored in a frequently-updated CSV-file. As long as you have
a field in both files that you can join on it ought to work.
I used the OGR connection type as briefly discussed in a previous post,
This is the type of syntax you appear to need:
CONNECTION "/var/www/demodata/a.shp" //path to the shapefile DATA "SELECT
a.ID, b.NAME FROM a LEFT JOIN '/var/www/demodata/b.dbf'.b ON a.ID=b.ID"
In my case the LAYER section in the mapfile looks like this, where "FIPS" is
the field I join the files on.
DATA "SELECT * FROM myshapefile LEFT JOIN
'full_path_to_file_named_bwa.csv'.bwa ON myshapefile.FIPS = bwa.FIPS"
EXPRESSION ([PercentageOut] > 0 AND [PercentageOut] <= 10)
NAME "0 - 10%"
COLOR 56 168 0
(continues with several more classes).
Hope that helps,
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
> bounces at lists.osgeo.org] On Behalf Of Clément MONIER
> Sent: Friday, August 20, 2010 9:06 AM
> To: P Kishor
> Cc: mapserver-users at lists.osgeo.org
> Subject: RE: [mapserver-users] shp/dbf file's name
> > How would MapServer know which row in your external dbf file matches
> which row (aka feature) in your ShapeFile?
> > What if the external dbf file doesn't have the same number of rows
> > as
> the number of features in your ShapeFile?
> not really a problem as I'm able to generate dbf files with records in
> exactly same number and order as inside shp.
> > The dbf format is pretty primitive. Your best bet is to actually add
> > to
> your ShapeFile the data that is now in your external file. > It will
> also likely be faster.
> That's precisely what I can't do any more, since I'd like to join
> various kinds of time-related attributes on very static geometries.
> -----Message d'origine-----
> De : P Kishor [mailto:punk.kish at gmail.com] Envoyé : vendredi 20 août
> 2010 15:42 À : Clément MONIER Cc : mapserver-users at lists.osgeo.org
> Objet : Re: [mapserver-users] shp/dbf file's name
> On Fri, Aug 20, 2010 at 8:22 AM, Clément MONIER
> <Clement.MONIER at v-trafic.com> wrote:
> > Hi,
> > I would like to know if it's possible to draw geometries from a shp
> > file
> > according to attributes from a dbf
> > but with 2 files named differently.
> > For instance :
> > LAYER
> > NAME layer1
> > DATA shapefile1.shp
> > CLASS
> > EXPRESSION ([col1]=1)
> > STYLE
> > END
> > END
> > END
> > Where col1 is a field inside a file storing attributes
> > (dbf/csv/txt/.)
> > not named shapefile1.dbf
> How would MapServer know which row in your external dbf file matches
> which row (aka feature) in your ShapeFile? What if the external dbf
> file doesn't have the same number of rows as the number of features in
> your ShapeFile?
> The dbf format is pretty primitive. Your best bet is to actually add
> to your ShapeFile the data that is now in your external file. It will
> also likely be faster.
> > I already tried to use the JOIN option but I think it's
> > inappropriate
> for my
> > purpose
> > since "You cannot use joins to affect the look of a map"
> > (http://mapserver.org/mapfile/join.html)
> > Thanks for your help !
> > Clément
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> Puneet Kishor http://www.punkish.org
> Carbon Model http://carbonmodel.org
> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
> Science Commons Fellow,
> Nelson Institute, UW-Madison http://www.nelson.wisc.edu
> - Assertions are politics; backing up assertions with evidence is
> = _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
mapserver-users mailing list
mapserver-users at lists.osgeo.org
More information about the mapserver-users