stamen / modestmaps-js

Modest Maps javascript port
http://modestmaps.com
566 stars 152 forks source link

v1.0.0 errors (with wax, tilejson) #110

Closed jthomassie closed 12 years ago

jthomassie commented 12 years ago

Mac/FF console: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild] [Break On This Error]
this.parent.appendChild(layer.parent); modestmaps.js (line 2648)

When I switch back to v0.17 no problems

tmcw commented 12 years ago

What version of Wax are you using? The versions need to match: Wax 5.x is compatible with MM 1.x.

jthomassie commented 12 years ago

Thanks, Tom. Just trying out wax and modestmaps for the first time. Please take a look if you have time.

I tried first with wax5.x and mm1.x: http://www.3diesel.com/map-test/mm-hash-2.html

Older versions work as expected: http://www.3diesel.com/map-test/mm-hash-1.html

irwinwilliams commented 12 years ago

Hi guys, I get that error as well, I'm trying to use layers, and on my pages I see this in console: Uncaught Error: NOT_FOUND_ERR: DOM Exception 8

Browser: Chrome v17

irwinwilliams commented 12 years ago

It looks like it expects the wax.mm.connector value to have a .parent field, which it doesn't.

irwinwilliams commented 12 years ago

OK, @jthomassie, I see in your test that you're using what I'll call the 4.x way of getting the map and layers to work. That is,

  1. get the tilejson url
  2. invoke wax.tilejson (url, [function])
  3. in the function define the connector, interaction and so on.

using the example (which I had to tweak), here's what I did:

  1. determine the layers, and specify them in an array
  2. create the map object using those layers
  3. setup your json url (which will define stuff like your legend and so on)
  4. invoke wax.tilejson(url, [function]) and in your function [don't reinitialize map, eh] set up the connector, legend, interaction and so on.

This example code here: https://github.com/stamen/modestmaps-js/blob/master/examples/layers/index.html helped. However, new MM.Layer(new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust)) didn't work for me, I had to use the new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust) TemplatedLayer directly (as the call to getTile()) was failing.

HTH.

tmcw commented 12 years ago

Hey:

Released modest maps 1.0.0-alpha2 and wax 5.0.1. These are both stable releases that should work together: here's your example running with these: http://bl.ocks.org/2039739

I've also fixed the layers example that @irwinwilliams was referring to, to update it to the new code.

Also: between combining layers in Modest Maps or combining them in your tilejson URL string - it's faster to do it with TileJSON: your browser doesn't need to do as many requests when loading the page.

jthomassie commented 12 years ago

Thanks!

skellytt commented 12 years ago

Thanks Tom!