[mapserver-users] reprojection
Berényi Attila
aberenyi at burken.hu
Tue Sep 2 05:03:55 PDT 2008
Dear Linc,
Thank you for the answer and sorry for the late reply.
I'm getting closer to the solution, but now I face a new problem (I hope
mailman will let my attachment trough). I think this is because
epsg:23700 is an oblique mercator projection, so I tried to set
sphericalMercator: false...so success...
Have you or anyone else any other idea?
Thanks in advance,
Attila
ps: now I use this config:
map = new OpenLayers.Map('map');
var satellite = new OpenLayers.Layer.Google
(
"Google Streets",
{
projection: "EPSG:900913"
}
);
wms = new OpenLayers.Layer.MapServer
(
"HUN", "http://localhost/cgi-bin/mapserv?",
{
map: 'mo.map', layers: 'Megyek', transparent: true,
sphericalMercator: false
},
{
opacity: 0.7
}
);
map.addLayers([satellite, wms]);
CLAY.LINC írta:
>
> Hello Attila,
>
>
>
> I posted the item below to the OpenLayers forum regarding a similar
> problem. As noted in the posting, if the overlay is not visible by
> default the initial placement of the layer is off. However, any map
> move that fetches the data again fixes the problem. I have received
> no answers to the posting nor have I figured it out myself yet. This
> posting includes the map file and the OpenLayers example.
>
>
>
> In addition to what is in the posting below, you need to include the
> Google projection (900913) definition in the PROJ4 data file.
> Information on that can be found at this posting:
>
>
>
>
> http://lists.osgeo.org/pipermail/mapserver-users/2008-August/057291.html
>
>
>
> If you are using PostGIS, you will need to do both items 1 and 2. If
> you are not using PostGIS, then I believe you only need item 1. Also,
> thanks to Paul Ramsey, if you add the Google projection definition to
> the top of the PROJ4 epsg file (as well as the definitions of the
> other projections/coordinate systems you are using) MapServer will
> make your map faster. (Thanks Paul, this make a perceptible difference!).
>
>
>
> I hope this helps,
>
>
>
> Best regards,
>
>
>
> -Linc
>
>
>
> --- OpenLayers Posting ---
>
>
>
> Using an overlay layer projected by MS (OpenLayer.MapServer object) to
> Google (and Virtual Earth, EPSG 900913), if the overlay layer is
> initially visible (visibility: true) then the overlay layer is
> correctly placed. If the initial visibility is false, then upon the
> first fetch of the layer, it is NOT correctly placed. However, any
> subsequent map navigation that causes a fetch of the data correctly
> places the overlay layer. This behavior is consistent using the layer
> switcher control and manually turning the layer on and off (not
> including the layer switcher control).
>
>
>
> The relevant portions of code are below. Sorry it is a bit long, but
> it is needed for completeness.
>
>
>
> Hopefully this is a newbie error on my part.
>
>
>
> Any ideas?
>
>
>
> Thanks,
>
>
>
> -Linc
>
>
>
> MS Map File Fragment...
>
>
>
> PROJECTION
>
> "init=epsg:900913" #Google
>
> END #end projection
>
>
>
> LAYER
>
> NAME "senate"
>
> connectiontype postgis
>
> connection "user=xxxx password=xxxx dbname=xxxx host=xxxx
> port=xxxx"
>
> data "geom from s17s0036_shapes"
>
> PROJECTION
>
> "init=epsg:4269"
>
> END #end projection
>
> TYPE polygon
>
> STATUS OFF
>
> CLASS
>
> STYLE
>
> OUTLINECOLOR 0 255 0
>
> WIDTH 3
>
> END #end style
>
> END #end class
>
> END #end layer
>
>
>
> LAYER
>
> NAME "senate_go"
>
> connectiontype postgis
>
> connection "user=xxx password=xxx dbname=xxx host=xxx
> port=xxx"
>
> data "geom from s17s0036_go"
>
> PROJECTION
>
> "init=epsg:900913"
>
> END #end projection
>
> TYPE polygon
>
> STATUS OFF
>
> #MINSCALE 7000000
>
> CLASS
>
> STYLE
>
> OUTLINECOLOR 255 0 0
>
> WIDTH 3
>
> END #end style
>
> END #end class
>
> END #end layer
>
>
>
> 900913 projection defined to PROJ4 and PostGIS per Subha
> Ramakrishnan's MapServer posting of last week.
>
>
>
> I used the OpenLayers Google Overlay example. I’m a newbie so it's
> not real pretty.... In this code, I was trying to see if the layer
> switcher control was the issue so I did not include it and manually
> toggled layer visibility.
>
>
>
> <script type="text/javascript">
>
> var map;
>
> var senate;
>
> var senate_go;
>
>
>
> function init() {
>
>
>
> map = new OpenLayers.Map('map',
>
> {});
>
>
>
> var gmap_r = new
> OpenLayers.Layer.Google("Google Streets",
>
> {projection: "EPSG:900913"}
>
> );
>
>
>
> senate_go = new
> OpenLayers.Layer.MapServer( "State Senate Google",
>
> "http://xxx/cgi-bin/mywms.exe",
> {map: 'wms_senate_go.map', layers: 'senate_go',
>
> transparent: true,
> sphericalMercator: true
>
> },
>
> { visibility: true, singleTile:
> true, opacity: 0.5 } );
>
>
>
> senate = new OpenLayers.Layer.MapServer(
> "State Senate",
>
> "http://xxx/cgi-bin/mywms.exe",
> {map: 'wms_senate_go.map', layers: 'senate',
>
> transparent: true,
> sphericalMercator: true
>
> },
>
> { visibility: true, singleTile:
> true, opacity: 0.5 } );
>
>
>
> map.addLayers([gmap_r]);
>
>
>
> map.zoomToExtent(new
> OpenLayers.Bounds(-87.6, 24.3, -79.8, 31.1));
>
>
>
>
> document.getElementById('cb_senate').checked = false;
>
>
> document.getElementById('cb_senate_go').checked = false;
>
> }
>
>
>
> function toggleLayer(layer) {
>
> if (layer == 'senate') {
>
> if
> (document.getElementById('cb_senate').checked) {map.addLayer(senate)}
>
> else {map.removeLayer(senate)}
>
> }
>
> else
>
> if
> (document.getElementById('cb_senate_go').checked)
> {map.addLayer(senate_go)}
>
> else {map.removeLayer(senate_go)}
>
> }
>
> </script>
>
> </head>
>
> <body onload="init()">
>
> <h1 id="title">OpenLayers Google Example</h1>
>
>
>
> <div id="tags"></div>
>
>
>
> <p>
>
> <input id="cb_senate" type="checkbox" value="senate"
> onclick="toggleLayer(this.value)" /> Senate (EPSG:4269) <br>
>
> <input id="cb_senate_go" type="checkbox" value="senate_go"
> onclick="toggleLayer(this.value)" /> Senate (EPSG:900913) <br>
>
> </p>
>
>
>
> <div id="map"></div>
>
>
>
> </body>
>
> </html>
>
>
>
>
>
>
>
> *From:* mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] *On Behalf Of
> *Berényi Attila
> *Sent:* Friday, August 29, 2008 9:21 AM
> *To:* _mapserver
> *Subject:* [mapserver-users] reprojection
>
>
>
> Dear All,
>
> I have a lot of data in epsg:23700 (HD-72 EOV), and I try to display
> it as an overlay over Google Map (epsg:900913) in Openlayers trough
> WMS. Theoretically it is possible to do this but I have no success at
> all...Which projection should I define in tha main MAP part? And in
> the LAYER part?
> Have anybody done something like this before? If yes, please help me.
>
> Thanks in advance,
>
> Attila Berény
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080902/c3e0843e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: projection.png
Type: image/png
Size: 954213 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080902/c3e0843e/attachment.png>
More information about the MapServer-users
mailing list