Thanks Harek,

It works except that I can't set my custom min and max coords. This is what I 
tried:

var minLon = 57360;  /* left margin */
 var maxLon = 90064;  /* right margin */
 var minLat = 65575;  /* bottom margin */
 var maxLat = 98279;  /* top margin */

 map = new OpenLayers.Map("map", {
  //maxExtent: new OpenLayers.Bounds(minLon, minLat, maxLon, maxLat),
  //projection: new OpenLayers.Projection("EPSG:41001"),
  //displayProjection: new OpenLayers.Projection("EPSG:900913"),
  controls: [
   new OpenLayers.Control.Navigation(),
   new OpenLayers.Control.PanZoomBar(),
   new OpenLayers.Control.LayerSwitcher(),  /* Open the switch layers panel */
   new OpenLayers.Control.MousePosition({
    displayProjection: new OpenLayers.Projection('EPSG:900913'), 
    new OpenLayers.Bounds(minLon, minLat, maxLon, maxLat),
    emptyString:'?,?'})
  ],
  maxResolution: 'auto',
  units: 'meters',
  numZoomLevels: 6,
  });
  ----- Original Message ----- 
  From: Hareck 
  To: Mihai Visan 
  Cc: us...@openlayers.org 
  Sent: Thursday, December 09, 2010 10:50 AM
  Subject: Re: [OpenLayers-Users] display custom lon and lat on map


  Hi,

  please have a look at 
http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Control/MousePosition-js.html.

  You can use 

  new OpenLayers.Control.MousePosition({emptyString:'?,?'}) without 
displayProjection, then displayProjection of map is used.

  However you can also set the own displayProjection for Mouse.Position

  new OpenLayers.Control.MousePosition({displayProjection: new 
OpenLayers.Projection('EPSG:yxz'), emptyString:'?,?'})



  Harek

   

  ----- Original Message ----- 
    From: Mihai Visan 
    To: OpenLayers User list 
    Sent: Thursday, December 09, 2010 9:06 AM
    Subject: [OpenLayers-Users] display custom lon and lat on map


    Hi everybody

    I come back with a question that I didn't received an aswer.

    The situation is like this: I have a map with a Image as basic layer and I 
want to display mouse position as custom lan and lat. I have custom min and max 
lon and lat and I know image size. It probably have something to do with "new 
OpenLayers.Control.MousePosition()" control, but I can't figure it out. 

    Right now I receive only pixel position reported at image bounds (ex: 
231.0000, 456.0000) and I want something like this: 67548, 75324 lat lon

    thanks for help


----------------------------------------------------------------------------


    _______________________________________________
    Users mailing list
    us...@lists.osgeo.org
    http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to