More work on KaMap layer. This TIGER demo looks good, but it's really broken underneath.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@666 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
29
examples/tiger.html
Normal file
29
examples/tiger.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<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="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function init(){
|
||||
var map = new OpenLayers.Map('map', {'maxResolution': 1.2/4});
|
||||
|
||||
var ka_wms = new OpenLayers.Layer.KaMap( "KaMap", "http://maps.dmsolutions.ca/demo/us_streets/tile.php", {map:'tiger04', g:'__base__'}, new OpenLayers.LonLat(0,0));
|
||||
ka_wms.setTileSize(new OpenLayers.Size(300,300));
|
||||
map.addLayers([ka_wms]); // , ka_wms, kamap_wms]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.setCenter(new OpenLayers.LonLat(-70, 30), 2);
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Example</h1>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,7 +18,8 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
|
||||
// this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]);
|
||||
// kaMap.prototype.geoToPix = function( gX, gY ) { var pX = gX / this.cellSize; var pY = -1 * gY / this.cellSize; }
|
||||
initialize: function(name, url, params) {
|
||||
initialize: function(name, url, params, origin) {
|
||||
this.kaOrigin = origin;
|
||||
var newArguments = new Array();
|
||||
newArguments.push(name, url, params);
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
@@ -37,8 +38,8 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
// 1280000 is an empirical value for a specific tile server, not yet figured out the right way to do this in general.
|
||||
// This will probably be based on map.maxResolution.
|
||||
var cellSize = new OpenLayers.Size(resolution*this.tileSize.w, resolution*this.tileSize.h);
|
||||
var pX = Math.floor(bounds.left / cellSize.w) * this.tileSize.w;
|
||||
var pY = -Math.floor(bounds.top / cellSize.h) * this.tileSize.h;
|
||||
var pX = Math.floor(((bounds.left + this.kaOrigin.lon) / cellSize.w) * this.tileSize.w);
|
||||
var pY = -Math.floor(((bounds.top+this.kaOrigin.lat) / cellSize.h) * this.tileSize.h);
|
||||
var url = this.getFullRequestString(
|
||||
{ t: pY,
|
||||
l: pX,
|
||||
|
||||
Reference in New Issue
Block a user