janmeet / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

"Cannot call method 'fitBounds' of null" when using case 3 of your example-page #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

var myParser = new geoXML3.parser({
    afterParse: buildMarkers
});
myParser.parse('mapdata.kml');

function buildMarkers() {}

What is the expected output? What do you see instead?
no error so far

What version of the product are you using? On what operating system?
geoxml3.js r82

Please provide any additional information below.
Errormessage is: 
Uncaught TypeError: Cannot call method 'fitBounds' of null
render  geoxml3.js:883
resFunc geoxml3.js:119
xhrFetcher.fetcher.onreadystatechange

Original issue reported on code.google.com by MojitoJoe on 13 Jul 2012 at 1:16

GoogleCodeExporter commented 9 years ago
Which branch of the project are you using?

Can you provide a link or the files to reproduce the problem locally?

Does setting the zoom property of the parser to false fix the issue?

var myParser = new geoXML3.parser({
    afterParse: buildMarkers, zoom: false
});

Looks like need to change this:
      if (parserOptions.zoom && !!doc.internals.bounds) {
        parserOptions.map.fitBounds(doc.internals.bounds);
      }

To check for parserOptions.map being null

Original comment by geocodezip on 13 Jul 2012 at 6:54

GoogleCodeExporter commented 9 years ago
Im am using the kmz-branch.
Unfortunately I can't provide a link because I am working on my local 
environment. But it should be easy to reproduce (Build up Use Case 3 of your 
examples). When not using the "map:"-option (as in the example) but the 
"afterParse"-option, it crashes at that line. Setting "zoom: false"-option 
avoids (I would not say: fixes) the problem. I did this meanwhile.
You should check the map-object there before :)
Should be an easy part but just wanted to mention.

btw: When I would like to know, why the marker-icons will get zoomed when 
zooming the map (because at the end, they always stay the same size but are 
looking crappy during zoom), where is the right place for such a question? - 
It's more a kind of discussion/question than a defect...

Original comment by MojitoJoe on 13 Jul 2012 at 7:25

GoogleCodeExporter commented 9 years ago
> Unfortunately I can't provide a link because I am working on my local 
environment. 

Can you upload an html file and kml file that could be used to replicate the 
problem?

> Setting "zoom: false"-option avoids the problem. I did this meanwhile.

Does that mean it is a usable work around for now?

> btw: When I would like to know, why the marker-icons will get zoomed when 
zooming 
> the map (because at the end, they always stay the same size but are looking 
crappy 
> during zoom), where is the right place for such a question? 

As a matter of curiosity, if you are using geoxml3 as a stand-alone parser, 
what markers are you referring to?  What is handling the display? 

geoxml3 uses the google maps API v3, that functionality is built into the API.  
For questions about the v3 API, either the group:
https://groups.google.com/group/google-maps-js-api-v3?hl=en

or stackoverflow:
http://stackoverflow.com/questions/tagged/google-maps-api-3

Original comment by geocodezip on 13 Jul 2012 at 7:52

GoogleCodeExporter commented 9 years ago
fixed revision 84

Original comment by geocodezip on 14 Jul 2012 at 8:21

GoogleCodeExporter commented 9 years ago
kmz branch fixed revision 85

Original comment by geocodezip on 14 Jul 2012 at 8:34