[OpenLayers-Users] Ka-Map layer - kaOrigin?
Tim Langlois
tlanglois at archetypecorp.com
Tue Aug 15 12:06:32 CDT 2006
Make sure the tile width and height configured in ka-map's config.php
matches the size you are using with openlayers. You can check the error
logs of your webserver to see if openlayers is requesting image files
that do not exist. This is what happens when the tile sizes do not
match.
On Tue, 2006-08-15 at 10:12 -0500, Jeff Dege wrote:
> Among the things I've been trying, to see if I could get acceptable
> performance with the map data I've been working with, is to try the
> Ka-Map layer, hoping that the tile caches would make a difference.
>
> I've been unable to get the Ka-Map layer to work, and I've been digging
> into why.
>
> I'm working with the release-1.0 code.
>
> I'm declaring the layer as:
>
> var baseLayer = new OpenLayers.Layer.KaMap("Cities",
> "http://localhost:8080/kamap/tile.php?",
> { 'map': 'gmap', 'g': 'all', 'i': 'png' },
> 'degrees',
> 72 );
>
> and as far as I can see, that's correct. At least it matches the
> instructions at:
>
>
> http://mailman-viper.python-hosting.com/pipermail/users/2006-June/000058
> .html
>
> The problem is in KaMap.js - the initialize function takes four
> arguments:
>
> 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);
> this.params = (params ? params : {});
> if (arguments.length > 0 && params) {
> OpenLayers.Util.applyDefaults(
> this.params,
> this.DEFAULT_PARAMS
> );
> }
> },
> When I stick in an alert to print the values, 'name' = "Cities", 'url' =
> "http://localhost:8080/kamap/tile.php?", and 'origin' = "degrees".
>
> You can see that 'this.kaOrigin' is assigned "degrees".
>
> But in the next function, 'this.kaOrigin' is referenced as if it had lat
> and long member variables:
>
> addTile:function(bounds,position) {
> var zoom = this.map.getZoom();
> var resolution = this.map.getResolution();
> var scale = 128000000 / Math.pow(2, zoom);
> // 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 + 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,
> s: scale
> });
>
> The result is that pX and pY are both assigned values of NaN, and the
> URL returned by getFullRequestString() contains "t=NaN&l=NaN", which
> results in the KaMap server-side scripts drawing and returning empty
> tiles.
>
> >From what I can see, kaOrigin is only referenced in these two locations
> - there isn't any other code, anywhere else, that is changing it so that
> it contains lat and lon member values.
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://mailman-viper.python-hosting.com/listinfo/users
>
>
More information about the Users
mailing list