[Geomoose-users] Using Identify with Postgis layer

Stephen Knox stephenknox73 at gmail.com
Mon May 2 09:56:00 EDT 2011


Sorry,

Never query in haste! I was just using a generic field name, but the below
covers everything. It's just data for playing around with really, from a
tutorial.

Here is the mapfile:

MAP
  IMAGETYPE      PNG
  EXTENT         0 0 2000000 2000000
  SIZE           1000 1000
  IMAGECOLOR     255 255 255

  PROJECTION
    "init=epsg:3005"
  END

LAYER
CONNECTIONTYPE postgis
NAME "voting"
CONNECTION "user=**** password=**** dbname=Unit5 host=localhost"
DATA "the_geom from (SELECT gid, the_geom, vtotal::REAL / vregist::REAL AS
percent FROM bc_voting_areas WHERE vregist > 0) as foo using srid=3005 using
unique gid"
STATUS ON
TYPE POLYGON
  METADATA
  identify_record "identify_voting.html"
  END
CLASS
   COLOR 200 0 0
   EXPRESSION ([percent] > 0.7)
 END
CLASS
   COLOR 200 200 0
   EXPRESSION ([percent] < 0.7)
 END

END

END

The identify_voting.html definition:

<!-- MapServer Template -->
<tr bgcolor="#DEE5EB"><td colspan="2"><b><u>Voting Districts</u></b></tr>
<tr>
<td align="right"><b>DistName:</b></td>
<td>[riding]</td>
</tr>
<tr>
<td align="right"><b>Number of Voters:</b></td>
<td>[number]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

and the postgis table definition:

CREATE TABLE bc_voting_areas
(
  gid serial NOT NULL,
  code character varying(3),
  id character varying(8),
  riding character varying(29),
  region character varying(29),
  "number" character varying(4),
  ndp numeric(11,0),
  liberal numeric(11,0),
  green numeric(11,0),
  unity numeric(11,0),
  vtotal numeric(11,0),
  vreject numeric(11,0),
  vregist numeric(11,0),
  the_geom geometry,
  CONSTRAINT bc_voting_areas_pkey PRIMARY KEY (gid),
  CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 3005)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE bc_voting_areas OWNER TO postgres;

CREATE INDEX bc_voting_areas_geom_idx
  ON bc_voting_areas
  USING gist
  (the_geom);

CREATE INDEX bc_voting_areas_the_geom_gist
  ON bc_voting_areas
  USING gist
  (the_geom);



On Mon, May 2, 2011 at 1:31 PM, Dan Little <danlittle at yahoo.com> wrote:

> Is "feature_name" a field in your table?
>
> Any chance we can see the definition of the table, the mapfile, and
> template that you are using?
>
> ------------------------------
> *From:* Stephen Knox <stephenknox73 at gmail.com>
> *To:* geomoose-users at lists.sourceforge.net
> *Sent:* Monday, May 2, 2011 5:57 AM
> *Subject:* Re: [Geomoose-users] Using Identify with Postgis layer
>
> Hi list,
>
> I came across GeoMoose through a university project to create a mapping
> server. I've managed to get it working fairly well with Mapserver and
> PostGIS data (and looking good, thanks!), but I was just wondering whether
> anyone has used "Identify" with PostGIS layers. I have followed the
> instructions here<http://www.geomoose.org/wiki/index.php/Setup_guide#Get_Identify_to_work_-_Make_sure_identify_will_work.when_you_identify_a_feature_any_visible_shape_file_or_WMS_will_display_those_attributes_in_the_table_of_contents.>,
> but I think these were written for Shapefiles, as I just get the text
> "[FEATURE_NAME]" in the resulting HTML rather than the actual feature
> selected name. This is also true if I put "[feature_name from table_name]"
> as per how fields are defined in the Mapserver DATA field.
>
>  Any help much appreciated.
>
> Thanks
>
> Steve
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geomoose-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20110502/5c1eb999/attachment.html


More information about the Geomoose-users mailing list