[Mapserver-users] PostgIS Layer & MapServer4

Jerod Clabaugh jclabaugh at mac.com
Fri Jul 23 16:33:05 EDT 2004


Steven:

Thanks but none of this worked.  Using a regular expression, not 
using an expression at all, using 'genus' as CLASSITEM in the layer. 
No errors, but no data shows up though there are 3 data points for 
'Aristolochia' in the database.

I have verified that you can name a geometry column something other 
than the classic 'the_geom' as well.  I have the GIST and oid indices 
on the table as well.

Any other ideas?  It either can't or isn't pulling the data out of the table.

Cheers,

Jerod


At 11:29 AM -0700 7/23/04, Steven Monai wrote:
>Jerod:
>
>Try removing the EXPRESSION line from your CLASS. If you suddenly see a lot
>of points appear, then you know the problem is in your EXPRESSION. Since
>your expression is just testing for equality, you could try setting the
>CLASSITEM in your LAYER to "genus" (but I see you already have) and then set
>the EXPRESSION to "Aristolochia".
>
>Another trick is to try using regular expression syntax in your EXPRESSION,
>e.g.:
>
>EXPRESSION /[Aa][Rr][Ii][Ss][Tt][Oo][Ll][Oo][Cc][Hh][Ii][Aa]/
>
>This should match any variation of Aristolochia, including "aristolochia",
>"ARISTOLOCHIA", and even "789 aRiStOLochIA123 ". If you want to exclude the
>last possibility, force the regular expression to match the entire field as
>follows:
>
>EXPRESSION /^[Aa][Rr][Ii][Ss][Tt][Oo][Ll][Oo][Cc][Hh][Ii][Aa]$/
>
>Finally, consider the possibility of leading or trailing whitespace in your
>genus field. If you want to match "  Aristolochia  ", then try something
>like the following:
>
>EXPRESSION /^\s*[Aa][Rr][Ii][Ss][Tt][Oo][Ll][Oo][Cc][Hh][Ii][Aa]\s*$/
>
>Good luck!
>
>HTH,
>-SM
>--
>============================================
>Steven Monai
>Database & Application Developer
>Spatial Mapping Ltd.
>484 2nd Avenue
>Prince George, BC, Canada
>V2L 2Z7
>
>http://www.spatialmapping.com
>mailto:stevem at spatialmapping.com
>phone: 250 564 1928
>fax: 250 564 0751
>============================================
>
>
>
>Jerod Clabaugh wrote:
>>
>>  Date: Thu, 22 Jul 2004 15:27:35 -0500
>>  To: mapserver-users at lists.gis.umn.edu
>>  From: Jerod Clabaugh <jclabaugh at mac.com>
>>  Subject: [Mapserver-users] PostgIS Layer & MapServer4
>>
>>  All:
>>
>>  I am having trouble with PostGIS and Mapserver, specifically the
>>  display of point data from a table that wasn't converted from a
>>  shapefile.
>>
>>  With my current set-up (MapServer 4.2.1, Postgres 7.4.1, PostGis 0.81
>>  on Mac OS X 10.3) I am able to view and query normal shape files,
>>  PostGIS layers (converted from shapefiles), Raster data, all just
>>  fine.
>>
>>  I am trying to display point data from a table of species.  I want to
>>  display all the points associated with genus records in the
>>  data_specimen table.  The geometry column for this table is called
>>  'bbox' and is a 2D Point using UTM coordinates.  The specs for the
>>  data_specimen and geometry_column tables are listed below as well as
>>  sample data records. Database permissions are working fine.  This
>>  table was not generated using shp2pgsql but was built from scratch,
>>  though the same data has been tested to display in standard shapefile
>>  input format (meaning I had it working as a shapefile first, then
>>  decided to build a postgres table with just the point data and try it
>>  as a postgis layer...)
>>
>>  When I use the layer in the map file below, I get no errors, I just
>>  get no points showing on the map eventhough the 'Aristolochia' class
>>  shows up in the legend. So I am guessing its either a query problem
>>  in the map file or something wrong with the geometry column in the
>>  data_specimen table. Nothing shows up on the map, with or without the
>>  expression in the CLASS below.  I have even tried the below
>>  expression with and without capital letters to no avail.
>>
>>  Does anyone know what I am doing wrong here?
>>
>>  Cheers,
>>
>>  Jerod Clabaugh
>>  Belizze Biodiversity Mapping Service
>>  http://www.iwlearn.net/belize
>>
>>  =-=-=-=
>>  Map File layer
>>
>>  LAYER
>>     CONNECTIONTYPE postgis
>  >     NAME aristo1
>>      CONNECTION "user=jerod dbname=biodiversity host=localhost"
>>      DATA "bbox from data_specimen"
>>      TYPE POINT
>>      STATUS ON
>>      DUMP TRUE
>>
>>      TEMPLATE "aristolochia.html"
>>      HEADER "aristolochia_header.html"
>>      FOOTER "aristolochia_footer.html"
>>      TOLERANCE 5
>>       CLASSITEM "genus"
>>        CLASS
>>         NAME "Aristolochia sp."
>>         EXPRESSION ('[genus]' eq 'Aristolochia')
>>         OUTLINECOLOR 75 75 75
>>         COLOR 39 173 33
>>         SYMBOL "Triangle"
>>         SIZE 5
>>        END
>>    END
>>    =-=-=-=
>>
>>    =-=-=-=
>>  PostgreSQL Database Tables (data_specimen)
>>
>>  TABLE data_specimen (
>>       specimen_id serial NOT NULL,
>>       scientificname character varying(50),
>>       kingdom integer,
>>       phylum integer,
>>       class integer,
>>       order character varying(40),
>>       family character varying(40),
>>       genus character varying(40),
>>       ../ truncated for brevity
>>       bbox geometry,
>>       CONSTRAINT "$1" CHECK ((srid(bbox) = 26716)),
>>       CONSTRAINT "$2" CHECK (((geometrytype(bbox) = 'POINT'::text) OR
>>  (bbox IS NULL)))
>>  );
>>
>>  ==> bbox geometry column data entered as SRID=XXXXX;POINT(XXXXX XXXXX)
>>
>>  Example:		SRID=26716;POINT( 1797821 298364)
>>
>>  ==> There is a GIST index on 'bbox' column and oid index on entire
>>  'data_specimen' table.
>>
>>  Geometry Table
>>
>>  TABLE geometry_columns (
>>       f_table_catalog character varying(256) NOT NULL,
>>       f_table_schema character varying(256) NOT NULL,
>>       f_table_name character varying(256) NOT NULL,
>>       f_geometry_column character varying(256) NOT NULL,
>>       coord_dimension integer NOT NULL,
>>       srid integer NOT NULL,
>>       "type" character varying(30) NOT NULL,
>>       attrelid oid,
>>       varattnum integer,
>>       stats histogram2d
>>  );
>>
>>  Data Record for table:
>>
>>  public	data_specimen	bbox	2	26716	POINT
>>  33744	63	\N




More information about the mapserver-users mailing list