OGR join between shapefile and DBF

Frank Warmerdam warmerdam at POBOX.COM
Mon Dec 19 22:52:40 EST 2005


On 12/19/05, Delfos, Jacob <jacob.delfos at maunsell.com> wrote:
>
>
> Hi List,
>
> I need to do a join between a shapefile and a DBF. I have checked my syntax
> thoroughly against
> http://www.remotesensing.org/gdal/ogr/ogr_sql.html, but I
> must be missing something simple….
>
> My syntax is:
>
>  CONNECTIONTYPE OGR
>  CONNECTION "c:/data/allGP_MGA94.shp"
>  DATA "SELECT a.*,b.* FROM allGP_MGA94 a LEFT JOIN 'c:/data/descr.dbf' b ON
> a.CODE=b.CODE"

Jacob,

I think you need
... LEFT JOIN 'c:/data/descr.dbf'.descr b ON a.CODE = b.CODE"

The 'c:/data/descr.dbf' indicates the datasource, but you still need
to select the table from within that datasource.  Of course, you know
there is only one table (the descr table) in that datasource, but OGR
demands to be told that directly.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent


More information about the mapserver-users mailing list