[Fwd: RE: Using JOIN for querying]

Manfred Meier m.meier at SPIEKERMANN.DE
Fri Sep 1 00:24:56 EDT 2006


Hi Juan Carlos,

thank you very much for your answer! Since this question was originally 
from Maricris I will forward your answer to the mapserver users list.

Manfred


-------- Ursprüngliche Nachricht --------
Betreff: RE: Using JOIN for querying
Datum: Thu, 31 Aug 2006 13:50:43 -0300
Von: Fuchs Juan Carlos <jfuch at indec.mecon.gov.ar>
An: 'Manfred Meier' <m.meier at SPIEKERMANN.DE>

Hi Manfred:
about you statment
...the
> msQueryByPoint message means that I had forgotten to indicate a
> template file in my CLASS statement right? 
it also means that something goes wrong :)
i suggest two things
first
>> >  JOIN
>> >        NAME "reg_join"
>> >        CONNECTIONTYPE CSV
>> >        TABLE "lgu_DB_DACCESS_PROV.csv"
>> >        FROM "Place_ID"
>> >        TO "1" here goes the name of the column you have as target.
>> >        TEMPLATE "reg_bndary 2000_dbf.html" try avoiding the space
between bndary and 2000
>> >     END #join

BTW
when you say:
Actually the error is what I'm confused about. As far as I know, the
> msQueryByPoint message means that I had forgotten to indicate a
> template file in my CLASS statement right? But as far as I read the
> manual, the JOIN statement's format does not need the CLASS part, one
> just need to add TEMPLATE "<name of template file>" in the JOIN part.
> In fact if I insert the following in the JOIN part as such:
> (...)
> JOIN
>    CONNECTIONTYPE CSV
>    (...)
>    CLASS
>          TEMPLATE "reg_bndary 2000_dbf.html"
>     END
> END
> (...)
> 
> It returns with the following error:
>      loadJoin(): Unknown identifier. Parsing error near (CLASS):(line 164)
> 
> Oh and yes, the msQuerybyPoint message only appears when I add the
> JOIN in my mapfile.
keep in mind that the "JOIN" only takes place if you trigger a QUERY
so the layer has to be "queryable"
say
LAYER
     NAME "whateveryounamethelayer"
     TYPE QUERY
     ...

this gives you the possibility to control when you trigger the QUERY
just changing the status from OFF to ON

	
"nicht is so einfach, als wenn man weiss wie es geht;
dannach, wird es uninteresant. :)

Hals und Beinbruch, Manfred
auf wiedersehn...
JC.
-----Mensaje original-----
De: Manfred Meier [mailto:m.meier at SPIEKERMANN.DE]
Enviado el: Miércoles, 30 de Agosto de 2006 10:49 a.m.
Asunto: Re: Using JOIN for querying


Hi,

here is a last+1 try:

You mentioned the template file: On umn.mapserver.ch I found this example:

LAYER
NAME "Liegenschaften"
STATUS ON
DATA "data/Liegenschaften"
TYPE LINE
HEADER "NUMMER FLAECHE NAME PLZ ORT"
   JOIN
     NAME "Eigentümer"
     TABLE "data/eigentuemer.dbf"
     FROM NUMMER
     TO NR
     TYPE multiple
     TEMPLATE eigentuemer.htm
   END
   CLASS
     COLOR 0 0 0
     SYMBOL "continue"
     SIZE 2
     TEMPLATE liegenschaften.htm
   END
END

Here are two template files. The Layer has a template file in his own
CLASS Section. Is your mapfile analog to this file?

Manfred





cris ricana schrieb:

> Thanks for replying, Manfred.
> Here are some replies to your question:
> 
>> I do not know how to use JOIN. But since nobody replied to your
>> question, perhaps you can add information, if the test you made, give
>> you the correct result when you do !!not!! use the JOIN.
>>
> Yes, everything works when I don't use JOIN. That is, if I use only
> the shapefile (I mean that the whole set, including the .shp, .dbf and
> .shx files), and use in the query only those  data specific in the dbf
> of the shapefile.
> 
> 
>> If I understand right, then JOIN adds some data but no spatial
>> information. So at the first sight it seems unlikely that the result of
>> msQueryByPoint is related to a JOIN.
>>
>> So does this message appear only when you add the JOIN to the mapfile?
> 
> 
> The data (in form of csv files) I'm adding do not have spatial
> information, if you mean by spatial information as something like the
> lat/lon of a region, for example (I'm dealing with areal data, by the
> way). In fact it only contains additional socioeconomic statistics of
> these region. The dbf file of the shapefiles contains the spatial
> information of these regions, and I'm trying to add more info on these
> places via JOIN and only during query requests, instead of creating a
> very large dbf with all the info in them.
> 
> Actually the error is what I'm confused about. As far as I know, the
> msQueryByPoint message means that I had forgotten to indicate a
> template file in my CLASS statement right? But as far as I read the
> manual, the JOIN statement's format does not need the CLASS part, one
> just need to add TEMPLATE "<name of template file>" in the JOIN part.
> In fact if I insert the following in the JOIN part as such:
> (...)
> JOIN
>    CONNECTIONTYPE CSV
>    (...)
>    CLASS
>          TEMPLATE "reg_bndary 2000_dbf.html"
>     END
> END
> (...)
> 
> It returns with the following error:
>      loadJoin(): Unknown identifier. Parsing error near (CLASS):(line 164)
> 
> Oh and yes, the msQuerybyPoint message only appears when I add the
> JOIN in my mapfile.
> 
> 
> Maricris
> 
> 
> 
> 
> On 8/30/06, Manfred Meier <m.meier at spiekermann.de> wrote:
> 
>> Hi,
>>
>> I do not know how to use JOIN. But since nobody replied to your
>> question, perhaps you can add information, if the test you made, give
>> you the correct result when you do !!not!! use the JOIN.
>>
>> If I understand right, then JOIN adds some data but no spatial
>> information. So at the first sight it seems unlikely that the result of
>> msQueryByPoint is related to a JOIN.
>>
>> So does this message appear only when you add the JOIN to the mapfile?
>>
>> Manfred
>>
>>
>>
>> cris ricana schrieb:
>> > Hello!
>> >
>> > I'd like some help regarding my use of JOIN in my mapserver setup. I'm
>> > using two sets of data, a base shapefile ("reg_bndary") containing
>> > basically place information and system-generated csv files containing
>> > all the relevant information regarding these places in the shapefiles.
>> > Both have a common field called Place_ID to be used for the join. I
>> > was planning to use these csv in times when the users want to query
>> > for detailed information on these places. My map file looks like this
>> > (the JOIN part is near the end):
>> >
>> > NAME reg_bndary2000.map
>> > SIZE 600 600
>> > EXTENT 114.03 3.8315 131.33 21.1585
>> > SHAPEPATH "data"
>> > IMAGETYPE PNG
>> > UNITS meters
>> >
>> > WEB
>> >  TEMPLATE 'reg_bndary2000.html'
>> > #  IMAGEPATH '/home/mis/DIRP/maps/'
>> > #  IMAGEURL 'home/mis/DIRP/maps/'
>> >  IMAGEPATH '/home/yronald/htdocs/maps/test_map/maps/'
>> >  IMAGEURL '/test_map/maps/'
>> > END  #WEB
>> >
>> > QUERYMAP
>> >  SIZE 600 600
>> >  STATUS ON
>> >  STYLE SELECTED
>> >  COLOR 255 0 0
>> > END
>> > (...)
>> >  LAYER
>> >  NAME CY_2000
>> >  TYPE polygon
>> >  STATUS ON
>> >  DATA reg_bndary
>> >  CLASSITEM COUNT
>> >  LABELITEM REGION
>> >   (...)
>> >  HEADER "reg_bndary2000_header.html"
>> >  FOOTER "reg_bndary2000_footer.html"
>> >
>> >  JOIN
>> >        NAME "reg_join"
>> >        CONNECTIONTYPE CSV
>> >        TABLE "lgu_DB_DACCESS_PROV.csv"
>> >        FROM "Place_ID"
>> >        TO "1"
>> >        TEMPLATE "reg_bndary 2000_dbf.html"
>> >     END #join
>> > END  # LAYER
>> > END  # MAPFILE
>> >
>> > The template file used for , "reg_bndary 2000_dbf.html", contains
>> > simply the following:
>> > [reg_join_REGION]<br>
>> > [reg_join_PLACE]
>> >
>> > When when I test this, I get the following error:
>> >
>> >       msQueryByPoint(): Search returned no results. No matching
>> > record(s) found.
>> >
>> > Can somebody help me tell me what is wrong in my setup?
>> >
>> >
>> > Thanks!
>> > Maricris
>> >
>>
>>
> 



More information about the mapserver-users mailing list