[mapserver-users] Basic Projection Help
pcreso at pcreso.com
pcreso at pcreso.com
Fri Jun 27 23:12:34 PDT 2008
Hi Matthew,
If you loaded it from shapefiles using shp2pgsql, then use the -s flag to set the srid to the correct value.
If you \d your table, I think you'll find a constraint on it setting the srid, as well as the geometrycolumns entry.
The simplest way to get things working with mapserver may well be to leave it as -1 in the database (& geometrycolumns entry) & 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.
That will get things working until you load the data with the correct srid.
HTH,
Brent Wood
--- On Sat, 6/28/08, Matthew Pettis <matthew.pettis at gmail.com> wrote:
> From: Matthew Pettis <matthew.pettis at gmail.com>
> Subject: [mapserver-users] Basic Projection Help
> To: "Mapserver-users" <mapserver-users at lists.osgeo.org>
> Date: Saturday, June 28, 2008, 5:47 PM
> Hello,
>
> I'm trying to get a handle on projections and
> reprojections. I have a
> dataset in a postgis database table that is in epsg:26915
> (it's the state of
> MN). I know this from the metadata provided by the
> provider (state of
> Minnesota itself).
>
> When I loaded it into postgis, the geometry_columns row for
> this
> table/column combo set srid=-1. As I know that this is in
> epsg:26915, I
> manually changed the geometry_columns row entry to it (see:
> ===
> geometry_columns === section).
>
> Problem is, I get an error of using two different
> geometries. Anybody have
> any idea how i set the srid to the correct value of
> epsg:26915? I'd like to
> set this correctly so I can reproject it as necessary. The
> map will render
> with srid=-1, but then I don't think I can reproject
> the image correctly,
> right?
>
> below are what I think are the important sections to this
> problem. Thanks
> in advance for your help.
>
> Matt
>
> === url ===
> ======================================================================
> http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\ol\mapreproj.map&mode=map
> ======================================================================
>
> === error message ===
> ======================================================================
> msDrawMap(): Image handling error. Failed to draw layer
> named 'state'.
> msPOSTGISLayerWhichShapes(): Query error. Error executing
> POSTGIS SQL
> statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR
> FOR SELECT
> asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text
> from
> shp_state WHERE the_geom &&
> setSRID('BOX3D(141095.125 4809728.25,810342.625
> 5478975.75)'::BOX3D,
> find_srid('','shp_state','the_geom')
> ) -ERROR:
> Operation on two geometries with different SRIDs
> ======================================================================
>
> === geometry_columns ===
> ======================================================================
> oid;f_table_catalog;f_table_schema;f_table_name;f_geometry_column;coor_dimension;srid;type
> 336791;"''";"public";"shp_state";"the_geom";2;26915;"MULTIPOLYGON"
> ======================================================================
>
> === mapreproj.map ===
> ======================================================================
> MAP
>
> ################
> # Map attributes
> ################
> IMAGETYPE PNG
> EXTENT 184056.505 4809728.25 767381.245 5478975.75
> SIZE 600 600
> IMAGECOLOR 255 255 255
> FONTSET
> "C:/ms4w/Apache/htdocs/fonts/fonts.list"
>
> ####################
> # Web settings
> ####################
> WEB
> IMAGEPATH "C:/ms4w/Apache/htdocs/tmp/"
> IMAGEURL "/tmp/"
> END
>
> ####################
> # State
> # Background shows through missing precincts to show
> where no votes will
> be coming from
> ####################
> LAYER
> NAME "state"
>
> CONNECTIONTYPE postgis
> CONNECTION "user=postgres dbname=gisvote
> password=postgres"
> DATA "the_geom from shp_state"
> STATUS default
> TYPE polygon
>
> CLASS
> NAME "state"
> COLOR 200 200 200
> END
>
> END # Layer state
>
> END
> ======================================================================
>
>
> --
> It is from the wellspring of our despair and the places
> that we are broken
> that we come to repair the world.
> -- Murray
> Waas_______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list