Hi again,Thank to all, i Figured out my mistake, map.zoomToMaxExtent(); I need to use it in correct order which i didn't in correct order. thank you all once again for help and suggestions.
On Tue, Mar 10, 2009 at 8:48 AM, nab <[email protected]> wrote: > > Hi,I didn't sent full code before, > > Here i am sending full code: > > -------------------------------------------------------------------------------------------------------------------------------------- > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <title>OpenLayers Image Layer Example</title> > <link rel="stylesheet" href="../theme/default/style.css" > type="text/css" /> > <link rel="stylesheet" href="style.css" type="text/css" /> > <style type="text/css"> > p.caption { > width: 512px; > } > </style> > <script src="../lib/OpenLayers.js"></script> > <script type="text/javascript"> > var map; > function init(){ > map = new OpenLayers.Map('map'); > > var options = {numZoomLevels: 3}; > //var olbound = new OpenLayers.Bounds(-180, -88.759, 180, > 88.759); //when activated displays static image > pictures map on this but since bounds are not accurate long/lat is not > correct > var olbound = new OpenLayers.Bounds(15.865164, > 58.172783,16.651403, 58.620233); //cannto display pictures plus long/lat > also incorrect > > var graphic = new OpenLayers.Layer.Image( > 'City Lights', > '../img/image.24.png', > olbound, > new OpenLayers.Size(1000, 1000), > options); > > map.addLayers([graphic]); > map.addControl(new OpenLayers.Control.LayerSwitcher()); > map.addControl(new OpenLayers.Control.MousePosition()); > map.zoomToMaxExtent(); > } > map.setCenter(new OpenLayers.LonLat(16.23069, 58.406794), 3); > </script> > </head> > <body onload="init()"> > <h1 id="title">Image Layer Example</h1> > > <div id="tags"></div> > > <p id="shortdesc"> > image > </p> > > <div id="map" class="smallmap"></div> > > <div id="docs"> > <p class="caption"> > Using image which is full size as the world map can really be. > </p> > </div> > </body> > </html> > > > -------------------------------------------------------------------------------------------------------------------------------- > did i missed something? > I am trying to work on this from many days but didn't achieve success to > display map with correct longitude and latitude value, since i need these > values from map on click to start further calculation based on longitude nad > latitude value. > > > > > > > On Mon, Mar 9, 2009 at 10:52 PM, Pierre GIRAUD <[email protected]>wrote: > >> You're not adding the layer to the map. >> >> Try the following : >> >> function init(){ >> map = new OpenLayers.Map('map'); >> var options = { numZoomLevels: 5 }; >> var olbound = new OpenLayers.Bounds(15.865164, 58.172783, >> 16.651403, 58.620233); //bounds(left,buttom,right,top) >> >> var topography = new OpenLayers.Layer.Image( >> 'Wrap signals', >> 'img/image.24.png', >> olbound, >> new OpenLayers.Size(1000, 1000), >> //size in pixel of the map >> options >> ); >> map.addLayer(topography); >> map.zoomToMaxExtent(); >> } >> >> map.setCenter(new OpenLayers.LonLat(16.23069, 58.406794), 3); > > --------------------------------------------------------------- > >> >> >> On Mon, Mar 9, 2009 at 4:43 PM, nab <nabinr> wrote: >> > >> > >> > Thanks for the reply, >> > here is the code which i used with static map, but the longitued and >> > latitude i got is incorrect or sometime i couldnot even get any image >> loaded >> > on the canvas. >> > function init(){ >> > map = new OpenLayers.Map('map'); >> > var options = { numZoomLevels: 5 }; >> > var olbound = new OpenLayers.Bounds(15.865164, 58.172783, >> > 16.651403, 58.620233); //bounds(left,buttom,right,top) >> > >> > >> > var topograpy = new OpenLayers.Layer.Image( >> > 'Wrap signals', >> > 'img/image.24.png', olbound, >> > new OpenLayers.Size(1000, 1000), >> > //size in pixel of the map >> > options); >> > map.setCenter(new OpenLayers.LonLat(58.406794, 16.23069), 3); >> > } >> > I will be thankful, if somebody can help me with this problem. >> > >> > >> > Hi, >> >> I had seen your posts and replies in this forum, which is impressive >> and >> >> helped me lot as well while using openlayer. >> >> Actaully i am new to openlayer and i am using static map image(jpg) of >> my >> >> city but i could not get correct long/lat value since i use map of very >> >> small city, i try to fix it through >> >> OpenLayers.Bounds(15.865164, 58.172783, 16.651403, 58.620233) and i set >> >> the >> >> centre long/lat as 0,0 which is not workin then i set them in to its >> real >> >> long/lat that is also not working. >> >> is there any method which i didn't understood to make static map of my >> >> city >> >> with long/lat value. >> >> >> >> The concept that i follow for Bounds and centre are: >> >> >> >> >> >> -------------------------------------(long1, lat1) >> >> | | >> >> | image (lon,lat) | >> >> (long2,lat2)------------------------------------- >> >> >> >> i would be very thankful if you could help me. >> >> >> >> regards, >> >> nabin >> > >> > >> > _______________________________________________ >> > Users mailing list >> > [email protected] >> > http://openlayers.org/mailman/listinfo/users >> > >> > >> >> >> >> -- >> Pierre GIRAUD >> http://www.camptocamp.com >> > > >
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
