Hi everyone,

 

I try to make a map in OpenLayers and by 2 weeks now I'm stuck. I look over all 
examples and tutorial I've found but I can't find a solution.

 

Here is my problem:

·         I have a map with a basic image layer and  I know the size of the 
image

var basicMapLayer = new OpenLayers.Layer.Image(

                                "My Map",

                                "images/maps/ MapImage.jpg",

                                new OpenLayers.Bounds(0, 0, 510, 510),          
                  /* left, bottom, right, top - left < right, top < bottom */

                               new OpenLayers.Size(510, 510),                   
                                          /* Image original size */

                               {wrapDateLine: true},

                               {layers: 'basic'}

                );

 

·         This image is a map that have custom min and max Lat and Lon 

var minLon = 57360;                       /* left margin */

                var maxLon = 90064;                      /* right margin */

                var minLat = 65575;                        /* bottom margin */

                var maxLat = 98279;                       /* top margin */

 

·         Here is the entire code:

<script defer="defer" type="text/javascript">
 /* Variables */
 var map;
 var minLon = 57360;  /* left margin */
 var maxLon = 90064;  /* right margin */
 var minLat = 65575;  /* bottom margin */
 var maxLat = 98279;  /* top margin */
 var centerLon = (maxLon-minLon)/2;
 var centerLat = (maxLat-minLat)/2;
 
 
 function init(){
 /* Creating the Map Viewer */
  /*In order to create the viewer, you must first create a map. The 
OpenLayers.Map constructor requires one argument: This argument must either be 
an HTML Element, or the ID of an HTML element. This is the element in which the 
map will be placed.*/
  

 map = new OpenLayers.Map("map", {
  projection: new OpenLayers.Projection("EPSG:4326"),
  displayProjection: new OpenLayers.Projection("EPSG:900913"),
  controls: [
   /*new OpenLayers.Bounds(minLon, minLat, maxLon, maxLat),*/
   new OpenLayers.Control.Navigation(),
   new OpenLayers.Control.PanZoomBar(),
   new OpenLayers.Control.LayerSwitcher(),  /* Open the switch layers panel */
   new OpenLayers.Control.MousePosition()
  ],
  numZoomLevels: 6
  });

 
 /*Map Constructor*/
  /* The next step to creating a viewer is to add a layer to the Map.  */
 var basicMapLayer = new OpenLayers.Layer.Image(
    "MyMap",
    "images/maps/MapImage.jpg",
    new OpenLayers.Bounds(0, 0, 510, 510),  /* left, bottom, right, top - left 
< right, top < bottom */

    /*new OpenLayers.Bounds(minLon, minLat, maxLon, maxLat),*/
  new OpenLayers.Size(510, 510),     /* Image original size */
  {wrapDateLine: true},
  {layers: 'basic'}
  );
 
 /* Adding an Vector Layer */
 var teleports = new OpenLayers.Layer.Vector("Teleports");
 var feature = new OpenLayers.Feature.Vector(
   new OpenLayers.Geometry.Point(150, 250),
   {externalGraphic: 'img/marker.png', graphicHeight: 21, graphicWidth: 16});
 teleports.addFeatures(feature);

 
 /* Layer Constructor */
  /* In order to display the map, you must set a center and zoom level. In 
order to zoom to fit the map into the window, you can use the zoomToMaxExtent 
function, which will zoom as close as possible while still fitting the full 
extents within the window. */
 map.addLayers([basicMapLayer, teleports]);
 map.setCenter(new OpenLayers.LonLat(centerLon, centerLat));

 map.zoomToMaxExtent();    /* start the map at minimum zoom */
 }
</script>


 

·         And now THE PROBLEM:

How can I transform my bounds to reflect the min and max Lat and Lon in wrap 
data line?  

Any help would be appreciated.

Mihai
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to