[OpenLayers-Trac] [OpenLayers] #3181: multiple issues (sorry to group as one)

OpenLayers trac-20090302 at openlayers.org
Sun Mar 20 05:02:54 EDT 2011


#3181: multiple issues (sorry to group as one)
-------------------------+--------------------------------------------------
 Reporter:  michaelkatz  |       Owner:              
     Type:  bug          |      Status:  new         
 Priority:  minor        |   Milestone:  2.11 Release
Component:  general      |     Version:  2.10        
 Keywords:               |       State:              
-------------------------+--------------------------------------------------
 Sorry if some of this is due to user misunderstanding, but I thought it
 was better to say something than not.

 I was trying to use an XYZ layer to implement essentially my own open
 street map server. I ran into a few problems.

 First, a general question, I was trying to debug OpenLayers.js in firebug
 and it's not formatted. I tried autoformatting with editor but that didn't
 work very well. I ended up checking out the source code in SVN and
 replacing the parts from OpenLayers.js that I needed to debug with the
 formatted code from SVN. So the general question is: Can you make a
 formatted version of OpenLayers.js available for people who want to debug
 it? (or maybe it's already available and I just couldn't find it...)

 As I was doing this, I noticed a couple problems. One is that
     OpenLayers.Layer.XYZ = OpenLayers.Class( ...
 appears more than once in the file, as do several other Layer subclass
 definitions. So it took me a long time to realize that the code changes I
 was making to those classes (i.e., to the first instance higher up in the
 file) were not having any effect. My guess is that somehow those classes
 are being included into OpenLayers.js more than once by mistake in your
 build process.

 The final problem is that it seems to me the OpenLayers.Layer.XYZ has a
 problem in that it has sphericalMercator false by default. So I was trying
 to set myLayer.sphericalMercator = true after the layer had been created.
 But it turned out that several internal variables in the class were
 already initialized with lat/lon values. The net result was that my map
 was almost working but not really. Like it would only draw the northern
 hemisphere when drawing the four tiles of zoom level 1 (i.e., it only drew
 the top two tiles). It took me a long time to figure out that this was an
 issue with the projection being initialized incorrectly. I actually went
 ahead and initialized sphericalMercator = true in my own copy of the XYZ
 class, as the only way I could make it work. Some of this may be due to me
 not understanding the API, but the bottom line is that I went from and OSM
 layer to an XYZ layer, and I expected it to just work and it didn't. So
 either a bug fix or some clarification in the documentation would be good,
 since I imagine many users who are interested in the XYZ class are trying
 to make their own OSM functionality using a local tile cache.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3181>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list