[OpenLayers-Users] new user questions

Greg Donald gdonald at gmail.com
Sat Oct 4 14:48:14 EDT 2008


I've been learning the Openlayers API for several days now and have
some questions I can't seem to find answers for in the mailing list
archives.


1) How can I construct bounds that only have positive numbers?  When I
try this bit of code I still get negative numbers in my tile requests:

maxExtent: new OpenLayers.Bounds( 0, 0, 300000, 7000000 )

Is it possible to make a grid that works top-down, left to right, 0 up
to whatever, both horizontally and vertically?

0 1 2 3
1
2
3


2) I want to create 5 different depths of data display.  Do I need to
construct 5 individual layers or is one layer sufficient since I plan
to request tiles based on coordinates?  I don't see any sort of
"layer" variable arriving in my tile request variables.

layer = new OpenLayers.Layer.MapServer( "Level 1", "/image/", {}, {} );

http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Layer/MapServer-js.html

I've read the above URL, but where can I find api documentation for
the last two constructor parameters?  Is this possibly where I would
define the "layer" I'm requesting as far the tile requests?


3) Where can I find documenation for these tile request variables?

{"imgy"=>"128", "map_imagetype"=>"png", "imgext"=>"-1680 1000 -1320
1360", "mode"=>"map", "imgxy"=>"256 256", "map_size"=>"256 256",
"mapext"=>"-1680 1000 -1320 1360", "imgx"=>"128"}

Looking at the "imgext" request variable, is -1680,1000 the bottom
left and -1320,1360 the top right?  How does this corelate to a
256x256 tile size?

What's the difference between "imgext" and "mapext"?  They always seem
to be the same.

Why isn't map_size "300000 7000000" like I defined it above?


Here's my code so far:

<script type="text/javascript">
var lon = 0;
var lat = 0;
var zoom = 1;
var map, layer;
function init()
{
  var options = {
    numZoomLevels: 1,
    maxExtent: new OpenLayers.Bounds( 0, 0, 300000, 7000000 ),
  };
  map = new OpenLayers.Map( 'map', options );

  layer = new OpenLayers.Layer.MapServer( "Level 1", "/image/", {} );
  map.addLayer( layer );

  map.setCenter( new OpenLayers.LonLat( lon, lat ), zoom );
  map.removeControl( map.controls[ 1 ] );
  map.addControl( new OpenLayers.Control.LayerSwitcher()    );
  map.addControl( new OpenLayers.Control.PanZoomBar()       );
  map.addControl( new OpenLayers.Control.MousePosition()    );
  map.addControl( new OpenLayers.Control.OverviewMap()      );
  map.addControl( new OpenLayers.Control.KeyboardDefaults() );
}
</script>
<div id="map"></div>



Thanks,


-- 
Greg Donald
http://destiney.com/



More information about the Users mailing list