<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Ive adapted this code so that I can get tiles....but the x y values are now wrong</span></div><div><br></div><div>I´m getting this..</div><div><br></div><div><a href="http://maps.zgb.de/geoserver/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png/8/7/46.png">http://DOMAIN/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png/8/7/46.png</a> <br></div><div><br></div><div>when I should be getting this..</div><div><br></div><div><a href="http://maps.zgb.de/geoserver/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png/8/7/46.png" style="font-size: 12pt; ">http://DOMAIN</a><a href="http://maps.zgb.de/geoserver/gwc/service/tms/1.0.01.0.0/zgb%3ARROP08@EPSG%3A900913@png/10/541/686.png">/gwc/service/tms/1.0.01.0.0/zgb%3ARROP08@EPSG%3A900913@png/10/541/686.png</a> <br></div><div><br></div><div><br></div><div>so <a
href="http://maps.zgb.de/geoserver/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png/8/7/46.png" style="font-size: 12pt; ">8/7/46.png</a><span style="font-size: 12pt; "> instead of </span><a href="http://maps.zgb.de/geoserver/gwc/service/tms/1.0.01.0.0/zgb%3ARROP08@EPSG%3A900913@png/10/541/686.png" style="font-size: 12pt; ">10/541/686.png</a><span style="font-size: 12pt; "> </span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">How can I get this correct?...is this to do with resolutions?</span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">yours,</span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">Rob</span></div><div><br></div><div><br></div><div><br></div><div><br></div> <div
style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">Von:</span></b> Robert Buckley <robertdbuckley@yahoo.com><br> <b><span style="font-weight: bold;">An:</span></b> "users@openlayers.org" <users@openlayers.org> <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 15:38 Mittwoch, 18.April 2012<br> <b><span style="font-weight: bold;">Betreff:</span></b> [OpenLayers-Users] TMS parsing algorithm<br> </font> </div> <br><div id="yiv610578487"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 12pt; font-family: arial, helvetica, sans-serif; "><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">Hi,</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;
"><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">I am trying to display a tms layer using openlayers by modifying some code which displays cloudmade layers</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">I have some code which tries to construct the tile but it is failing throwing this error...</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div><h4 style="font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; ">400: Unable to parse number For input string:
"zgb:RROP08@EPSG:900913@png8" from tms/1.0.0/zgb:RROP08@EPSG:900913@png8/134/81.png</h4><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">I have obviously got it totally wrong.....Could anyone direct me to the documentation or say how to correctly parse the wms path?</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">yours,</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">Rob</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">//Code</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;
"><br></div><div><div><font face="arial, helvetica, sans-serif">OpenLayers.Layer.
MyTMSClass = OpenLayers.Class(OpenLayers.Layer.TMS, {</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">        </span></font></div><div><font face="arial, helvetica, sans-serif"> initialize: function(name, options) {</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                </span></font></div><div><font face="arial, helvetica, sans-serif"> options = OpenLayers.Util.extend({</font></div><div><font face="arial, helvetica, sans-serif"> attribution: "",</font></div><div><font face="arial, helvetica, sans-serif"> maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),</font></div><div><font face="arial, helvetica, sans-serif">
maxResolution:
156543.0339,</font></div><div><font face="arial, helvetica, sans-serif"> units: "m",</font></div><div><font face="arial, helvetica, sans-serif"> projection: "EPSG:900913",</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                        </span>isBaseLayer: true,</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                        </span>numZoomLevels: 19,</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                        </span>displayOutsideMaxExtent: true,</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                        </span>wrapDateLine: true,</font></div><div><font face="arial, helvetica, sans-serif"><span
class="yiv610578487Apple-tab-span" style="white-space:pre;">                        </span>styleId:
1</font></div><div><font face="arial, helvetica, sans-serif"> }, options);</font></div><div><font face="arial, helvetica, sans-serif"><span class="yiv610578487Apple-tab-span" style="white-space:pre;">                </span>var prefix = [options.key, options.styleId, 256].join('/') + '/';</font></div><div><font face="arial, helvetica, sans-serif"> var url = [</font></div><div><font face="arial, helvetica, sans-serif"> "http://mydomain/geoserver/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png"</font></div><div><font face="arial, helvetica, sans-serif"> ];</font></div><div><font face="arial, helvetica, sans-serif"> var newArguments = [name, url, options];</font></div><div><font face="arial, helvetica, sans-serif"> OpenLayers.Layer.TMS.prototype.initialize.apply(this,
newArguments);</font></div><div><font face="arial, helvetica, sans-serif"> },</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> getURL: function (bounds) {</font></div><div><font face="arial, helvetica, sans-serif"> var res = this.map.getResolution();</font></div><div><font face="arial, helvetica, sans-serif"> var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));</font></div><div><font face="arial, helvetica, sans-serif"> var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));</font></div><div><font face="arial, helvetica, sans-serif"> var z = this.map.getZoom();</font></div><div><font face="arial, helvetica, sans-serif"> var limit = Math.pow(2,
z);</font></div><div><font face="arial, helvetica,
sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> if (y < 0 || y >= limit)</font></div><div><font face="arial, helvetica, sans-serif"> {</font></div><div><font face="arial, helvetica, sans-serif"> return "http://cloudmade.com/js-api/images/empty-tile.png";</font></div><div><font face="arial, helvetica, sans-serif"> }</font></div><div><font face="arial, helvetica, sans-serif"> else</font></div><div><font face="arial, helvetica, sans-serif"> {</font></div><div><font face="arial, helvetica, sans-serif"> x = ((x % limit) + limit) % limit;</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> var url =
this.url;</font></div><div><font face="arial, helvetica, sans-serif"> var path = z + "/" + x + "/" + y + ".png";</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> if (url instanceof Array)</font></div><div><font face="arial, helvetica, sans-serif"> {</font></div><div><font face="arial, helvetica, sans-serif"> url = this.selectUrl(path, url);</font></div><div><font face="arial, helvetica, sans-serif"> }</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> return url + path;</font></div><div><font face="arial, helvetica, sans-serif">
}</font></div><div><font face="arial, helvetica, sans-serif"> },</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> CLASS_NAME: "OpenLayers.Layer.
MyTMSClass "</font></div><div><font face="arial, helvetica, sans-serif">});</font></div></div></div></div></div></div><br>_______________________________________________<br>Users mailing list<br><a ymailto="mailto:Users@lists.osgeo.org" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br><br><br> </div> </div> </div></body></html>