Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have been trying to configure a QUERY using mapserver. Below is the mapfile:

 MAP
 NAME "Fourth"                         
 UNITS dd                              
 EXTENT 58.206740 5.756104 104.793418 33.644106        
 SIZE 640 320                          
 IMAGECOLOR 200 225 255                
 IMAGETYPE gif                        

 FONTSET "C:\ms4w\Apache\htdocs\fontset.txt" # pointers to fonts


WEB
# A header/footer defined in a web object is displayed 
# before/after any individual query response is made. 
# It is displayed only once. 
#
HEADER "C:/ms4w/Apache/htdocs/xxx/map/fourth_web_header.html"
FOOTER "C:/ms4w/Apache/htdocs/xxx/map/fourth_web_footer.html"

TEMPLATE "C:/ms4w/Apache/htdocs/xxx/map/fourth.html"          
IMAGEPATH "C:/ms4w/Apache/htdocs/tmp/"
IMAGEURL "/tmp/"                        
  END


LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 14 12
LABEL
  TYPE BITMAP
  SIZE SMALL
  COLOR 0 0 89
  END
 END

QUERYMAP                     
STATUS on                # draw query map
STYLE hilite             # highlight selected feature
COLOR 255 255 0          # in yellow
SIZE 320 160
END

SYMBOL

NAME "circle"
TYPE ellipse # Type of symbol

POINTS
1 1
END # end of POINTS

FILLED true
END 


LAYER
NAME 'growth_1'
TYPE POINT
DUMP true
TEMPLATE fooOnlyForWMSGetFeatureInfo
# A header or footer defined at the layer level is displayed
# if that layer is a query layer. It is displayed only once.
#
HEADER "C:/ms4w/Apache/htdocs/xxx/map/fourth_cities_header.html"
FOOTER "C:/ms4w/Apache/htdocs/xxx/map/fourth_cities_footer.html"

TOLERANCE 1             # must be within 1 tolerance unit
TOLERANCEUNITS miles    # units for tolerance values is miles

EXTENT 58.206740 5.756104 104.793418 33.644106
CONNECTIONTYPE postgis
CONNECTION "dbname='postgis' host=localhost port=5432 user='postgres' password='xxxxxxx' sslmode=disable"
DATA 'the_geom FROM "growth_1" USING srid=4326'
METADATA
  'ows_title' 'growth_1'
END
STATUS ON
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'
END


CLASSITEM 'growth_scale'
CLASS
  NAME "growth_scale = BAD" 
  EXPRESSION "BAD" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 242 115 240
   END
END
CLASS
  NAME "growth_scale = EXCELLENT" 
  EXPRESSION "EXCELLENT" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 53 116 77
   END
END
CLASS
  NAME "growth_scale = FAIR" 
  EXPRESSION "FAIR" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 92 200 4
   END
END
CLASS
  NAME "growth_scale = GOOD" 
  EXPRESSION "GOOD" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 94 8 202
   END
END
CLASS
  NAME "growth_scale = MARGINALLY BAD" 
  EXPRESSION "MARGINALLY BAD" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 252 63 172
   END
END
CLASS
  NAME "growth_scale = NO DATA" 
  EXPRESSION "NO DATA" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 22 79 25
   END
END
CLASS
  NAME "growth_scale = POOR" 
  EXPRESSION "POOR" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 86 98 176
   END
END
CLASS
  NAME "growth_scale = VERY GOOD" 
  EXPRESSION "VERY GOOD" 
   STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 189 72 76
   END


CLASS
    # A template defined at the class level is used to display
    # the results for each reponse to a query. If a result set
    # contains N, then the template will be used N times.
    #
    TEMPLATE "C:/ms4w/Apache/htdocs/xxx/map/fourth_cities_query.html"
    STYLE
        COLOR 0 0 0     # symbol color is black
    END

END


END 

END 

But then when I go the query mode I get the following error:

msQueryByPoint(): Search returned no results. No matching record(s) found.

Any idea on why such an error message

Now from today morning I get this window but the attribute is not populated. enter image description here

The following is the query template

  <!--Mapserver Template-->
  <font size+1><b>Layer:growth_1</b></font>
  <tr><td>[lrn]</td>
  <td>[code]</td>
  <td>[address]</td>
  <td>[latitude]</td>
  <td>[longitude]</td>
  <th>bbbbb</th>
  <th>scale</th>
  <th>oid</th></tr>
share|improve this question

2 Answers 2

First of all a few doc pointers

The mapserver documentation addresses this error at:

http://mapserver.org/errors.html#msreturnpage-web-application-error-malformed-template-name

For an explanation of url templates see this doc.

Answer

It seems like you are now a GetFeatureInfo query and using a fooOnlyForWmsGetFeatureInfo template which is missing the proper extension.

The list of allowed extensions is documented in the code here:

https://github.com/mapserver/mapserver/blob/master/mapserver.h#L245

So basically you have edit the mapfile so that this section:

  LAYER
  NAME 'growth_1'
  TYPE POINT
  DUMP true
  TEMPLATE fooOnlyForWMSGetFeatureInfo

becomes:

  LAYER
  NAME 'growth_1'
  TYPE POINT
  DUMP true
  TEMPLATE path/to/your_template.html

Final note

BTW, your template contains invalid html:

<font size+1>

should be:

<font size="+1">
share|improve this answer

I assume something is wrong with your query template. Fields defined in the query template do not exist in the table maybe? Have a look at this mapserver tutorial which should help

share|improve this answer
    
I have added the query template above –  Senthil Apr 27 '12 at 9:02
    
Try to put your last 3 attributes in square brackets –  mapoholic Apr 27 '12 at 14:21
    
I did try with the square brackets for the last three attributes , but still no change. –  Senthil Apr 30 '12 at 4:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.