<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=522425420-24022006>I thought of a way to rephrase/reask the question I am
now stuck with.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=522425420-24022006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=522425420-24022006>I was reading through my MapServer book ('Beginning
MapServer') on Queries and Joins, to see if mr. Kropla had any
suggestions.</SPAN></FONT></DIV><FONT><SPAN class=522425420-24022006>
<DIV dir=ltr align=left><BR><FONT face=Arial color=#0000ff size=2>He wrote that,
in doing regular MapServer JOINs, if you want to have a JOIN produce one-to-many
results, you need to specify a template for the JOIN to format each record
beyond the first one that is returned into the final HTML result. Otherwise,
only the first record will be returned.</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left></SPAN></FONT><SPAN class=522425420-24022006><FONT
face=Arial color=#0000ff size=2>How does this principal apply to the GML
generated by GetFeatureInfo requests? Obviously we don't need to define a valid
HTML template to output the data... but how do GetFeatureInfo requests deal with
one-to-many situations, and does the output format make any difference on how it
is handled? If I have my GetFeatureInfo request return HTML rather than GML, can
I use templates and have it handle a one-to-many arrangement
succesfully?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=522425420-24022006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=522425420-24022006><FONT face=Arial
color=#0000ff size=2>Thoughts, ideas?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=522425420-24022006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=522425420-24022006><FONT face=Arial
color=#0000ff size=2>Thanks!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=522425420-24022006><FONT face=Arial
color=#0000ff size=2>Nick Floersch</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Nick Floersch <BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>
<P><FONT face=Arial size=2><SPAN class=847122519-24022006>Hello Paul,
Steve, Jeff, and other MapServer users,</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN class=847122519-24022006>Thanks for the
replies. </SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN class=847122519-24022006>By adding an
appropriate 'using unique' clause to my DATA entry in the mapfile, I got my
layer based on a view to draw. I am glad that views can be
used.</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN class=847122519-24022006></SPAN></FONT></P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>There is a trick that
had to be realized. At first, I put in a 'using unique the_geom' clause which of
course assumed that my geometry field was unique. But, because the source of my
layer is a view (or a subquery in its previous life) which has a left outer join
in it, the geometry column is far from unique. This is what I thought I wanted -
to generate a layer which had multiple points at the same locations with
different attributes... a series of attributes for a given point location. In my
case, the idea is that the feature point can have images associated with it from
a table of images. So, a left outer join on that table gives me a layer with
duplicate points that have different values for the image name
attribute.</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>Anyway, initially,
after I realized that 'the_geom' is not a unique field for me, I switched to
using a field that is unique in my view, and things came to life. My
GetFeatureInfo requests suddenly started returning attributes, and life looked
good.</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>But no. Not perfect.
What I had in mind has not worked quite right - my GetFeatureInfo tool clicks on
a point feature, and I get a list of attributes, by layer, for each feature
under the pointer. Except, not all the duplicate point features are returned.
The best I can think to describe it is this: I have a stack of points all
defined in the same layer, and I click on the stack, and only the top point in
that stack is returned. I was hoping it would return data for each of those
points in the stack.</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>So, is there some way
I can make this work better? Am I totally barking up the wrong tree? I have one
GetFeatureInfo request that needs to return multiple values for the same field
of a given feature, based on a join...</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial
size=2></FONT></SPAN> </P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>Thanks for any
thoughts and help!</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial size=2>Nick
Floersch</FONT></SPAN></P>
<P><SPAN class=847122519-24022006><FONT face=Arial
size=2>-------</FONT></SPAN></P>
<P><FONT face=Arial size=2>If you have the option, please don't use oid, use a
primary key (like the 'gid' created by shp2pgsql) as your unique key. Primary
keys already have indexes, oids do not. Primary keys show up automatically in a
"select *" query, oids do not. oids are </FONT></P>
<P><FONT face=Arial size=2>deprecated in pgsql and not available by default in
pgsql 8.1. </FONT></P>
<P><FONT face=Arial size=2>Basically oid is now a deadend, and we need to start
erasing all uses of them.</FONT></P>
<P><FONT face=Arial size=2>P</FONT></P>
<P><FONT face=Arial size=2><SPAN
class=847122519-24022006>-------</SPAN></FONT></P>
<P><FONT face=Arial size=2>Nick,</FONT></P>
<P><FONT face=Arial size=2>I seem to remember a post from one of the postGIS
guys awile back the you needed to add an entry in the geometry_columns table for
the view.</FONT></P>
<P><FONT face=Arial size=2>-Steve W.</FONT></P>
<P><FONT face=Arial size=2><SPAN
class=847122519-24022006>--------</SPAN></FONT></P>
<P><FONT face=Arial size=2>This is on my "figure out some day myself" list, too.
I'm doing the view thing right now, but I'd like to not have to create views for
everything.</FONT></P>
<P><FONT face=Arial size=2>> The only thing I can think of is... does the
PostGIS connector require </FONT></P>
<P><FONT face=Arial size=2>> the table to have OIDs? It looks that
way.</FONT></P>
<P><FONT face=Arial size=2>Yes. It needs some unique field in order to randomly
access an individual rows, it just so happens that OID is a convenient way to
get that in most cases. You can also specify your own unique column name with
"using unique <column name>" if your view doesn't have an OID column but
you have some other key you can use. I just pull in the OID from the main
geometry-containing table when I define the view.</FONT></P>
<P><FONT face=Arial size=2>--</FONT></P>
<P><FONT face=Arial size=2>Jeff Hoffmann</FONT></P></DIV></BODY></HTML>