Queries with mygis

Tony Frame jaframe at NET-YAN.COM
Thu Feb 10 08:34:43 PST 2005


I've set up a development / demo site that works ok displaying raster,
shapefile and mygis data (http://221.124.53.23/kdb200_geomon/)

When switching to query mode and clicking on one of the locations (green
spot on the map) I cannot get any data back from the feature data base table
(or any other useful data). The location data is plotting ok and I can
filter on any attribute from the feature table.

The map file, database structure and query template are given below. I would
be most grateful if anyone could offer any advise.

MAP FILE :

MAP
  NAME KDB200
  STATUS ON
  DEBUG ON
  SIZE 622 392
  EXTENT 833885.000 817250.000 837200.000 819500.000
  UNITS METERS
  SHAPEPATH "mapdata"
  IMAGECOLOR 220 220 220
  TEMPLATEPATTERN "kdb200"

  IMAGETYPE PNG24
#  IMAGETYPE PNG

  #
  # Start of symbol definitions
  #
  SYMBOL
    NAME 'circle'
    TYPE ELLIPSE
    POINTS 1 1 END
    FILLED TRUE
  END

  SYMBOL
    NAME 'star'
    TYPE VECTOR
    FILLED TRUE
    POINTS
      0 .375
      .35 .375
      .5 0
      .65 .375
      1 .375
      .75 .625
      .875 1
      .5 .75
      .125 1
      .25 .625
    END
  END

  #
  # Start of web interface definition
  #
  WEB
    LOG logs/mapserver.log
    HEADER mapdata/header.html
    TEMPLATE "set in index.html"
    FOOTER mapdata/footer.html
    MINSCALE 50
    MAXSCALE 50000
    IMAGEPATH "set in index.html"
    IMAGEURL "set in index.html"
  END

  #
  # Start of reference map
  #
  REFERENCE
    IMAGE "mapdata/dop5000_ref_align.png"
    EXTENT 833750.000 815000.000 837500.000 821000.000
    SIZE 106 170
    STATUS ON
    MINBOXSIZE 10
    MAXBOXSIZE 120
    COLOR -1 255 255
    OUTLINECOLOR 255 0 0
    MARKERSIZE 8
    MARKER 'star'
  END

  #
  # Start of legend
  #
  LEGEND
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE SMALL
      COLOR 0 0 89
    END
    STATUS ON
  END

  #
  # Start of scalebar
  #
  SCALEBAR
    IMAGECOLOR 117 132 179
    LABEL
      COLOR 255 255 255
      SIZE TINY
    END
    STYLE 1
    SIZE 100 2
    COLOR 255 255 255
    UNITS METERS
    INTERVALS 1
    TRANSPARENT FALSE
    STATUS ON
  END

  #
  # Start of layer definitions
  #
  LAYER
    NAME "base"
    TYPE raster
    STATUS on
    DEBUG on
    OFFSITE 252 252 252
    MINSCALE 500
    CLASS
      NAME 'Base Map'
      KEYIMAGE graphics/drgs_keyimage.png
    END
    TILEINDEX dop5000
  END

  LAYER
    NAME "site_outline"
    TYPE line
    STATUS on
    DEBUG on
    DATA "alignment"
    CLASS
      NAME "Site Outline"
      STYLE
        COLOR 255 0 0
      END
    END
  END

  LAYER
    NAME "instruments"
    TYPE point
    STATUS on
    DEBUG on
    CONNECTIONTYPE mygis
    CONNECTION "********:*******:*******:********:bin:"
    DATA "geometry from ms_instruments feature, ms_instruments_bin geometry"
    CLASS
      NAME "Instruments"
      STYLE
        COLOR 0 255 0
        SYMBOL 'circle'
        SIZE 6
      END
      TEMPLATE "mapdata/instruments.html"
    END
    HEADER "mapdata/instruments_header.html"
    FOOTER "mapdata/instruments_footer.html"
    TOLERANCE 5
  END

  LAYER
    NAME "instrument_ids"
    TYPE annotation
    STATUS on
    DEBUG on
    CONNECTIONTYPE mygis
    CONNECTION  "********:*******:*******:********:bin:"
    DATA "geometry from ms_instruments feature, ms_instruments_bin geometry"
    LABELITEM "txt"
    CLASSITEM "txt"
    LABELANGLEITEM "angle"
    LABELMAXSCALE 3000
    CLASS
      LABEL
        COLOR 0 0 255
#        SHADOWCOLOR 218 218 218
        SHADOWCOLOR 0 210 255
        SHADOWSIZE 1 1
        TYPE bitmap
        SIZE tiny
#        SIZE small
        POSITION cc
        ANTIALIAS true
        PARTIALS true
        BUFFER 1
      END
    END
  END

END # Map File


DATABASE STRUCTURE :

--
-- Table structure for table `ms_instruments`
--

CREATE TABLE `ms_instruments` (
  `id` int(11) NOT NULL auto_increment,
  `layer` int(11) NOT NULL default '0',
  `x1` double default NULL,
  `y1` double default NULL,
  `x2` double default NULL,
  `y2` double default NULL,
  `vertices` int(11) NOT NULL default '1',
  `angle` double default '0',
  `size` int(11) NOT NULL default '10',
  `txt` varchar(255) NOT NULL default '',
  `GID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `layer` (`layer`),
  KEY `turbo` (`x2`,`y2`,`x1`,`y1`)
) TYPE=MyISAM AUTO_INCREMENT=573 ;
--
-- Table structure for table `ms_instruments_bin`
--

CREATE TABLE `ms_instruments_bin` (
  `GID` int(11) NOT NULL default '0',
  `XMIN` double default NULL,
  `YMIN` double default NULL,
  `XMAX` double default NULL,
  `YMAX` double default NULL,
  `WKB_GEOMETRY` blob,
  KEY `GID` (`GID`),
  KEY `x` (`XMIN`,`YMIN`,`XMAX`,`YMAX`)
) TYPE=MyISAM;


QUERY TEMPLATE :
<p><b>Query Test</b></p>
<hr />
<p>mapserver version : [version]</p>
<p>query file path : [queryfile]</p>
<hr />
<p>Total number of results : [nr]</p>
<p>Number of layers returning results : [nl]</p>
<p>Total number of results within the current layer : [nlr]</p>
<p>Result number within all layers : [rn]</p>
<p>Result number within the current layer : [lrn]</p>
<p>Current layer name : [cl]</p>
<hr />
<p>DBASE feature.id : [ms_instruments.id] or [feature.id]</p>
<p>DBASE feature.txt : [ms_instruments.txt] or [feature.txt]</p>
<hr />


OUTPUT FROM QUERY :
Query Test

mapserver version : MapServer version 4.4.1 OUTPUT=GIF OUTPUT=PNG
OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=FREETYPE INPUT=EPPL7 INPUT=GDAL
INPUT=SHAPEFILE
query file path : /var/www/html/tmp/KDB2001108052962961.qy

Total number of results : 1
Number of layers returning results : 1
Total number of results within the current layer : 1
Result number within all layers : 1
Result number within the current layer : 0
Current layer name : instruments

DBASE feature.id : [ms_instruments.id] or [feature.id]
DBASE feature.txt : [ms_instruments.txt] or [feature.txt]


Many Thanks
Tony



More information about the MapServer-users mailing list