Thanks to the both of you for your help -- that helps me quite a bit to understand that how to reproject a srid=-1 on the fly and how i should go about permanently fixing it in my geometry table.<br><br>Take care,<br>Matt<br>
<br><div class="gmail_quote">On Sat, Jun 28, 2008 at 9:35 AM, Paul Spencer &lt;<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There is normally a constraint set on postgis tables that specifies the SRID, if you want to change the SRID then you need to drop the constraint, set the SRID and optionally put back the constraint with the correct SRID.<br>

<br>
I do not believe this is necessary to achieve what you want, though. &nbsp;An SRID of -1 tells postgis to return the geometry as is to mapserver. &nbsp;Mapserver then doesn&#39;t know what the projection of the data is, but that is okay because you can provide an PROJECTION object on your layer in mapserver. &nbsp;Then mapserver knows what the projection of the data is without having to consult postgis and will be able to reproject the data for you.<br>

<br>
So you should be able to leave your data in the database with SRID -1 and put<br>
<br>
PROJECTION<br>
 &nbsp;&quot;init=epsg:26915&quot;<br>
END<br>
<br>
in your layer. &nbsp;Then if you use a different projection at the MAP level, mapserver knows that your data is in UTM zone 15 and will reproject it on the fly.<br>
<br>
If you are *always* going to reprojecting your data then you should actually transform it in the database so that you don&#39;t suffer from reprojection overhead on every request.<br>
<br>
Cheers<br>
<br>
Paul<div><div></div><div class="Wj3C7c"><br>
<br>
On 28-Jun-08, at 2:12 AM, <a href="mailto:pcreso@pcreso.com" target="_blank">pcreso@pcreso.com</a> wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Matthew,<br>
<br>
If you loaded it from shapefiles using shp2pgsql, then use the -s flag to set the srid to the correct value.<br>
<br>
If you \d your table, I think you&#39;ll find a constraint on it setting the srid, as well as the geometrycolumns entry.<br>
<br>
The simplest way to get things working with mapserver may well be to leave it as -1 in the database (&amp; geometrycolumns entry) &amp; in your mapserver mapfile data statement, specify the sql returns setsrid(geom,26915) instead of geom, so postgis returns the values with the appropriate SRID set, irrespective of what the database actually stores.<br>

<br>
That will get things working until you load the data with the correct srid.<br>
<br>
HTH,<br>
<br>
&nbsp;Brent Wood<br>
<br>
<br>
<br>
--- On Sat, 6/28/08, Matthew Pettis &lt;<a href="mailto:matthew.pettis@gmail.com" target="_blank">matthew.pettis@gmail.com</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
From: Matthew Pettis &lt;<a href="mailto:matthew.pettis@gmail.com" target="_blank">matthew.pettis@gmail.com</a>&gt;<br>
Subject: [mapserver-users] Basic Projection Help<br>
To: &quot;Mapserver-users&quot; &lt;<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>&gt;<br>
Date: Saturday, June 28, 2008, 5:47 PM<br>
Hello,<br>
<br>
I&#39;m trying to get a handle on projections and<br>
reprojections. &nbsp;I have a<br>
dataset in a postgis database table that is in epsg:26915<br>
(it&#39;s the state of<br>
MN). &nbsp;I know this from the metadata provided by the<br>
provider (state of<br>
Minnesota itself).<br>
<br>
When I loaded it into postgis, the geometry_columns row for<br>
this<br>
table/column combo set srid=-1. &nbsp;As I know that this is in<br>
epsg:26915, I<br>
manually changed the geometry_columns row entry to it (see:<br>
===<br>
geometry_columns === section).<br>
<br>
Problem is, I get an error of using two different<br>
geometries. &nbsp;Anybody have<br>
any idea how i set the srid to the correct value of<br>
epsg:26915? &nbsp;I&#39;d like to<br>
set this correctly so I can reproject it as necessary. &nbsp;The<br>
map will render<br>
with srid=-1, but then I don&#39;t think I can reproject<br>
the image correctly,<br>
right?<br>
<br>
below are what I think are the important sections to this<br>
problem. &nbsp;Thanks<br>
in advance for your help.<br>
<br>
Matt<br>
<br>
=== url ===<br>
======================================================================<br>
<a href="http://localhost/cgi-bin/mapserv.exe?map=C:%5Cms4w%5CApache%5Chtdocs%5Col" target="_blank">http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\ol</a>\mapreproj.map&amp;mode=map<br>
======================================================================<br>
<br>
=== error message ===<br>
======================================================================<br>
msDrawMap(): Image handling error. Failed to draw layer<br>
named &#39;state&#39;.<br>
msPOSTGISLayerWhichShapes(): Query error. Error executing<br>
POSTGIS SQL<br>
statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR<br>
FOR SELECT<br>
asbinary(force_collection(force_2d(the_geom)),&#39;NDR&#39;),gid::text<br>
from<br>
shp_state WHERE the_geom &amp;&amp;<br>
setSRID(&#39;BOX3D(141095.125 4809728.25,810342.625<br>
5478975.75)&#39;::BOX3D,<br>
find_srid(&#39;&#39;,&#39;shp_state&#39;,&#39;the_geom&#39;)<br>
) -ERROR:<br>
Operation on two geometries with different SRIDs<br>
======================================================================<br>
<br>
=== geometry_columns ===<br>
======================================================================<br>
oid;f_table_catalog;f_table_schema;f_table_name;f_geometry_column;coor_dimension;srid;type<br>
336791;&quot;&#39;&#39;&quot;;&quot;public&quot;;&quot;shp_state&quot;;&quot;the_geom&quot;;2;26915;&quot;MULTIPOLYGON&quot;<br>
======================================================================<br>
<br>
=== mapreproj.map ===<br>
======================================================================<br>
MAP<br>
<br>
 &nbsp; ################<br>
 &nbsp; # Map attributes<br>
 &nbsp; ################<br>
&nbsp;IMAGETYPE &nbsp; PNG<br>
&nbsp;EXTENT &nbsp; &nbsp; &nbsp;184056.505 4809728.25 767381.245 5478975.75<br>
&nbsp;SIZE &nbsp; &nbsp; &nbsp; &nbsp;600 600<br>
&nbsp;IMAGECOLOR &nbsp;255 255 255<br>
&nbsp;FONTSET<br>
&quot;C:/ms4w/Apache/htdocs/fonts/fonts.list&quot;<br>
<br>
 &nbsp; ####################<br>
 &nbsp; # Web settings<br>
 &nbsp; ####################<br>
&nbsp;WEB<br>
 &nbsp; IMAGEPATH &nbsp; &quot;C:/ms4w/Apache/htdocs/tmp/&quot;<br>
 &nbsp; IMAGEURL &nbsp; &nbsp;&quot;/tmp/&quot;<br>
&nbsp;END<br>
<br>
 &nbsp; ####################<br>
 &nbsp; # State<br>
 &nbsp; # Background shows through missing precincts to show<br>
where no votes will<br>
be coming from<br>
 &nbsp; ####################<br>
&nbsp;LAYER<br>
 &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;state&quot;<br>
<br>
 &nbsp; CONNECTIONTYPE &nbsp; &nbsp;postgis<br>
 &nbsp; CONNECTION &nbsp; &nbsp; &nbsp; &nbsp;&quot;user=postgres dbname=gisvote<br>
password=postgres&quot;<br>
 &nbsp; DATA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;the_geom from shp_state&quot;<br>
 &nbsp; STATUS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;default<br>
 &nbsp; TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;polygon<br>
<br>
 &nbsp; CLASS<br>
 &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;state&quot;<br>
 &nbsp; &nbsp; COLOR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 200 200 200<br>
 &nbsp; END<br>
<br>
&nbsp;END # Layer state<br>
<br>
END<br>
======================================================================<br>
<br>
<br>
-- <br>
It is from the wellspring of our despair and the places<br>
that we are broken<br>
that we come to repair the world.<br>
-- Murray<br>
Waas_______________________________________________<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>
_______________________________________________<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>
<br>
<br></div></div>
__________________________________________<br><font color="#888888">
<br>
 &nbsp; Paul Spencer<br>
 &nbsp; Chief Technology Officer<br>
 &nbsp; DM Solutions Group Inc<br>
 &nbsp; <a href="http://www.dmsolutions.ca/" target="_blank">http://www.dmsolutions.ca/</a><br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>It is from the wellspring of our despair and the places that we are broken that we come to repair the world.<br>-- Murray Waas