<div id="result_box" dir="ltr" style="TEXT-ALIGN: left">thank you all, I solved the problem... </div><br><br>
<div class="gmail_quote">2009/1/12 Ben Madin <span dir="ltr">&lt;<a href="mailto:ben@remoteinformation.com.au">ben@remoteinformation.com.au</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I&#39;m certainly no expert, and I&#39;m guessing it would have helped if you had included more of your layer definition:<br>
<br><br>On 13/01/2009, at 1:28 AM, <a href="mailto:mapserver-users-request@lists.osgeo.org" target="_blank">mapserver-users-request@lists.osgeo.org</a> wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">msDrawMap(): Image handling error. Failed to draw layer named &#39;chile_comuna&#39;. prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual query) statement: &#39;DECLARE mycursor BINARY CURSOR FOR<br>
</blockquote><br>Here&#39;s (essentially) the query MapServer asked of PostGIS :<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">SELECT &quot;NAME&quot;::text,asbinary(force_collection(force_2d(the_geom)),&#39;NDR&#39;),gid::text from chile_comuna WHERE the_geom &amp;&amp; setSRID(&#39;BOX3D(-71.2556639435156 -29.9271886101172,-71.2540857172265 -29.9256103838281)&#39;::BOX3D, find_srid(&#39;&#39;,&#39;chile_comuna&#39;,&#39;the_geom&#39;) )&#39;<br>
</blockquote><br>Here&#39;s the problem PostGIS reported with it.<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Postgresql reports the error as &#39;ERROR: column &quot;NAME&quot; does not exist LINE 1: DECLARE mycursor BINARY CURSOR FOR SELECT &quot;NAME&quot;::text,asbin... ^ &#39;<br>
</blockquote><br>It looks to my inexperienced eyes that somewhere in the layer (classitem?) it includes a reference to a field NAME.<br><br>It may be that it needs to be specified in the query. Check the table you imported into PostgreSQL, ie: (I made this up)<br>
<br># \d chile_comuna<br><br>&nbsp;Column &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Modifiers<br>---------------------+-------------------------+---------------------------------------------------------<br>
&nbsp;gid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | integer &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | not null default nextval(&#39;gis_urban_gid_seq&#39;::regclass)<br>&nbsp;commune_name &nbsp; &nbsp;| character varying(24) &nbsp;|<br>&nbsp;the_geom &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| geometry &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br><br><br>

<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">More Help: Error with POSTGIS data variable. You specified &#39;check your .map file&#39;. Standard ways of specifiying are : (1) &#39;geometry_column from geometry_table&#39;<br>
</blockquote><br>This is what you have used, but it only returns the_geom, you need to specify the table column AS name<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">(2) &#39;geometry_column from (sub query) as foo using unique column name using SRID=srid#&#39; Make sure you put in the &#39;using unique column name&#39; and &#39;using SRID=#&#39; clauses in.<br>
</blockquote><br>Try also specifying the name column (assuming it does exist in the table):<br><br>the_geom from (gid, the_geom, commune_name AS name from chile_comuna) as foo using unique column gid using SRID= 4326;<br>
<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">For more help, please see <a href="http://postgis.refractions.net/documentation/" target="_blank">http://postgis.refractions.net/documentation/</a>&nbsp;Mappostgis.c - version of Jan 23/2004.<br>
<br>I use the command shp2pgsql to pass the information of the shapefile to postgres table.<br><br>MapFile<br>&nbsp;LAYER<br>&nbsp; &nbsp;NAME &#39;chile_comuna&#39;<br>&nbsp; &nbsp;TYPE POLYGON<br>&nbsp; &nbsp;#DATA &#39;chile_comuna.shp&#39;<br>&nbsp; &nbsp;CONNECTIONTYPE postgis<br>
&nbsp;CONNECTION &quot;user=postgres password=1234 dbname=geo_referencia host=localhost&quot;<br>&nbsp;DATA &quot;the_geom from chile_comuna&quot;<br>.....<br><br>can anyone help me? pleasee...<br></blockquote><br>cheers<br><br>Ben<br>
<br><br><br><br>-- <br><br>Ben Madin<br>REMOTE INFORMATION<br><br>t : +61 8 9192 5455<br>f : +61 8 9192 5535<br>m : 0448 887 220<br>Broome &nbsp; WA &nbsp; 6725<br><br><a href="mailto:ben@remoteinformation.com.au" target="_blank">ben@remoteinformation.com.au</a><br>
<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Out here, it pays to know...<br><br><br>_______________________________________________<br>mapserver-users mailing list<br><a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></blockquote></div><br>