[mapserver-users] OpenLayers & Projection
Julien-Samuel Lacroix
jlacroix at mapgears.com
Tue Apr 29 13:13:07 PDT 2008
Hi,
Since your problem is related to OpenLayers you may get more help from
the OpenLayers Users mailing-list.
Anyway, to have OpenLayers call the right projection use (replace
EPSG:12345 by your actual projection code):
var options =
{
scales: [3500000,
3000000,2500000,2000000,1500000,1000000,350000,250000],
maxScale: 250000,
minScale: 3500000,
projection:"EPSG:12345",
displayProjection: "EPSG:4326",
units: "m",
controls: [new OpenLayers.Control.MouseDefaults()]
};
Julien
Clemiou wrote:
> Hi!
>
> I provide you my OpenLayers code.
>
> function init()
> {
> OpenLayers.DOTS_PER_INCH = 72;
>
> // --------------------------------------------------------------------------//
> // Tableau des options pour la carte. //
> // La plus importante est scales qui permet de definir les différents zooms //
> // qui seront disponibles pour l'utilisateur. //
> // --------------------------------------------------------------------------//
>
> var options =
> {
> scales: [3500000, 3000000,2500000,2000000,1500000,1000000,350000,250000],
> maxScale: 250000,
> minScale: 3500000,
> controls: [new OpenLayers.Control.MouseDefaults()]
> };
>
> // -------------------------//
> // Création de l'objet map. //
> // -------------------------//
>
> map = new OpenLayers.Map( 'map',options);
>
> // ----------------------------------------------//
> // On ajoute les couches après les avoir créées. //
> // ----------------------------------------------//
>
> layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
> "http://localhost/cgi-bin/mapserv?mode=map&map=/var/www/html/ms/map_files/france.map", {layers: ['FRANCE','CORSE']},
> {gutter: 0 });
>
> map.addLayer(layer);
>
>
> }
>
> // -----------------------------------------------------------------------//
> // Ajout de la barre de zoom et des coordonnées de la position actuelle. //
> // -----------------------------------------------------------------------//
>
> map.addControl( new OpenLayers.Control.PanZoomBar() );
>
> // ------------------------------//
> // Ajout de la gestion du click. //
> // ------------------------------//
>
> var click = new OpenLayers.Control.Click();
> map.addControl(click);
> click.activate();
>
> // ---------------------------------------------------------------------------//
> // Et on définit le centre de notre carte, afin qu'elle sot bien positionnée. //
> // ---------------------------------------------------------------------------//
>
> map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
>
>
>
> And my mapfile has the good projections block, one for the map and one
> for each layer. Consequently, it works with mapserver & without OL.
>
> Regards.
>
> Clement
>
>
>
> ------------------------------------------------------------------------
> > Date: Tue, 29 Apr 2008 15:43:32 -0400
> > From: jlacroix at mapgears.com
> > To: clems_mars at hotmail.com
> > CC: mapserver-users at lists.osgeo.org
> > Subject: Re: [mapserver-users] OpenLayers & Projection
> >
> > Hi,
> >
> > You can take a look at how projection are set in OpenLayers:
> >
> > http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#Projections
> >
> > Or at the Source of the OpenLayers projection example:
> > http://www.openlayers.org/dev/examples/projected-map.html
> >
> > You will also need to define the PROJECTION block at the layer level and
> > at the map level in your mapfile.
> >
> > Julien
> >
> > PS: Please provide revelent mapfile part and revelent code when asking a
> > question it will help us figuring out what may be your problem.
> >
> > Clemiou wrote:
> > > Hi all!
> > >
> > > I come back here because I always have the same problem.
> > > So, I have a .ewc file which represent the France. This file is in
> Lambert II (French position, centered on France).
> > > Currently, I display this map with WGS84 projection but naturally,
> my map is distorded because this projection is centered on the equator.
> > > So, if I try to displaying my map with the Lambert II projection, I
> obtain the following figure:
> > >
> > >
> http://www.forumsig.org/attachment.php?attachmentid=2286&stc=1&d=1208951661
> <http://www.forumsig.org/attachment.php?attachmentid=2286&stc=1&d=1208951661>
> > >
> > > As you can see, there is a malfunction=> the repetition of a part
> of each tile.
> > >
> > > I tried to add projection and units options to my map but nothing
> change. I think that is a OpenLayers probleme because my map is
> correctly display with Mapserver and without OL.
> > > Perhaps someone here should help me.
> > >
> > > Thanks for your futur help and once more, excuse me for my English.
> > >
> > > Have a nice day
> > >
> > > Clement
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > Plus de 15 millions de français utilisent Windows Live Messenger !
> > > Téléchargez Messenger, c'est gratuit !
> > > <http://www.windowslive.fr/messenger/>
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > mapserver-users mailing list
> > > mapserver-users at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
> > --
> > Julien-Samuel Lacroix
> > Mapgears
> > http://www.mapgears.com/
>
> ------------------------------------------------------------------------
> Centralisez tous vos comptes mails dans Hotmail ! Créez un compte
> Hotmail, c'est gratuit ! <http://www.windowslive.fr/hotmail/>
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the MapServer-users
mailing list