[mapserver-users] PostGIS data in EPSG:31300 using for GoogleMaps overlay

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Apr 8 17:29:41 EDT 2008


Hi,

In this:
    DATA "new_geom from (select gid, transform(the_geom,4326) as new_geom from
    table) as mytable using unique gid using srid=4326"

First, "(select gid ..." is selecting the unique column of your table. Change "gid" to suit your table.
Then "using unique gid" is referring to what was selected in the inner query.  If the query is done in this way you must use the name of your unique column instead of "gid" also here.

Perhaps more clear would be to write
"(SELECT my_unique_column AS gid",... and
"using unique gid"

I am not an experienced PostGIS user, let's hope this information is correct.

-Jukka Rahkonen-


-----Alkuperäinen viesti-----
Lähettäjä: mapserver-users-bounces at lists.osgeo.org puolesta: Steven De Vriendt
Lähetetty: ti 8.4.2008 23:29
Vastaanottaja: Brent Wood
Kopio: mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] PostGIS data in EPSG:31300 using for GoogleMaps overlay
 
Brent,

Maybe quite a basic question, but I'm not used to define my data
syntax as the one you propose.
Can you help me out with the <gid> declaration.
I'm quite confused what to fill in for gid

Do I leave it like it is and just write gid or doi I have
or do I have to define my primary key column (f.i.: tbl_b_cabu_pkey).

For both I get an error message, saying either column OID does not
exist or column tbl_b_cabu_pkey does not exist.
However there are both there...

DATA "new_geom from (select gid, transform(the_geom,4326) as new_geom from
  table) as mytable using unique gid using srid=4326"

Thanks for helping out !

On Tue, Apr 8, 2008 at 8:25 PM, Steven De Vriendt <gisaalter at gmail.com> wrote:
> Brent,
>
>  Very, very usefull info. Thanks.  I was just about to reprojecting my data :-)
>  I thought the SRID table was "constrained" to the geometry and you couldn't
>  change it. Seems like that's why the 'virtual' table is there for. Ok,
>  well, I'll give
>  it a try. Thanks for your input !
>
>  Regards,
>  Steven
>
>
>
>  On Tue, Apr 8, 2008 at 7:58 PM, Brent Wood <pcreso at pcreso.com> wrote:
>  >
>  >  --- Steven De Vriendt <gisaalter at gmail.com> wrote:
>  >
>  >  > Hi list,
>  >  >
>  >  > I have some data in PostGIS I wish to overlay in Google Maps using WMS
>  >  > I'm using the same data in a mapserver application, where EPSG code
>  >  > 31300 is used.
>  >  > Now for overlay in Google Maps, 4326 is required.
>  >  > I have made a copy of my map-file and specified 4326 as projection
>  >  > system.Yet, non of my data is showing up.
>  >  >
>  >  > Do I need to reproject my data for this use ? I thought PostGIS was
>  >  > capable of doing reprojection on the fly ?
>  >
>  >  Hi Steven,
>  >
>  >  Both mapserver & POstGIS can reproject the data on the fly, but they need to be
>  >  told the input & output projections.
>  >
>  >  As your data is all displayed via mapserver, the instructions either way will
>  >  be in your mapfile.
>  >
>  >  To reproject using PostGIS, edit the SQL command in your data statement which
>  >  retrieves the PostGIS data. You need to tell PostGIS to return a virtual table
>  >  to mapserver, and transform the data to the required projection in this. Edit
>  >  the data line in the layer something like this:
>  >
>  >  DATA "new_geom from (select gid, transform(the_geom,4326) as new_geom from
>  >  table) as mytable using unique gid using srid=4326"
>  >
>  >
>  >  To reproject in mapserver, you need to set the main mapfile projection to
>  >  EPSG:4326, using, in the global header part of the mapfile:
>  >
>  >  UNITS DD
>  >  PROJECTION
>  >   "init=epsg:4326"
>  >  END
>  >
>  >  In the METADATA section, you'll need to set the output projection for WMS, eg:
>  >  METADATA
>  >   "wms_title" "My WMS Server"
>  >   "wms_srs"   "EPSG:4326"
>  >  END
>  >
>  >  Then in the layer definition, you specify the layer's native projection, so
>  >  mapserver can reproject from one to the other:
>  >
>  >  LAYER
>  >   ...
>  >   PROJECTION
>  >     "init=epsg:31300"
>  >   END
>  >   ...
>  >  END
>  >
>  >  Note that to reproject in PostGIS, Proj.4 support must be compiled into
>  >  PostGIS, and similarly for mapserver if you do the reprojection there. If you
>  >  compiled these from source, this is not done by default, & you'll need to run
>  >  configure with the appropriate flag. If you installed from a package, or on
>  >  Windows, proj support is generally built in.
>  >
>  >
>  >  HTH,
>  >
>  >   Brent Wood
>  >
>
_______________________________________________
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