GeoWebCache into Leaflet.js

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GeoWebCache into Leaflet.js

Rob L

All,

 

I’m having problems with GeoWebCache, I have a Leaflet.js web mapping site using Proj4Leaflet which consumes 2 WMS feeds from Geoserver (2.3.3), both are Layer Groups (one base mapping the other is data) and everything displays  fine when I’m not using GWC.

 

When I enable caching on the base mapping Layer Group I get two different results at different zoom levels:

1.       At zoom levels 5, 6, 8 & 9: I get “geowebcache-cache-result: HIT”. However the images are misaligned/offset to the non-cached layers

2.       At zoom levels 7, 10, 11, 12, 13 & 14: I get “geowebcache-cache-result: MISS” and “geowebcache-miss-reason: request does not align to grid(s) 'Ordnance_Survey_National_Grid'”.  Because the cache isn’t used the layers align correctly

 

I have created a custom Gridset for this and it is British National Grid, EPSG:27700 (full specification at the foot of the email).

 

I’m really confused as the resolutions that I’ve defined in my web app exactly match the Gridset below and I can’t work out if I’ve got a problem with the Gridset or something in the Leaflet code.

 

If anyone could shed any light on this matter or point me in the right direction to troubleshoot it I’d greatly appreciate it.  Please let me know if any further information is required.

 

Kind regards,

 

Rob

 

 

 

<gridSet>

  <name>Ordnance_Survey_National_Grid</name>

  <srs>

    <number>27700</number>

  </srs>

  <extent>

    <coords>

      <double>1346.748175220855</double>

      <double>7097.996956234318</double>

      <double>671066.5126380573</double>

      <double>1230202.1293903186</double>

    </coords>

  </extent>

  <alignTopLeft>false</alignTopLeft>

  <resolutions>

    <double>5600.0</double>

    <double>2800.0</double>

    <double>1400.0</double>

    <double>700.0</double>

    <double>350.0</double>

    <double>175.0</double>

    <double>84.0</double>

    <double>42.0</double>

    <double>21.0</double>

    <double>11.2</double>

    <double>5.6</double>

    <double>2.8</double>

    <double>1.4</double>

    <double>0.7</double>

    <double>0.35</double>

    <double>0.14</double>

    <double>0.07</double>

  </resolutions>

  <metersPerUnit>1.0</metersPerUnit>

  <pixelSize>2.8E-4</pixelSize>

  <scaleNames>

    <string>Ordnance Survey National Grid:0</string>

    <string>Ordnance Survey National Grid:1</string>

    <string>Ordnance Survey National Grid:2</string>

    <string>Ordnance Survey National Grid:3</string>

    <string>Ordnance Survey National Grid:4</string>

    <string>Ordnance Survey National Grid:5</string>

    <string>Ordnance Survey National Grid:6</string>

    <string>Ordnance Survey National Grid:7</string>

    <string>Ordnance Survey National Grid:8</string>

    <string>Ordnance Survey National Grid:9</string>

    <string>Ordnance Survey National Grid:10</string>

    <string>Ordnance Survey National Grid:11</string>

    <string>Ordnance Survey National Grid:12</string>

    <string>Ordnance Survey National Grid:13</string>

    <string>Ordnance Survey National Grid:14</string>

    <string>Ordnance Survey National Grid:15</string>

    <string>Ordnance Survey National Grid:16</string>

  </scaleNames>

  <tileHeight>256</tileHeight>

  <tileWidth>256</tileWidth>

  <yCoordinateFirst>false</yCoordinateFirst>

</gridSet>

 

 

DISCLAIMER: The information contained in this communication/message from [hidden email] sent on Fri Nov  8 15:20:47 2013 is confidential. It is intended solely for the addressee(s) [hidden email]

Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.
As a public body, Salford City Council may be required to disclose this email [or any response to it] under the Freedom of Information Act 2000, unless the information in it is covered by one of the exemptions in the Act.
Please immediately contact the sender, [hidden email] if you have received this message in error.

For the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank you.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: GeoWebCache into Leaflet.js

Jonathan Moules-2
Hi Robert,
Comparing that to my own gridset, it's pretty much identical. The only two differences are:
You have an extra zoom-out level (1:20million?), and your bounding box has probably been automatically generated.
Mine is here:

 <gridSets>
    <gridSet>
      <name>UK_OSGB</name>
      <srs>
        <number>27700</number>
      </srs>
      <extent>
        <coords>
          <double>0.0</double>
          <double>0.0</double>
          <double>700000.0</double>
          <double>1300000.0</double>
        </coords>
      </extent>
      <alignTopLeft>false</alignTopLeft>
      <resolutions>
        <double>2800.0</double>
        <double>1400.0</double>
        <double>700.0</double>
        <double>350.0</double>
        <double>175.0</double>
        <double>84.0</double>
        <double>42.0</double>
        <double>21.0</double>
        <double>11.2</double>
        <double>5.6</double>
        <double>2.8</double>
        <double>1.4</double>
        <double>0.7</double>
        <double>0.35</double>
        <double>0.14</double>
        <double>0.07</double>
      </resolutions>
      <metersPerUnit>1.0</metersPerUnit>
      <pixelSize>2.8E-4</pixelSize>
      <scaleNames>
        <string>UK_OSGB:0</string>
        <string>UK_OSGB:1</string>
        <string>UK_OSGB:2</string>
        <string>UK_OSGB:3</string>
        <string>UK_OSGB:4</string>
        <string>UK_OSGB:5</string>
        <string>UK_OSGB:6</string>
        <string>UK_OSGB:7</string>
        <string>UK_OSGB:8</string>
        <string>UK_OSGB:9</string>
        <string>UK_OSGB:10</string>
        <string>UK_OSGB:11</string>
        <string>UK_OSGB:12</string>
        <string>UK_OSGB:13</string>
        <string>UK_OSGB:14</string>
        <string>UK_OSGB:15</string>
      </scaleNames>
      <tileHeight>256</tileHeight>
      <tileWidth>256</tileWidth>
      <yCoordinateFirst>false</yCoordinateFirst>
    </gridSet>


So there's probably nothing wrong with your gridset (mine works fine at least).

It certainly appears from your error that your application is using a different gridset (mine was doing similar things when they weren't identical).
My javaScript declaration (not leaflet):
resolutions: [2800,1400,700,350,175,84,42,21,11.2,5.6,2.8,1.4,0.7,0.35,0.14,0.07],

Maybe leaflet is doing something it shouldn't be?
Regards,

Jonathan

Jonathan Moules

GIS Analyst Programmer,
Corporate GIS,
Warwickshire County Council
Tel: +44 (0)1926 412588, (Internal: 2588)



On 8 November 2013 15:20, Langford, Robert <[hidden email]> wrote:

All,

 

I’m having problems with GeoWebCache, I have a Leaflet.js web mapping site using Proj4Leaflet which consumes 2 WMS feeds from Geoserver (2.3.3), both are Layer Groups (one base mapping the other is data) and everything displays  fine when I’m not using GWC.

 

When I enable caching on the base mapping Layer Group I get two different results at different zoom levels:

1.       At zoom levels 5, 6, 8 & 9: I get “geowebcache-cache-result: HIT”. However the images are misaligned/offset to the non-cached layers

2.       At zoom levels 7, 10, 11, 12, 13 & 14: I get “geowebcache-cache-result: MISS” and “geowebcache-miss-reason: request does not align to grid(s) 'Ordnance_Survey_National_Grid'”.  Because the cache isn’t used the layers align correctly

 

I have created a custom Gridset for this and it is British National Grid, EPSG:27700 (full specification at the foot of the email).

 

I’m really confused as the resolutions that I’ve defined in my web app exactly match the Gridset below and I can’t work out if I’ve got a problem with the Gridset or something in the Leaflet code.

 

If anyone could shed any light on this matter or point me in the right direction to troubleshoot it I’d greatly appreciate it.  Please let me know if any further information is required.

 

Kind regards,

 

Rob

 

 

 

<gridSet>

  <name>Ordnance_Survey_National_Grid</name>

  <srs>

    <number>27700</number>

  </srs>

  <extent>

    <coords>

      <double>1346.748175220855</double>

      <double>7097.996956234318</double>

      <double>671066.5126380573</double>

      <double>1230202.1293903186</double>

    </coords>

  </extent>

  <alignTopLeft>false</alignTopLeft>

  <resolutions>

    <double>5600.0</double>

    <double>2800.0</double>

    <double>1400.0</double>

    <double>700.0</double>

    <double>350.0</double>

    <double>175.0</double>

    <double>84.0</double>

    <double>42.0</double>

    <double>21.0</double>

    <double>11.2</double>

    <double>5.6</double>

    <double>2.8</double>

    <double>1.4</double>

    <double>0.7</double>

    <double>0.35</double>

    <double>0.14</double>

    <double>0.07</double>

  </resolutions>

  <metersPerUnit>1.0</metersPerUnit>

  <pixelSize>2.8E-4</pixelSize>

  <scaleNames>

    <string>Ordnance Survey National Grid:0</string>

    <string>Ordnance Survey National Grid:1</string>

    <string>Ordnance Survey National Grid:2</string>

    <string>Ordnance Survey National Grid:3</string>

    <string>Ordnance Survey National Grid:4</string>

    <string>Ordnance Survey National Grid:5</string>

    <string>Ordnance Survey National Grid:6</string>

    <string>Ordnance Survey National Grid:7</string>

    <string>Ordnance Survey National Grid:8</string>

    <string>Ordnance Survey National Grid:9</string>

    <string>Ordnance Survey National Grid:10</string>

    <string>Ordnance Survey National Grid:11</string>

    <string>Ordnance Survey National Grid:12</string>

    <string>Ordnance Survey National Grid:13</string>

    <string>Ordnance Survey National Grid:14</string>

    <string>Ordnance Survey National Grid:15</string>

    <string>Ordnance Survey National Grid:16</string>

  </scaleNames>

  <tileHeight>256</tileHeight>

  <tileWidth>256</tileWidth>

  <yCoordinateFirst>false</yCoordinateFirst>

</gridSet>

 

 

DISCLAIMER: The information contained in this communication/message from [hidden email] sent on Fri Nov  8 15:20:47 2013 is confidential. It is intended solely for the addressee(s) [hidden email]

Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.
As a public body, Salford City Council may be required to disclose this email [or any response to it] under the Freedom of Information Act 2000, unless the information in it is covered by one of the exemptions in the Act. 
Please immediately contact the sender, [hidden email] if you have received this message in error. 

For the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank you.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users



This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: GeoWebCache into Leaflet.js

Rob L

Jonathan – Thanks for your input, you were correct it was Leaflet (well my incorrect use of it!).

 

For anyone else struggling;

 

When I’d defined the CRS (EPSG:27700) using Proj4Leaflet, I defined the projection and resolutions but didn’t define the origin (it wasn’t in the example I was following), therefore tiles were right resolution but wrong co-ords, so WMS was working but anything Tiled wasn’t.

 

Working JavaScript for reference is:

 

var crs = new L.Proj.CRS( 'EPSG:27700',

  '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000' +

  '+ellps=airy +datum=OSGB36 +units=m +no_defs',

  {

    origin: [350000, 380000],

    resolutions: [

      5600, 2800, 1400, 700, 350, 175, 84, 42, 21, 11.2, 5.6, 2.8, 1.4, 0.7, 0.35, 0.14, 0.07

    ]

  }

);

 

Where the origin values are the ‘Min X’ and ‘Min Y’ from the Geoserver Gridset (changed from my initial email).

 

Rob

 

From: Jonathan Moules [mailto:[hidden email]]
Sent: 13 November 2013 17:14
To: Langford, Robert
Cc: [hidden email]
Subject: [Maybe Spam]Re: [Geoserver-users] GeoWebCache into Leaflet.js

 

Hi Robert,

Comparing that to my own gridset, it's pretty much identical. The only two differences are:

You have an extra zoom-out level (1:20million?), and your bounding box has probably been automatically generated.

Mine is here:

 

 <gridSets>

    <gridSet>

      <name>UK_OSGB</name>

      <srs>

        <number>27700</number>

      </srs>

      <extent>

        <coords>

          <double>0.0</double>

          <double>0.0</double>

          <double>700000.0</double>

          <double>1300000.0</double>

        </coords>

      </extent>

      <alignTopLeft>false</alignTopLeft>

      <resolutions>

        <double>2800.0</double>

        <double>1400.0</double>

        <double>700.0</double>

        <double>350.0</double>

        <double>175.0</double>

        <double>84.0</double>

        <double>42.0</double>

        <double>21.0</double>

        <double>11.2</double>

        <double>5.6</double>

        <double>2.8</double>

        <double>1.4</double>

        <double>0.7</double>

        <double>0.35</double>

        <double>0.14</double>

        <double>0.07</double>

      </resolutions>

      <metersPerUnit>1.0</metersPerUnit>

      <pixelSize>2.8E-4</pixelSize>

      <scaleNames>

        <string>UK_OSGB:0</string>

        <string>UK_OSGB:1</string>

        <string>UK_OSGB:2</string>

        <string>UK_OSGB:3</string>

        <string>UK_OSGB:4</string>

        <string>UK_OSGB:5</string>

        <string>UK_OSGB:6</string>

        <string>UK_OSGB:7</string>

        <string>UK_OSGB:8</string>

        <string>UK_OSGB:9</string>

        <string>UK_OSGB:10</string>

        <string>UK_OSGB:11</string>

        <string>UK_OSGB:12</string>

        <string>UK_OSGB:13</string>

        <string>UK_OSGB:14</string>

        <string>UK_OSGB:15</string>

      </scaleNames>

      <tileHeight>256</tileHeight>

      <tileWidth>256</tileWidth>

      <yCoordinateFirst>false</yCoordinateFirst>

    </gridSet>

 

 

So there's probably nothing wrong with your gridset (mine works fine at least).

 

It certainly appears from your error that your application is using a different gridset (mine was doing similar things when they weren't identical).

My javaScript declaration (not leaflet):

            resolutions: [2800,1400,700,350,175,84,42,21,11.2,5.6,2.8,1.4,0.7,0.35,0.14,0.07],

 

Maybe leaflet is doing something it shouldn't be?

Regards,

 

Jonathan


Jonathan Moules

GIS Analyst Programmer,
Corporate GIS,
Warwickshire County Council
Tel: +44 (0)1926 412588, (Internal: 2588)

 

On 8 November 2013 15:20, Langford, Robert <[hidden email]> wrote:

All,

 

I’m having problems with GeoWebCache, I have a Leaflet.js web mapping site using Proj4Leaflet which consumes 2 WMS feeds from Geoserver (2.3.3), both are Layer Groups (one base mapping the other is data) and everything displays  fine when I’m not using GWC.

 

When I enable caching on the base mapping Layer Group I get two different results at different zoom levels:

1.       At zoom levels 5, 6, 8 & 9: I get “geowebcache-cache-result: HIT”. However the images are misaligned/offset to the non-cached layers

2.       At zoom levels 7, 10, 11, 12, 13 & 14: I get “geowebcache-cache-result: MISS” and “geowebcache-miss-reason: request does not align to grid(s) 'Ordnance_Survey_National_Grid'”.  Because the cache isn’t used the layers align correctly

 

I have created a custom Gridset for this and it is British National Grid, EPSG:27700 (full specification at the foot of the email).

 

I’m really confused as the resolutions that I’ve defined in my web app exactly match the Gridset below and I can’t work out if I’ve got a problem with the Gridset or something in the Leaflet code.

 

If anyone could shed any light on this matter or point me in the right direction to troubleshoot it I’d greatly appreciate it.  Please let me know if any further information is required.

 

Kind regards,

 

Rob

 

 

 

<gridSet>

  <name>Ordnance_Survey_National_Grid</name>

  <srs>

    <number>27700</number>

  </srs>

  <extent>

    <coords>

      <double>1346.748175220855</double>

      <double>7097.996956234318</double>

      <double>671066.5126380573</double>

      <double>1230202.1293903186</double>

    </coords>

  </extent>

  <alignTopLeft>false</alignTopLeft>

  <resolutions>

    <double>5600.0</double>

    <double>2800.0</double>

    <double>1400.0</double>

    <double>700.0</double>

    <double>350.0</double>

    <double>175.0</double>

    <double>84.0</double>

    <double>42.0</double>

    <double>21.0</double>

    <double>11.2</double>

    <double>5.6</double>

    <double>2.8</double>

    <double>1.4</double>

    <double>0.7</double>

    <double>0.35</double>

    <double>0.14</double>

    <double>0.07</double>

  </resolutions>

  <metersPerUnit>1.0</metersPerUnit>

  <pixelSize>2.8E-4</pixelSize>

  <scaleNames>

    <string>Ordnance Survey National Grid:0</string>

    <string>Ordnance Survey National Grid:1</string>

    <string>Ordnance Survey National Grid:2</string>

    <string>Ordnance Survey National Grid:3</string>

    <string>Ordnance Survey National Grid:4</string>

    <string>Ordnance Survey National Grid:5</string>

    <string>Ordnance Survey National Grid:6</string>

    <string>Ordnance Survey National Grid:7</string>

    <string>Ordnance Survey National Grid:8</string>

    <string>Ordnance Survey National Grid:9</string>

    <string>Ordnance Survey National Grid:10</string>

    <string>Ordnance Survey National Grid:11</string>

    <string>Ordnance Survey National Grid:12</string>

    <string>Ordnance Survey National Grid:13</string>

    <string>Ordnance Survey National Grid:14</string>

    <string>Ordnance Survey National Grid:15</string>

    <string>Ordnance Survey National Grid:16</string>

  </scaleNames>

  <tileHeight>256</tileHeight>

  <tileWidth>256</tileWidth>

  <yCoordinateFirst>false</yCoordinateFirst>

</gridSet>

 

 

DISCLAIMER: The information contained in this communication/message from [hidden email] sent on Fri Nov  8 15:20:47 2013 is confidential. It is intended solely for the addressee(s) [hidden email]
 
Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.
As a public body, Salford City Council may be required to disclose this email [or any response to it] under the Freedom of Information Act 2000, unless the information in it is covered by one of the exemptions in the Act. 
Please immediately contact the sender, [hidden email] if you have received this message in error. 
 
For the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank you.


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

 


This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

DISCLAIMER: The information contained in this communication/message from [hidden email] sent on Thu Nov 14 11:12:47 2013 is confidential. It is intended solely for the addressee(s) [hidden email];[hidden email]

Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.
As a public body, Salford City Council may be required to disclose this email [or any response to it] under the Freedom of Information Act 2000, unless the information in it is covered by one of the exemptions in the Act.
Please immediately contact the sender, [hidden email] if you have received this message in error.

For the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank you.

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users