OpenLayers OpenLayers

Ticket #327 (new feature)

Opened 2 years ago

Last modified 3 months ago

Ka-map non-baselayers not transparent if image types inconsistent

Reported by: anonymous Assigned to: crschmidt
Priority: critical Milestone: 2.8 Release
Component: Layer.KaMap Version:
Keywords: ka-map ttransparency Cc: pedrosimonetti@gmail.com
State: Review

Description

When you're using ka-map layers, there are three places where you specify whether you want GIF, a PNG, or a JPEG image tiles: in the mapfile, in kamap\config.php, and with the i option in the layer constructor.

The IMAGETYPE setting in the mapfile seems to be ignored.

The 'format' option in the $aszMapFiles array of config.php also seems at first glance to be ignored, because if you set 'i': 'gif' in the OpenLayers.Layer.KaMap constructor, it's GIF files you get.

Except - if the image type is PNG in config.php, and GIF in the layer constructor, and the layer is not a base layer, the GIF is created with a white background color, instead of a transparent background color.

If the two image types match, the tiles are created with transparent backgrounds. If they don't, they are not.

Attachments

tile.php.patch (11.8 kB) - added by openlayers on 04/10/08 18:21:52.
KaMap.patch (1.0 kB) - added by openlayers on 04/10/08 18:22:32.
KaMapOverlayFix.v2.patch (13.2 kB) - added by openlayers on 04/16/08 09:42:47.
config.php.txt (11.6 kB) - added by openlayers on 04/16/08 09:46:09.

Change History

10/16/06 11:39:47 changed by jdege@korterra.com

I see I inadvertently created this as user anonymous. If anyone should have questions, feel free to email me.

10/25/06 06:17:26 changed by euzuro

  • owner set to crschmidt.
  • component changed from general to Layer.KaMap.

05/23/07 23:19:03 changed by crschmidt

  • milestone set to 2.5 Release.

07/15/07 09:20:43 changed by crschmidt

  • status changed from new to closed.
  • resolution set to fixed.

I'm not sure that OpenLayers can do anything about this. We can only control what we send as parameters. However, I have added additional documentation in the constructor in an attempt to alleviate the pain that this causes, referencing this ticket.

Thanks for the feedback, and sorry for any inconvenience this has caused you. if you feel there is a solution that has been ignored, please reopen this ticket with a comment.

04/10/08 18:21:17 changed by openlayers

  • status changed from closed to reopened.
  • state changed.
  • resolution deleted.
  • milestone changed from 2.5 Release to 2.6 Release.

There is a problem in the "tile.php" file (named "examples/kamap.txt") related to ka-Map overlays. http://trac.openlayers.org/ticket/327

The solution is actually very simple. The code was missing to uppercase the output format, so if you set your map in .js with "i" equals to "gif", the code won't cacth this, and will use de default value from "tile.php" configuration section.

I've break this file in two files "tile.php" and "config.php" to allow a single configuration file be shared with both "tile.php" and "precache.php" (I'll discuss prepache changes in another thread).

I'll posting a patch on the tracker for this issue.

Here goes a suggestion. Since there will be 3 different php files related to ka-Map, I think will be good, to create another directory for those files, maybe in "examples/kaMap", for example. I think also that is good to put those files named "tile.php.txt", "config.php.txt", and "precache.php.txt", to a better readibility.

This changes required a little change in KaMap.js, because the constant "OpenLayers.Layer.KaMap.DEFAULT_PARAMS" souldn't be used, as the default output format is taken from "config.php" file.

So, I'll post in the tracker a separated patch for this.

Here a simple example of creating two ka-Map layers:

// The output format used will be that informed at "config.php", // since the parameter "i" was not used. var kamap_base = new OpenLayers.Layer.KaMap(

"Satellite", "http://www.openlayers.org/world/tile.php", {g: "satellite", map: "world"}

);

// Create an ka-Map overlay layer (using "isBaseLayer: false"). Forces // the output to be a "gif", using the "i" parameter. var kamap_overlay = new OpenLayers.Layer.KaMap(

"Streets", "http://www.openlayers.org/world/tile.php", {g: "streets", map: "world", i: "gif"}, {isBaseLayer: false}

);

regards,

Pedro Simonetti.

PS: I'm reopening this ticket as suggested in the last comment

04/10/08 18:21:52 changed by openlayers

  • attachment tile.php.patch added.

04/10/08 18:22:32 changed by openlayers

  • attachment KaMap.patch added.

04/10/08 18:22:55 changed by crschmidt

  • milestone changed from 2.6 Release to 2.7 Release.

04/10/08 18:24:22 changed by openlayers

NOTE: Since there isn't a file "config.php.txt" yet, I've just uploaded this file instead of adding a patch.

04/16/08 09:41:58 changed by openlayers

After some discussion with Paul [1] about the directory structure isse, I've made some changes as he suggested. So, the patch that sould be used is this second version I'm publishing here.

[1] http://www.nabble.com/Patch-for-a-ka-Map-cached-layer-tp16623387p16623662.html

04/16/08 09:42:47 changed by openlayers

  • attachment KaMapOverlayFix.v2.patch added.

04/16/08 09:46:09 changed by openlayers

  • attachment config.php.txt added.

05/02/08 14:11:42 changed by pedrosimonetti

  • cc set to pedrosimonetti@gmail.com.

I've reopened this ticket at: http://trac.openlayers.org/ticket/327#comment:5

I've created a trac account, so I'm posting here to get involved with the development of this feature.

07/28/08 12:36:33 changed by crschmidt

  • priority changed from minor to critical.

07/28/08 13:45:07 changed by pedrosimonetti

Hi Developers,

I'm still tracking the changes on this ticket, and I'm available to help.

08/26/08 04:05:46 changed by euzuro

  • state set to Review.

09/03/08 18:26:10 changed by crschmidt

  • status changed from reopened to new.

09/03/08 20:06:17 changed by crschmidt

  • milestone changed from 2.7 Release to 2.8 Release.