[OpenLayers-Users] (no subject)

drk mattr drkmattr at hotmail.com
Fri Nov 9 15:36:50 EST 2007


Eric,
 
that was very timely as I was going to ask that question.  I've added the info, but I'm getting a javascript error.
 
Line: 518Char: 54Error: 'this.center' is null or not an object
 
Now I've set:
 
        var lat = 596558;         var lon = 4195115;        var zoom = 6;
 
and I'm using:
 
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);            map.addControl(new OpenLayers.Control.LayerSwitcher());
 
my lat/long is the UTM coords which I believe i can use in this situation.  I'm guessing though something still isn't right with those number.  I've looked at OpenLayers.js to see what is happening there, but I've got no real good idea.
 
I'm sure this is just basic JavaScript questions, but I've been living in a .NET world too long.  ;)
 
Thanks for your help guys!
 
David
 
-----Original Message-----From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Eric LemoineSent: Friday, November 09, 2007 12:46 PMTo: Richard DuivenvoordeCc: users at openlayers.orgSubject: Re: [OpenLayers-Users] Getting up and running with OpenLayers
 
In addition to what Richard said you will also need to call
map.setCenter() or map.zoomToMaxExtent() to actually see something on
the map. Take a look at the wms example
(<http://www.openlayers.org/dev/examples/wms.html>). Good luck.
 
--
Eric
 
On Nov 9, 2007 6:13 PM, Richard Duivenvoorde <rdmailings at duif.net> wrote:
> Hi David,
> 
> the error you see is because openlayers is asking for a layer in the
> epsg:4326 (default latlon) projection.
> 
> You can do two things:
> - either add EPSG:4326 to your WMS_SRS "EPSG:32616" line in the WEB part
> of your mapserver map file
> if your mapserver and proj lib are ok, this will make mapserver project
> your 32616 data to 4326 and you will see latlon projected maps in OL.
> 
> But probably you want to see 32616 projected maps, you can do that by
> telling OL that the Map's projection is 32616: something like this:
> 
> map = new OpenLayers.Map('map',  {
>    'projection':'EPSG:32616',
>    'units':'m',
>    'maxExtent':new OpenLayers.Bounds(582919,4182989,610195,4207241),
>    });
> 
> hope this helps something.
> 
> grtz,
> Richard Duivenvoorde
> 
> ps have also a look at
> http://www.openlayers.org/dev/examples/projected-map.html
> 
> 
> 
> 
> 
> drk mattr wrote:
> > I've been reading about OpenLayers on James Fee's blog and I'm really
> > interested in working with it.  I'm a long time ArcIMS developer so the
> > concepts here are close to what I'm used to using (well I'm not used to
> > using JavaScript which is my problem).
> >
> > I've got a mapfile up and running.
> >
> > MAP
> >     NAME Installation
> >     SIZE 800 500
> >     IMAGECOLOR 240 240 240
> >     EXTENT 582919.88200 4182989.235900 610195.822000 4207241.321900
> >     UNITS METERS
> >     PROJECTION
> >       "init=EPSG:32616"
> >     END
> >     WEB
> >         IMAGEPATH "/ms4w/tmp/ms_tmp/"
> >         IMAGEURL "/ms_tmp/"
> >         METADATA
> >           WMS_TITLE "WMS Test"
> >           WMS_ABSTRACT "My attempt at actually moving from ArcIMS to WMS"
> >           WMS_ACCESSCONSTRAINTS "none"
> >
> >          WMS_ONLINERESOURCE "http://localhost:8080/test/test.html"
> >          WMS_SRS "EPSG:32616"
> >        END
> >     END
> >
> >  LAYER
> >   NAME "Installation"
> >   TYPE POLYGON
> >   STATUS DEFAULT
> >   DATA "Installation_Area.shp"
> >
> >   CLASS
> >    NAME 'Installation'
> >    OUTLINECOLOR 60 60 60
> >    COLOR 255 255 0
> >    SYMBOL 0
> >   END
> >  END
> > END
> >
> > Which returns a simple map when I test it:
> > _http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map&mode=map_
> 
> > <http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map&mode=map>
> >
> > Now, I've decided to try OpenLayers and this is my code which I borrowed
> > from one of the examples:
> >
> > <html xmlns="http://www.w3.org/1999/xhtml">
> >   <head>
> >     <style type="text/css">
> >         #map {
> >             width: 800px;
> >             height: 475px;
> >             border: 1px solid black;
> >         }
> >     </style>
> >     <script src="OpenLayers.js"></script>
> >     <script type="text/javascript">
> >         function init(){
> >             map = new OpenLayers.Map( 'map' );
> >             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
> >
> > "http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map",
> > {layers: 'Installation'} );
> >             map.addLayer(layer);
> >         }
> >     </script>
> >   </head>
> >   <body onload="init()">
> >     <div id="map"></div>
> >   </body>
> > </html>
> >
> > When I run it, I get a tiles which say:
> >
> > msWMSLoadGetMapParams():  WMS server error. Invalid SRS given : SRS must
> > be valid for all requested layers.
> >
> > Now I looked at the doc and it seems like you can set the projection
> > which I tried, but it still returned the same error.  I'm sure I'm
> > close, but I'm just a little out of my league right now with openlayers.
> >
> > Any help would be greatly appreciated.
> >
> > David.
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> > Peek-a-boo FREE Tricks & Treats for You! Get 'em!
> > <http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us>
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20071109/8546003a/attachment.html


More information about the Users mailing list