 <?xml-stylesheet type="text/css" href="https://www.esdm.co.uk/Data/style/rss1.css" ?> <?xml-stylesheet type="text/xsl" href="https://www.esdm.co.uk/Data/style/rss1.xsl" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
  <channel>
    <title>The knowledge base blog</title>
    <link>https://www.esdm.co.uk/knowledge</link>
    <description />
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>mojoPortal Blog Module</generator>
    <language>en-GB</language>
    <ttl>120</ttl>
    <atom:link href="https://www.esdm.co.uk/Blog/RSS.aspx?p=138~108~55" rel="self" type="application/rss+xml" />
    <itunes:owner />
    <itunes:explicit>no</itunes:explicit>
    <item>
      <title>How to hide the MapServer map file location on IIS (without writing any code)</title>
      <description><![CDATA[<p>We posted some notes a few days ago on <a href="https://www.esdm.co.uk/how-to-install-the-latest-version-of-mapserver-on-windows" target="_blank">how to set up MapServer WMS/WFS server on IIS</a>. Someone called Dennis has commented appreciatively, but asked how to hide the location of the .map file and <a href="http://mapserver.org/ogc/wms_server.html#changing-the-online-resource-url" target="_blank">create a cleaner URL with a cgi-wrapper, as described in the MapServer documentation</a>. Well that documentation page does tell you how to do it on IIS, with ASP script, but here’s a much simpler way that requires no hacking.</p>

<p>Aside: I should say that what follows is not what we normally do in our real applications – we usually use ASP.Net .ashx handlers to relay requests through the root of our web sites, which also helps to avoid cross-domain problems with GetFeatureInfo responses and WFS, but that’s another story! This post is in reaction to Dennis’s request for help, and because I wanted to check this approach is viable.</p>

<p>I’ve posted before on <a href="https://www.esdm.co.uk/presenting-geoserver-on-port-80-on-a-windows-iis-server" target="_blank">how to use URL Rewrite to give GeoServer a friendly URL on IIS</a>, and we’re going to use the same technique here, so first ensure you have the necessaries installed.</p>

<p>You should also already have a working WMS/WFS – we created this one in the previous post:</p>

<p><a href="http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map" title="http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map">http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map</a></p>

<p>which was fine, but a) the URL reveals some information about the structures on the web server, and b) the URL is a bit ugly.</p>

<p>So decide what address you want for your MapServer service (remembering this will be specific right down to the map file). I’m using “mapservertestwrapper.esdm.co.uk” which I have pointed at the web server in question.</p>

<p>Create a new web site in IIS with this URL as a host header (you’ll first need to create an empty “physical” folder for the site to point at – add a readme.config file explaining what it’s for).</p>

<p>Now open URL Rewrite and create a reverse proxy inbound rule, entering the real service address as the forwarding address:</p>

<p><img alt="Creating the reverse proxy inbound rule" border="0" height="480" src="https://www.esdm.co.uk/Data/Sites/1/media/wlw/image_97.png" style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="Creating the reverse proxy inbound rule" width="476" /></p>

<p>OK now we should be able to see our MapServer on the new URL. However, when we visit <a href="http://mapservertestwrapper.esdm.co.uk/" title="http://mapservertestwrapper.esdm.co.uk/">http://mapservertestwrapper.esdm.co.uk/</a> we get this feedback in the browser:</p>

<p>msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed. msEvalRegex(): Regular expression error. String failed expression test.</p>

<p>The fix is to re-edit the inbound rule, and remove the final “/” in the “rewrite URL”, going from:</p>

<p>http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map/{R:1}</p>

<p>to:</p>

<p>http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map{R:1}</p>

<p>Now we should get sensible MapServer feedback in the browser (conditioned by a template specified in the map file).</p>

<p>Now let’s see if we can do a GetCapabilities request… turns out our URL has to be this:</p>

<p><a href="http://mapservertestwrapper.esdm.co.uk/?service=wms&amp;version=1.3.0&amp;request=getcapabilities" title="http://mapservertestwrapper.esdm.co.uk/?service=wms&amp;version=1.3.0&amp;request=getcapabilities">http://mapservertestwrapper.esdm.co.uk/?service=wms&amp;version=1.3.0&amp;request=getcapabilities</a></p>

<p>Yes it works, but a) that’s a slightly odd URL with “/?”, and b) the response contains the original service addresses, again revealing information about our server.</p>

<p>To fix a), we go back and edit our inbound rule again, and change the “pattern” from “(.*)” to “map1(.*)” (without the quotes of course). Now our service URL becomes:</p>

<p><a href="http://mapservertestwrapper.esdm.co.uk/map1?service=wms&amp;version=1.3.0&amp;request=getcapabilities" title="http://mapservertestwrapper.esdm.co.uk/map1?service=wms&amp;version=1.3.0&amp;request=getcapabilities">http://mapservertestwrapper.esdm.co.uk/map1?service=wms&amp;version=1.3.0&amp;request=getcapabilities</a></p>

<p>Ah yes that’s much nicer, and now of course we see we can manage lots of .map files within one web site simply by setting up in inbound rule for each, with an appropriate pattern and target.</p>

<p>To fix b) we can edit the metadata in the .map file to set this:</p>

<p>"wms_onlineresource"&nbsp;&nbsp;&nbsp; "http://mapservertestwrapper.esdm.co.uk/map1"</p>

<p>This works fine, returning this within the GetCapabilities:</p>

<p><a>&lt;OnlineResource xlink:href="http://mapservertestwrapper.esdm.co.uk/map1?" xmlns:xlink="http://www.w3.org/1999/xlink"/&gt;</a></p>

<p>And I can confirm this creates a working map in QGIS, with map requests like this <a href="https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler" target="_blank">visible in Fiddler</a>:</p>

<p><a href="http://mapservertestwrapper.esdm.co.uk/map1?SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetMap&amp;BBOX=52801.44371538766426966,3347.3560407145996578,657116.82161524775438011,428145.51874091033823788&amp;CRS=EPSG:27700&amp;WIDTH=1020&amp;HEIGHT=717&amp;LAYERS=grid&amp;STYLES=&amp;FORMAT=image/png&amp;DPI=96&amp;MAP_RESOLUTION=96&amp;FORMAT_OPTIONS=dpi:96&amp;TRANSPARENT=TRUE" title="http://mapservertestwrapper.esdm.co.uk/map1?SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetMap&amp;BBOX=52801.44371538766426966,3347.3560407145996578,657116.82161524775438011,428145.51874091033823788&amp;CRS=EPSG:27700&amp;WIDTH=1020&amp;HEIGHT=717&amp;LAYERS=grid&amp;STYLES=&amp;FORMAT=image/png&amp;DPI=96&amp;MAP_RESOLUTION=96&amp;FORMAT_OPTIONS=dpi:96&amp;TRANSPARENT=TRUE&#10;">http://mapservertestwrapper.esdm.co.uk/map1?SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetMap&amp;BBOX=52801.44371538766426966,3347.3560407145996578,657116.82161524775438011,428145.51874091033823788&amp;CRS=EPSG:27700&amp;WIDTH=1020&amp;HEIGHT=717&amp;LAYERS=grid&amp;STYLES=&amp;FORMAT=image/png&amp;DPI=96&amp;MAP_RESOLUTION=96&amp;FORMAT_OPTIONS=dpi:96&amp;TRANSPARENT=TRUE</a></p>

<p><img alt="image" border="0" height="426" src="https://www.esdm.co.uk/Data/Sites/1/media/wlw/image_98.png" style="border: 0px currentColor; border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" width="640" /></p>

<p>And a quick test shows that info clicking (GetFeatureInfo) and legends work too:</p>

<p>e.g. <a href="http://mapservertestwrapper.esdm.co.uk/map1?version=1.3.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;sld_version=1.1.0&amp;layer=grid&amp;format=image/png&amp;STYLE=default" title="http://mapservertestwrapper.esdm.co.uk/map1?version=1.3.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;sld_version=1.1.0&amp;layer=grid&amp;format=image/png&amp;STYLE=default">http://mapservertestwrapper.esdm.co.uk/map1?version=1.3.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;sld_version=1.1.0&amp;layer=grid&amp;format=image/png&amp;STYLE=default</a></p>

<p>gives this:</p>

<p><img alt="GetLegendGraphic image" src="http://mapservertestwrapper.esdm.co.uk/map1?version=1.3.0&amp;service=WMS&amp;request=GetLegendGraphic&amp;sld_version=1.1.0&amp;layer=grid&amp;format=image/png&amp;STYLE=default" title="GetLegendGraphic image" /></p>

<p>There you go Dennis, we have working OGC services from MapServer with nice clean URLs, a simple architecture for adding new services with their own map files, and no leaking of details about our directory structures.</p>

<p>&nbsp;</p>

<h3>Footnote…</h3>

<p>I’m not completely keen on the last bit, having to change the wms_onlineresource, as this means the original service is now broken (depending on whether the mapping client makes us of this, which QGIS likes to). Another way <em>should be</em>&nbsp; to create an outbound URL Rewrite rule to rewrite any references to the original URL with the new one. However, after a bit of pfaffing with this, I’m pretty sure there’s a bug in URL Rewrite that means outbound rewriting doesn’t work for attributes containing colons, and ours is “xlink:href”. Incidentally setting up the outbound rules for custom tags is a bit of an adventure through the UI, and there is a bit of escaping to do for the backslashes and question mark in the URL (<font style="background-color: rgb(255, 255, 0);">highlighted</font> below) as URL Rewrite is doing regular expressions so you might as well get down and dirty in the web.config located in the “dummy” folder we created for the new web site we created earlier. So this is my outbound rule that <em>doesn’t work,</em> but should when someone fixes the bug!</p>

<p><font face="Courier New">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;configuration&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;system.webServer&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;rewrite&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;rules&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;rule name="ReverseProxyInboundRule2" stopProcessing="true"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;match url="map1(.*)" /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="Rewrite" url="</font><a href="http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map{R:1}&quot;"><font face="Courier New">http://mapservertest.esdm.co.uk/scripts/mapserv.exe?map=D:\Websites\mapservertest\map\mapfiletest.map{R:1}"</font></a><font face="Courier New"> /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/rule&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/rules&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;outboundRules&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsXML" enabled="true"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;match filterByTags="CustomTags" customTags="OGC GetCapabilities" pattern="^http(s)?://mapservertest.esdm.co.uk/scripts/mapserv.exe<font style="background-color: rgb(255, 255, 0);">\?map=D:\\Websites\\mapservertest\\map\\</font>mapfiletest.map(.*)" /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action type="Rewrite" value="http{R:1}://mapservertestwrapper.esdm.co.uk/map1{R:2}" /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/rule&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;preConditions&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;preCondition name="ResponseIsHtml1"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/preCondition&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;preCondition name="ResponseIsXML"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/xml" /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/preCondition&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/preConditions&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;customTags&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tags name="OGC GetCapabilities"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tag name="OnlineResource" attribute="<font style="background-color: rgb(255, 0, 0);">xlink:href</font>" /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tags&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/customTags&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/outboundRules&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/rewrite&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/system.webServer&gt;<br />
&lt;/configuration&gt;</font></p>

<p>&nbsp;</p>

<p>The <font style="background-color: rgb(255, 0, 0);">red bit</font> is the bit affected by the bug I think, unless someone can point out how this should be escaped/expressed to make it work?</p>
<br /><a href='https://www.esdm.co.uk/how-to-hide-the-mapserver-map-file-location-on-iis'>Crispin Flower</a>&nbsp;&nbsp;<a href='https://www.esdm.co.uk/how-to-hide-the-mapserver-map-file-location-on-iis'>...</a>]]></description>
      <link>https://www.esdm.co.uk/how-to-hide-the-mapserver-map-file-location-on-iis</link>
      <author>crispin.flower@idoxgroup.com (Crispin Flower)</author>
      <comments>https://www.esdm.co.uk/how-to-hide-the-mapserver-map-file-location-on-iis</comments>
      <guid isPermaLink="true">https://www.esdm.co.uk/how-to-hide-the-mapserver-map-file-location-on-iis</guid>
      <pubDate>Sat, 12 Apr 2014 11:29:00 GMT</pubDate>
    </item>
    <item>
      <title>Invalid column name problem with GeoServer 2.3 and SQL Server views</title>
      <description><![CDATA[<p>I have been getting this error with a WMS layer based on a SQL Server 2008 view, when using a GetFeatureInfo request:</p>

<pre>
<code><span style="font: small/normal Verdana, Geneva, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">java.lang.RuntimeException: java.io.IOException java.io.IOException null Invalid column name 'VALI, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) AS _GT_ROW_NUMBER DFROM'.</span></code></pre>

<p>I eventually discovered that the cause is having a field name containing the string "FROM". Specifically, I had</p>

<p><font size="2">...t3</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">VALID_FROM </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">AS</font></font><font size="2"> VALIDFROM </font><font color="#808080" size="2"><font color="#808080" size="2">,</font></font><font size="2"> t3</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">VALID_TO </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">AS</font></font><font size="2"> VALIDTO</font><font color="#808080" size="2"><font color="#808080" size="2">,...</font></font></p>

<p>This suggests some pretty sloppy SQL parsing in GeoServer, and for the moment I've resolved this by changing my alias to VALID_STARTDATE.</p>
<br /><a href='https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views'>Crispin Flower</a>&nbsp;&nbsp;<a href='https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views'>...</a>]]></description>
      <link>https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views</link>
      <author>crispin.flower@idoxgroup.com (Crispin Flower)</author>
      <comments>https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views</comments>
      <guid isPermaLink="true">https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views</guid>
      <pubDate>Thu, 13 Jun 2013 16:01:00 GMT</pubDate>
    </item>
    <item>
      <title>When GeoServer forgets about GeoWebCache</title>
      <description><![CDATA[<p>I’ve been setting up some new mapping services (WMS) in GeoServer, with GeoWebCache allowing the map tiles to be cached for performance.&nbsp; For this to work, and for the WMS to use its cache of tiles, requires …</p> <ol> <li>the WMS request should include this on the KVP URL: &amp;tiled=true</li> <li>the client should construct its tile requests so that they match the server tiles – this is not the place for elaboration, but essentially this means getting the origin and tile size correct</li> <li>the GeoServer must have “Enable direct integration with GeoServer WMS” switched on. </li></ol> <p>The setting in #3 is found under Tile Caching &gt; Caching Defaults in the main GeoServer menu. Set it once, and forget it. Or so I thought.</p> <p>How do we know if the WMS is using its cache? Insect the http requests in Fiddler (or similar) and check the headers of the responses. </p> <p>If the WMS is using its cache you will see lines in the headers like this</p> <p><font face="Courier New">geowebcache-cache-result: HIT</font></p> <p>along with various other geowebcache-… values</p> <p>If it knows it has a cache, but something is wrong with the WMS requests (item #2 above), you might see headers like this:</p> <p><font face="Courier New">geowebcache-miss-reason: request does not align to grid(s) 'OSGB27700'<br>geowebcache-cache-result: MISS</font></p> <p>And if the WMS is unaware it even has a cache of tiles at all, you will see nothing about geowebcache at all in the headers. And of course, poor WMS performance may give you a clue something is not working as you hoped. </p> <p>Well I had set everything up lovely and my cache was working well, giving super fast performance of my Ordnance Survey mapping once the initial requests had populated the cache for an area.</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="fast Ordnance Survey maps" border="0" alt="fast Ordnance Survey maps" src="https://www.esdm.co.uk/Data/Sites/1/media/wlw/image_36.png" width="640" height="315"></p> <p>But the very next day… performance was rubbish, and on inspecting the http headers, it turned out the WMS had forgotten about its cache.</p> <p>In the GeoServer admin interface, the “Enable direct integration with GeoServer WMS” was now set to false. Grrr – I wondered how I could stupidly have switched that off again. Ah well, switch it on again and move on. </p> <p>A few hours later… same again. This time I started suspecting colleagues, but there was no evidence, or motive, yet…</p> <p>A couple more times, and I realised it was reverting after any re-start of GeoServer. I had been restarting every now and then, to make sure changed wrapper log settings etc. stuck, but it turned out this had been un-sticking my essential cache setting.</p> <p>The solution turned out to be to edit the gwc-gs.xml file, found in the GeoServer data directory, and set this:</p> <p><font face="Courier New">&nbsp; &lt;directWMSIntegrationEnabled&gt;true&lt;/directWMSIntegrationEnabled&gt;</font></p> <p>In my data dir, there was a gwc-gs.xml.tmp file, and I can only assume GeoServer had always failed to update the main XML file for some reason, used the .tmp version for the duration of the session, then reverted to the main one upon a re-start.</p> <p>Now my cached WMS layers run nice and fast, and GeoServer doesn’t forget the setting.</p><br /><a href='https://www.esdm.co.uk/when-geoserver-forgets-about-geowebcache'>Crispin Flower</a>&nbsp;&nbsp;<a href='https://www.esdm.co.uk/when-geoserver-forgets-about-geowebcache'>...</a>]]></description>
      <link>https://www.esdm.co.uk/when-geoserver-forgets-about-geowebcache</link>
      <author>crispin.flower@idoxgroup.com (Crispin Flower)</author>
      <comments>https://www.esdm.co.uk/when-geoserver-forgets-about-geowebcache</comments>
      <guid isPermaLink="true">https://www.esdm.co.uk/when-geoserver-forgets-about-geowebcache</guid>
      <pubDate>Tue, 05 Mar 2013 20:12:27 GMT</pubDate>
    </item>
    <item>
      <title>WMS GetFeatureInfo in OpenLayers on right click</title>
      <description><![CDATA[<p>
	Assuming that one already has a WMSGetFeatureInfo on the map then its quite simple:</p>
<ul style="line-height: 21.6px;">
	<li>
		Add new class</li>
	<li>
		Use new class</li>
</ul>
<p>
	<em><strong>New class</strong></em></p>
<p>
	<span style="color: black; font-family: Consolas;">&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 100, 0); font-family: Consolas;">//&nbsp;A&nbsp;control&nbsp;class&nbsp;for&nbsp;capturing&nbsp;click&nbsp;events...</span></p>
<pre style="color: black; line-height: 21.6px; font-family: Consolas;">
&nbsp;&nbsp;&nbsp;OpenLayers.Control.Click&nbsp;=&nbsp;OpenLayers.Class(OpenLayers.Control,&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defaultHandlerOptions:&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'single'</span>:&nbsp;<span style="color: blue;">true</span>,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'double'</span>:&nbsp;<span style="color: blue;">true</span>,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'pixelTolerance'</span>:&nbsp;0,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'stopSingle'</span>:&nbsp;<span style="color: blue;">false</span>,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'stopDouble'</span>:&nbsp;<span style="color: blue;">false</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handleRightClicks:&nbsp;<span style="color: blue;">true</span>,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initialize:&nbsp;<span style="color: blue;">function</span>&nbsp;(options)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span>.handlerOptions&nbsp;=&nbsp;OpenLayers.Util.extend(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{},&nbsp;<span style="color: blue;">this</span>.defaultHandlerOptions
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpenLayers.Control.prototype.initialize.apply(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span>,&nbsp;arguments
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span>.handler&nbsp;=&nbsp;<span style="color: blue;">new</span>&nbsp;OpenLayers.Handler.Click(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span>,&nbsp;<span style="color: blue;">this</span>.eventMethods,&nbsp;<span style="color: blue;">this</span>.handlerOptions
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLASS_NAME:&nbsp;<span style="color: maroon;">"OpenLayers.Control.Click"</span> 
&nbsp;&nbsp;&nbsp;});</pre>
<p>
	&nbsp;</p>
<p>
	<em><strong>Use it</strong></em></p>
<p>
	<span style="color: black; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 100, 0); font-family: Consolas;">//&nbsp;Add&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;Click&nbsp;control&nbsp;that&nbsp;listens&nbsp;to&nbsp;various&nbsp;click&nbsp;events:</span></p>
<pre style="color: black; line-height: 21.6px; font-family: Consolas;">
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">var</span>&nbsp;oClick&nbsp;=&nbsp;<span style="color: blue;">new</span>&nbsp;OpenLayers.Control.Click({&nbsp;eventMethods:&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: maroon;">'rightclick'</span>:&nbsp;<span style="color: blue;">function</span>&nbsp;(e)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 100, 0);">//the&nbsp;infotool&nbsp;has&nbsp;already&nbsp;been&nbsp;added&nbsp;to&nbsp;the&nbsp;map&nbsp;so&nbsp;lets&nbsp;use&nbsp;it!&nbsp;&nbsp;No&nbsp;need&nbsp;to&nbsp;fuff&nbsp;about&nbsp;and&nbsp;do&nbsp;the&nbsp;request&nbsp;ourselves&nbsp;is&nbsp;there?</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;infoTool.request(e.xy);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;map.addControl(oClick);
&nbsp;&nbsp;&nbsp;&nbsp;oClick.activate();</pre>
<div>
	&nbsp;</div>
<br /><a href='https://www.esdm.co.uk/wms-getfeatureinfo-in-openlayers-on-right-click'>Stewart Bellamy</a>&nbsp;&nbsp;<a href='https://www.esdm.co.uk/wms-getfeatureinfo-in-openlayers-on-right-click'>...</a>]]></description>
      <link>https://www.esdm.co.uk/wms-getfeatureinfo-in-openlayers-on-right-click</link>
      <author>stewartb@esdm.co.uk (Stewart Bellamy)</author>
      <comments>https://www.esdm.co.uk/wms-getfeatureinfo-in-openlayers-on-right-click</comments>
      <guid isPermaLink="true">https://www.esdm.co.uk/wms-getfeatureinfo-in-openlayers-on-right-click</guid>
      <pubDate>Mon, 01 Oct 2012 08:36:00 GMT</pubDate>
    </item>
    <item>
      <title>Inspecting web service requests from Quantum GIS with Fiddler</title>
      <description><![CDATA[<p>When connecting to any mapping web service, such as a WMS of WFS, just occasionally things don’t work first time (or is that just me…?).&nbsp; When this happens it is useful to be able to inspect the HTTP requests/responses for clues.</p> <p>Our HTTP inspection tool of choice is of course <a href="http://www.fiddler2.com" target="_blank">Fiddler</a>, however if you open this while using QGIS to connect to a web service, you see… nothing. So you need to tell QGIS to pass requests through a proxy, using Host = localhost and Port 8888 as shown below:</p> <p>QGIS menu Settings &gt; Options &gt; Network:</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="QGIS proxy options" border="0" alt="QGIS proxy options" src="https://www.esdm.co.uk/Data/Sites/1/media/wlw/image_7.png" width="644" height="416"></p> <p>Requests now start appearing in Fiddler.</p> <p>However, there’s a small gotcha… once set into this mode, requests fail entirely if Fiddler is not running.&nbsp; A WMS will simply fail to draw, and connecting to a WMS server gives this error:</p> <blockquote> <p>Could not understand the response. The wms provider said:  <p>Download of capabilities failed: Connection refused</p></blockquote> <p>This cost me half an hour this morning, having forgotten that I had set QGIS into this mode a few days ago, grrr.&nbsp; Here we are after I’d remembered the solution, showing a WMS of archaeological sites recorded by the National Trust, in Snowdonia, Wales.</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Archaeological sites in Snowdonia, Wales" border="0" alt="Archaeological sites in Snowdonia, Wales" src="https://www.esdm.co.uk/Data/Sites/1/media/wlw/image_9.png" width="496" height="484"></p><br /><a href='https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler'>Crispin Flower</a>&nbsp;&nbsp;<a href='https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler'>...</a>]]></description>
      <link>https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler</link>
      <author>crispin.flower@idoxgroup.com (Crispin Flower)</author>
      <comments>https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler</comments>
      <guid isPermaLink="true">https://www.esdm.co.uk/inspecting-web-service-requests-from-quantum-gis-with-fiddler</guid>
      <pubDate>Mon, 04 Jun 2012 07:33:04 GMT</pubDate>
    </item>
  </channel>
</rss>