Opened 9 years ago

Last modified 7 years ago

#1302 assigned feature

Add a gridOrigin parameter to align the grid to the grid of a WMS-C server.

Reported by: pascalou Owned by: crschmidt
Priority: minor Milestone: 2.13 Release
Component: Layer.Grid Version: 2.5
Keywords: wmsc grid origin alignment Cc: pascal.pons@…
State: Needs More Work


  • Motivation of this feature:

We want to use a WMS-C source (, We used the regular WMS Openlayer layer. The problem is that a WMSC server only serve tiles that are exactly aligned to its specific cache grid. Grids.js uses the bottom left corner of the map.maxextent as the origin of the grid, which is unfortunately not the case of our WMS-C server: our origin is (0,0).

  • Functionalities:

Compute the offsets of the requested tiles from a specified gridOrigin. If gridOrigin is not specified, use the previous map.maxExtent origin. This allows to align the requested tiles to a grid origin imposed by the WMS-C server.

  • Changes to API:

Add a new optional Api Property on Grid giving the LonLat grid origin.

  • Suggested strategies:

I made a very small patch on Grid.js that add a gridOrigin ApiProperty. I don't know if the variable can be simply named "origin" but this variable seems to be used on line 339 "this.origin = new OpenLayers.Pixel(tileoffsetx, tileoffsety);". I don't understand, this line that seems to be useless in the code ??

  • Alternatives:

Add a specific WMS-C layer class that will manage the alignment of the requested tiles ?

  • Sideaffects or complications:

I don't have a sufficient overview of the project to see Sideaffects. But it seems to be a very minor modifications.

Attachments (2)

gridOrigin.patch (2.3 KB) - added by pascalou 9 years ago.
patch on revision 5834
gridOrigin.2.patch (4.8 KB) - added by crschmidt 8 years ago.

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by pascalou

patch on revision 5834

comment:1 Changed 9 years ago by pascalou

  • Keywords review added

comment:2 Changed 9 years ago by pspencer

  • Keywords review removed
  • Milestone set to 2.7 Release
  • State set to Needs More Work

I like this idea of this patch, but its going to require a bit more work. Specifically, we will need some tests. Also, I'd like to understand if this can be used to remove the necessity for the KaMap layer to override initGriddedTiles (although I don't think it does).

Targetting for 2.7 now because we have a lot to do for 2.6 and I don't see anyone being able to wrap their heads around the implications of this in the next couple of weeks.

comment:3 Changed 8 years ago by euzuro

  • Milestone changed from 2.7 Release to 2.8 Release

not a lot of interest.

Changed 8 years ago by crschmidt

comment:4 Changed 8 years ago by crschmidt

Needs tests; working on it. Existing Layer tests all pass still.

ka-Map and MapGuide still have a custom getGridLayout function; ka-Map actually has no change here, but MapGuide now lets you set the gridOrigin as well.

comment:5 Changed 8 years ago by crschmidt

(In [8930]) "Remove unused 'tileOrigin' code from TileCache layer", (Closes #1076). Though the idea behind this is good, having the code here and unused is not the right thing to do. (See #1302) for a better attempt at what this should actually be. The reason this code exists is almost certainly a carggocult from Layer.TMS, which *does* have a tileOrigin, and I'm pretty sure tschaub started by copying from that. r=me, though it's mostly just docs.

comment:6 Changed 8 years ago by crschmidt

  • Owner changed from euzuro to crschmidt
  • Status changed from new to assigned

comment:7 Changed 8 years ago by crschmidt

  • Milestone changed from 2.8 Release to 2.9 Release

bumping to 2.9, since the primary motivation I had for getting this in trunk was the ArcGIS cache stuff, and that's just too big a change to get in this late.

comment:8 Changed 7 years ago by bartvde

  • Milestone changed from 2.9 Release to 2.10 Release
Note: See TracTickets for help on using tickets.