AW: [postgis-users] PostGis/MapServer ... Query-Problem

Elstermann, Mike Mike.Elstermann at itc-halle.de
Sun Sep 14 23:55:59 PDT 2003


hi chris, thanks for help, but this does'nt works by me

********* a part of my shape *******************
--
-- PostgreSQL database dump
--

\connect - postgres

SET search_path = public, pg_catalog;

--
-- TOC entry 2 (OID 10809501)
-- Name: alk_fo; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE alk_fo (
    gid integer,
    oska character varying,
    obj_name character varying,
    the_geom geometry,
    CHECK ((srid(the_geom) = -1)),
    CHECK (((geometrytype(the_geom) = 'MULTIPOLYGON'::text) OR (the_geom IS
NULL)))
);


--
-- Data for TOC entry 4 (OID 10809501)
-- Name: alk_fo; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY alk_fo (gid, oska, obj_name, the_geom) FROM stdin;
0       1/233F  FS152242002001730820    SRID=-1;MULTIPOLYGON(((4501669.499
5709748.204,4501675.062 5709777.471,4501704.35 5709931.566,4501730.122
5710067.164,4501791.656 5710031.931,4501759.111 5709879.103,4501758.345
5709875.51,4501749.271 5709835.991,4501736.677 5709781.139,4501733.151
5709765.076,4501710.582 5709662.274,4501709.254 5709656.223,4501834.958
5709623.099,4501890.499 5709605.753,4501961.241 5709574.961,4501959.668
5709564.041,4501960.469 5709557.201,4501916.978 5709574.771,4501810.47
5709584.677,4501785.159 5709591.225,4501756.872 5709599.978,4501730.561
5709608.119,4501651.709 5709654.602,4501669.499 5709748.204)))
1       1/233F  FS152242002000770030    SRID=-1;MULTIPOLYGON(((4501596.821
5709695.393,4501573.408 5709709.578,4501604.349 5709859.874,4501584.323
5709941.019,4501582.783 5709947.258,4501616.521 5710127.319,4501636.239
5710117.165,4501615.97 5710016.618,4501635.273 5710014.316,4501651.39
5710109.724,4501691.417 5710088.476,4501614.866 5709681.982,4501596.821
5709695.393)))
2       1/233F  FS152242002000560010    SRID=-1;MULTIPOLYGON(((4501632.971
5709235.362,4501562.797 5709264.698,4501615.466 5709543.545,4501625.184
5709594.992,4501637.453 5709659.944,4501650.09 5709651.376,4501706.389
5709617.123,4501702.566 5709597.245,4501632.971 5709235.362))) .....


************ my map-file ****************
LAYER
  NAME alk
  TYPE POLYGON
  STATUS OFF
  HEADER "halgis_alk_header.html"
  FOOTER "halgis_alle_footer.html"
  CONNECTIONTYPE postgis
  CONNECTION "user=postgres password=postgres dbname=gisdb"
  DATA 'the_geom from alk_fo'  # <-- i think, that's ok?
  #MINSCALE 2000
  MAXSCALE 5000
  CLASS
    NAME 'ALK - FST'
    EXPRESSION ('[OSKA]'='1/233F' OR '[OSKA]'='1/234F'  OR '[OSKA]'='1/239F'
OR '[OSKA]'='1/246F' )
    TEMPLATE "halgis_alk.html"
    SYMBOL dickelinie
    SIZE 1
    COLOR 220 220 255
    OUTLINECOLOR 100 100 200
  END
END

************ the error ******************

<BODY BGCOLOR="#FFFFFF">
msPOSTGISLayerGetShape(): Query error. Error executing POSTGIS  SQL
statement (in FETCH ALL): EXPLAIN VERBOSE SELECT * FROM alk_fo
-
Error with POSTGIS data variable. You specified ''.<br>
Standard ways of specifiying are : <br>
(1) 'geometry_column from geometry_table' <br>
(2) 'geometry_column from (<sub query>) as foo using unique <column
name> using SRID=<srid#>' <br><br>

Make sure you put in the 'using unique  <column name>' and 'using
SRID=#' clauses in.

<br><br>For more help, please see
http://postgis.refractions.net/documentation.php 

<br><br>Mappostgis.c - version of Nov 15/2002.



::: mfg. Mike Elstermann [mikeE.], Teamleiter GIS/RIS, e-Solutions
::: IT-Consult Halle GmbH, Bornknechtstraße 5, 06108 Halle (Saale)
::: Sitz: Große Nikolaistraße 8
::: Tel.: +49 345 221 4237, Fax: +49 345 221 4236, mobil: +49 160 71 545 02
::: mike.elstermann at itc-halle.de ::: http://www.itc-halle.de
::: GeoDaten Online? -> http://www.itcgis.de


-----Ursprüngliche Nachricht-----
Von: chodgson at refractions.net [mailto:chodgson at refractions.net]
Gesendet: Freitag, 12. September 2003 17:59
An: PostGIS Users Discussion
Betreff: Re: [postgis-users] PostGis/MapServer ... Query-Problem


You don't need to use the complete sysntax. "using unique oid using SRID=-1"
is 
only necessary if you are doing a sub-select, which you are not. Therefore,
you 
can use the ultra-easy syntax:

DATA the_geom from punkte_tabelle

That's it. the oid is automatically used to identify individual features,
and 
the srid is taken from the geometry_columns table (the SRID you set when you

called AddGeometryColumn() ).

HTH.
Chris

Quoting "Elstermann, Mike" <Mike.Elstermann at itc-halle.de>:

> hi folks,
> 
> we need your help.
> we wnt to query a postgis-layer with mapserver, but we get this error.
> we have made the oid an the sql-statement is: "the_geom from
punkte_tabelle
> using unique oid using SRID=-1"
> 
> The Error:
> -------------------------
> 
> <!-- MapServer version 3.6.6 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> SUPPORTS=TTF INPUT=TIFF INPUT=EPPL7 INPUT=JPEG INPUT=POSTGIS
> INPUT=SHAPEFILE --> <BODY BGCOLOR="#FFFFFF">
> msPOSTGISLayerGetShape(): Query error. Error executing POSTGIS  SQL
> statement (in FETCH ALL): EXPLAIN VERBOSE SELECT * FROM punkte_tabelle
> -
> Error with POSTGIS data variable. You specified ''.<br> Standard ways of
> specifiying are : <br>
> (1) 'geometry_column from geometry_table' <br>
> (2) 'geometry_column from (<sub query>) as foo using unique
> <column name> using SRID=<srid#>' <br><br>
> 
> Make sure you put in the 'using unique  <column name>' and 'using
> SRID=#' clauses in.
> 
> Table punkte_tabelle with index punkte_tabelle_oid_idx (oid).
> 
> The Layer-Definition:
> ------------------------
> 
> LAYER
>   CONNECTIONTYPE postgis
>   NAME pers_punkte
>   CONNECTION "user=postgres password=ppp dbname=test_db"
>   DATA 'the_geom from punkte_tabelle using unique oid using SRID=-1'
>   TYPE POINT
>   STATUS ON
>   HEADER
> "/srv/www/htdocs/mapserver/test_mapplet/java/mapplet/halgis_pers_pkt_hea
> der.html"
>   FOOTER "halgis_alle_footer.html"
>   CLASS
>     NAME 'Punkte'
>     TEMPLATE
> "/srv/www/htdocs/mapserver/test_mapplet/java/mapplet/halgis_pers_pkt.htm
> l"
>     OUTLINECOLOR 0 0 220
>     COLOR 0 0 220
>     SYMBOL 'circle'
>     size 12
>   END
> END
> 
> Thanks very much!
> 
> ::: mfg. Mike Elstermann [mikeE.], Teamleiter GIS/RIS, e-Solutions
> ::: IT-Consult Halle GmbH, Bornknechtstraße 5, 06108 Halle (Saale)
> ::: Sitz: Große Nikolaistraße 8
> ::: Tel.: +49 345 221 4237, Fax: +49 345 221 4236, mobil: +49 160 71 545
02
> ::: mike.elstermann at itc-halle.de ::: http://www.itc-halle.de
> ::: GeoDaten Online? -> http://www.itcgis.de
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 





_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list