Quantcast

AW: [mapserver-users] OpenLayers and MapServer Itasca Demo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: [mapserver-users] OpenLayers and MapServer Itasca Demo

Arnd Wippermann-3
Hi Jason,
 
you have to install the projectionsfile epsg. Normally c:\proj\nad\epsg
 
for your layer you declare the projection of your data
 
for your map you declare the projection you will deliver on default
 
also you should declare for the map the extent for this projection
 
Then MapServer can reproject your data. With the MapServer cgi-variable &map_projection=init=EPSG:4326 you can get the map in this projection.
 

Mit freundlichen GrĂ¼ssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/

 

Von: [hidden email] [mailto:[hidden email]]
Gesendet: Sonntag, 24. Februar 2008 15:07
An: Arnd Wippermann
Betreff: Re: [mapserver-users] OpenLayers and MapServer Itasca Demo

Arnd,

Thanks for the clues, they helped out a lot!

I added extent and projection info to the OpenLayers code and it's working now.

        function init(){
            map = new OpenLayers.Map( 'map', { maxExtent: new OpenLayers.Bounds(388107.634400379, 5203120.88405952, 500896.339019834, 5310243.30613897), maxResolution: 156543, units: 'meters', projection: "EPSG:26915"} );
            layer = new OpenLayers.Layer.MapServer( "OpenLayers MapServer",
               "http://dev.312pulse.com/cgi-bin/mapserv?map=itasca.map", {layers: 'twprgpy3'},
                    {gutter: 15});
            map.addLayer(layer);
            map.zoomToMaxExtent();
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }

I'll try to figure out why MapServer can't reproject the data, that seems like the right way to do things.

-Jason


On Sat, Feb 23, 2008 at 5:55 PM, Arnd Wippermann <[hidden email]> wrote:
Hi Jason,
 
If you don't declare a projection in OpenLayers, OpenLayers uses ESPG:4326 by default with units="dd".
 
If you have no declaration of a projection in your mapfile, mapserver delivers the data in the projection of the layers
(&imgext=388107.634400+5200287.742790+500896.339020+5313076.447409 in units="m")
 
That means, you have to declare the projection EPSG:26915 and the extent in OpenLayers. Then you should get a map with your data.
 
If you want to use an other projection than that of your layers, mapserver must be able to reproject the data. Therefor you need an espg-file
(&map_projection=init=EPSG:4326 => msProcessProjection(): Projection library error. no system list, errno: 2)
 
Your layer title in OpenLayers should be "OpenLayers MapServer" instead of WMS.

Mit freundlichen GrĂ¼ssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/

 



Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Jason Allen
Gesendet: Samstag, 23. Februar 2008 22:13
An: [hidden email]
Betreff: [mapserver-users] OpenLayers and MapServer Itasca Demo

I just started working with MapServer yesterday and it rocks!

I've been learning my around with the MapServer 5.x Demo App (Itasca) and while it works fine using HTML templates, I can't get it to play nicely with OpenLayers.  OpenLayers simply returns blank map tiles.

The itasca.map file is stock except that I uncommented the projection info:
PROJECTION
"init=epsg:26915"
END

My OpenLayers setup is very simple as well:

 function init(){
            map = new OpenLayers.Map( 'map' );
            layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
               "http://dev.312pulse.com/cgi-bin/mapserv?map=itasca.map", {layers: 'drgs,lakespy2'},
                    {gutter: 15});
            map.addLayer(layer);
            map.zoomToMaxExtent();
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }


Does anyone have any idea why OpenLayers isn't displaying any data, or how to troubleshoot this issue?  MapServer logging isn't the most verbose, and I haven't been able to track down any other clues.

My OpenLayers test page (doesn't work):
http://dev.312pulse.com/map.html

Workshop demo (works):
http://dev.312pulse.com/workshop/

Thanks,

Jason

Loading...