[postgis-users] PostGIS data in mapserver

Tyler Mitchell themitchells at telus.net
Tue Jul 2 09:28:51 PDT 2002


Hmm...If I understand your problem correctly - I guess you've got to do
something with your projections - not my area of expertise.  I haven't
touched that yet.  I know that you should have your projection set in your
map file:

> #
> #PROJECTION
> #  "proj=utm"
> #  "ellps=GRS80"
> #  "zone=15"
> #  "north"
> #  "no_defs"
> #
> #  OR:
> #
> #  "init=epsg:26915"
> #END
>

You should start by getting these setup properly.  Goto
http://mapserver.gis.umn.edu/doc36/coordinates.html and track down which
EPSG# to use and uncomment that line.  What projection do you want you map
to be using, perhaps someone can help you get the right code?

Then you need to know what projection your layer's data is in and set a
projection for that layer.  Then mapserver will automagically translate from
the layer projection to the overall map projection and things should work
for you.

Let us know how you progress.

> -----Original Message-----
> From: postgis-users-admin at postgis.refractions.net
> [mailto:postgis-users-admin at postgis.refractions.net]On Behalf
> Of Cedric
> BERNIER
> Sent: Tuesday, July 02, 2002 8:50 AM
> To: postgis-users at postgis.refractions.net
> Subject: Re: [postgis-users] PostGIS data in mapserver
>
>
> sure,
>
> here is my map file definition :
>
> #
> # Start of map file
> #
> NAME DEMO
> STATUS ON
> SIZE 600 600
> EXTENT -94 2 80 80
> UNITS DD
> SHAPEPATH "data"
> IMAGECOLOR 255 255 255
>
> # you may need to change this to match your MapServer build
> IMAGETYPE PNG
>
> #
> # Projection definition, consult the PROJ.4 documentation for
> parameter
> discussion
> #
> #PROJECTION
> #  "proj=utm"
> #  "ellps=GRS80"
> #  "zone=15"
> #  "north"
> #  "no_defs"
> #
> #  OR:
> #
> #  "init=epsg:26915"
> #END
>
> #
> # Start of web interface definition (including WMS enabling metadata)
> #
> WEB
>   HEADER demo_header.html
>   TEMPLATE demo.html
>   FOOTER demo_footer.html
>   MINSCALE 1000
>   MAXSCALE 1550000
>   IMAGEPATH "set in my_init.html"
>   IMAGEURL "set in my_init.html"
>   METADATA
>     WMS_TITLE "UMN MapServer Itasca Demo"
>     WMS_ABSTRACT "This is the UMN MapServer demonstration
> application for Itasca
> County located in north central Minnesota."
>     WMS_ACCESSCONSTRAINTS none
>
>     # change this value to match your setup
>     WMS_ONLINERESOURCE
> "http://mithrandir/cbe/mapserver/Postgis/my_init.html"
>
>     WMS_SRS "EPSG:26915"
>   END
> END
>
> QUERYMAP
>   SIZE 200 200
>   STATUS ON
>   STYLE HILITE
>   COLOR 255 0 0
> END
>
> #
> # Start of reference map
> #
> REFERENCE
>   IMAGE graphics/reference.png
>   EXTENT -94 2 80 80
>   SIZE 600 600
>   STATUS ON
>   COLOR -1 -1 -1
>   OUTLINECOLOR 255 0 0
> END
>
> #
> # Start of legend
> #
> LEGEND
>   KEYSIZE 18 12
>   LABEL
>     TYPE BITMAP
>     SIZE MEDIUM
>     COLOR 0 0 89
>   END
>   STATUS ON
> END
>
> #
> # Start of scalebar
> #
> SCALEBAR
>   IMAGECOLOR 0 0 255
>   LABEL
>     COLOR 255 255 255
>     SIZE tiny
>   END
>   STYLE 0
>   SIZE 280 2
>   COLOR 155 255 255
>   UNITS METERS
>   INTERVALS 5
>   TRANSPARENT FALSE
>   STATUS TRUE
> END
>
> #
> # Start of layer definitions
> #
>
> LAYER
>   CONNECTIONTYPE postgis
>   NAME "Fir"
>   CONNECTION "user=cbe dbname=sigdb host=localhost"
>   DATA "the_geom from fir"
>   STATUS ON
>   TYPE POLYGON
>   CLASS
>     COLOR 0 255 0
>     SIZE 2
>   END
> END
>
>
> END # Map File
>
>
>
> my table "fir has 2 column "key" and "the_geom"
>
> and here is one of my record
>
>  AYPM/F/PORT MORESBY
>           | SRID=54004;POLYGON((148.828339 2.8e-05,154.228333 -0,
> 156.833328 2.8e-05,160 -0,160 -4.833333,159 -4.833333,158.259995
> -5.285,157.668335 -5.645,
> 156.104996 -6.59,155.990005 -6.74,155 -7.316667,155 -7.41,155
> -9.928333,155 -12,
> 144.96167 -12,144 -12,144.07222 -11.725,144.026672
> -11.5,144.080276 -11.388333,
> 144.165283 -11.233055,144.178329 -11.093889,144.121109
> -11.043333,143.96666
> -10.550834,
> 144.031113 -10.214444,144.089172 -9.942778,144.233337
> -9.4,143.875 -9.133333,
> 142.804993 -9.323334,142.731674 -9.338333,142.695007
> -9.34,142.59166 -9.356667,
> 142.558334 -9.376667,142.524994 -9.363334,142.494995
> -9.368333,142.345001
> -9.268333,
> 142.273331 -9.231667,142.235001 -9.193334,142.214996
> -9.19,142.171661 -9.2,
> 142.143326 -9.198334,142.106674 -9.213333,142.058334
> -9.261666,141.018326
> -9.616667,
> 141.018326 -9.191667,141 -8.6,141.018326 -6.891667,140.952774
> -6.911111,140.916672 -6.875,
> 140.891663 -6.85,140.875 -6.783333,140.899994 -6.75,140.84584
> -6.716667,140.850006 -6.683333,
> 140.837494 -6.616667,140.883331 -6.566667,140.920837
> -6.505556,140.916672 -6.425,
>
> 140.941666 -6.375,140.958328 -6.325,141 -6.316667,141
> -4.966667,141 -2.723333,141
> -2.555,
> 141 -0,142.856674 -0,146.141663 -0,148.828339 2.8e-05))
>
>
> Tyler Mitchell a écrit :
>
> > Could you show us how you defined your layer in the map
> file?  Also, could
> > you show us the details of your table structure (i.e. field
> definitions) for
> > the layer?
> >
> > On Tuesday 02 July 2002 02:15 am, you wrote:
> > > Hi all ,
> > > thanks to Chip, Tommie and Tyler for your help,
> > >
> > > I have something wrong with my configuration of Mapserver.
> > >
> > > Here is the problem :when I add a layer in my map file
> (which is the demo
> > > itasca) with a postgis connection type and when I try to
> visualize it with
> > > ms ;  I obtain a query error from
> msPOSTGISLayerWhichShapes() executing the
> > > POSTGIS SQL statement.
> > >
> > > To me, the problem is than my data used SRID 54004 and
> are world data.
> > >
> > > So if I try to add the data contained in BOX3D (387919.653225817
> > > 5200489.10287243, 500708...)(this is part of my error
> message)  it doesn't
> > > correspond to anything in my database.
> > >
> > > Am I right ?
> > >
> > > How can I specify the range to query in ?
> >
> > _______________________________________________
> > 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