Using JOIN for querying
Manfred Meier
m.meier at SPIEKERMANN.DE
Wed Aug 30 06:49:23 PDT 2006
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