[postgis-users] PostGIS 2.02 view problem

Richard Greenwood richard.greenwood at gmail.com
Wed Jul 24 18:03:18 PDT 2013


Assuming that you haven't resolved this yet, I would try creating a table
from your view and using that in your map file. This won't fix the issue
but might help you isolate it. So in psql:
    CREATE TABLE test AS SELECT * FROM xy.test;
and in your map file:
  DATA "geom from test using unique gid using SRID=4269"
(I removed the sub-select to keep it as simple as possible).

Rich




On Wed, Jul 24, 2013 at 10:55 AM, karsten <karsten at terragis.net> wrote:

> **
> Yes the view does have the gid (I did not include all the fields of the
> view and stupidly forgit to t list the gid field in the email) below. I
> tried to use a different colum as unique key and select it AS gid instead
> which did not work (same error), then I added a new unique id using
> nextval('myloc_loc_gid_seq'::regclass) AS gid (and omitted the old one),
> still same error.
> what else should, itry - running  out of ideas
>
> Cheers
> Karsten
>
>  ------------------------------
> *From:* Richard Greenwood [mailto:richard.greenwood at gmail.com]
> *Sent:* Wednesday, July 24, 2013 07:05 AM
> *To:* karsten at terragis.net; PostGIS Users Discussion
> *Cc:* PostGIS Users Discussion
> *Subject:* Re: [postgis-users] PostGIS 2.02 view problem
>
>  In your map file you have "using unique gid". Are you sure that there is
> a "gid" column in your view?
>
> Rich
>
>
> On Wed, Jul 24, 2013 at 3:35 AM, karsten <karsten at terragis.net> wrote:
>
>> **
>> Hi all,
>>
>> I am trying to use a b view in Postgis 2.0.2 ("POSTGIS="2.0.2 r10789"
>> GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0,
>> released 2013/04/24" LIBXML="2.8.0" LIBJSON="UNKNOWN" TOPOLOGY RASTER")
>> for display via MapServer 6.2
>> I am getting an this error from MapServer:
>>
>> Failed to draw layer named 'members'.
>> msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR:
>> column "COUNT" does not exist
>> LINE 1: select
>> "COUNT",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR').
>>
>> I have no idea why a count is needed here or where this field is coming
>> from ...seems that the regular table have no issue with this.
>>
>> My VIEW public.geometry_columns  shows these values for the view:
>> "xy";"xy";"myloc";"geom";2;4269;"POINT"
>>
>> What can I do to fix this in Postgis ?
>> See below for view details
>>
>> Cheers
>> Karsten
>>
>> Terra GIS LTD
>> -------------------------
>> -- View:
>> CREATE OR REPLACE VIEW xy.test
>> AS
>>  SELECT xy.census_city_id, st_centroid(places.geom)::geometry(Point,4269)
>> AS geom, places.name
>>    FROM
>> myschema.xy,myschema.places
>>
>>   WHERE xy.census_city_id =
>> places.geoid::integer;
>>
>> ALTER TABLE
>> myschema.xy_loc
>>
>> OWNER TO myuser;
>>
>> -----------------------------------
>> in mapfile:
>>
>> DATA "geom from (select * from myschema.xy) as temp using unique gid
>> using SRID=4269"
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>>
>
>
> --
> Richard Greenwood
> richard.greenwood at gmail.com
> www.greenwoodmap.com
>



-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130724/97b0a385/attachment-0001.html>


More information about the postgis-users mailing list