Update Google Maps markerclusters - javascript

I have been using #googlemaps/markerclusterer for a couple of years. It still works, but it's not accessible, so I'd need to upgrade to #googlemaps/markerclusterer . Since I can't use a CDN and since I didn't get Webpack to work with the new plugin (yet), I downloaded the script and used it locally. I don't think this is the problem, but I guess it's worth mentioning it.
I updated my scripts as the manual suggested. In a nuthsell this means using:
this.markerCluster = new markerClusterer.Markerclusterer({map, markers, options }) instead of this.markerCluster = new markerClusterer(map, markers, options)
Later in the script I am using this.markerCluster.addMarker(this.mapData.markers[i]) I didn't change anything there.
When I console log this.markerCluster I do get an array filled with markers, but cluster remains empty [].
Since the script works with the old version of MarkerClusterer, I think I am missing something when converting to the new version. I've been Googling for hours, but can't find anything that could help me.
Am I missing something in the conversion? I am not getting any errors. The maps is working normally as well. Everything is, except there are no clusters.

Related

ExpiredKeyMapError - still error even if I generate a new API

I have a wordpress website made in 2016, and now the map doesn't work properly
anymore because of this console error (ExpiredKeyMapError).
I have created a new API but still doesn't work.
I have tried deleting the cache but still...
Maybe i need to wait some days for the new API starts to work properly? Or there is a way to make it work?
Anyone can help me?
Solved, because the template had a problem with API, i needed to contact the helpdesk.
Thank to all.

What happened to isZoomedIgnoreProgrammaticZoom?

I am using dygraph 1.1.0 since, well... forever :-)
Now I wanted to have a look at dygraph 2.0.0 and of course expected some migration to do.
Now, the only error I actually get after simply replacing the *.js files is:
Uncaught invalid option isZoomedIgnoreProgrammaticZoom dygraph.js:4448
When I remove this option from my code, everything still seems to work.
I could not find anything about the option in the new docs, so my question in:
What happened to isZoomedIgnoreProgrammaticZoom?
That option was removed in the 2.0 release.
That option affected the behavior of the isZoomed() method. If you're not using that method, you can remove the option without changing anything. If you are, it should be possible to get whatever behavior you want by using other methods in the dygraphs API. But I'd need more specifics to help.

CKEditor: LocationMap not working

I have successfully installed CKEditor. Now I am trying to add locationmap plugin.
First: I tried to add it like it says.
config.locationMapPath = 'path';
I also added this with the path of the googlemap.html however when I click on the icon
Second: I tried setting the global base path variable because my idea is that this is a path issue.
window.CKEDITOR_BASEPATH = "http://www.partymag.org/ckeditor/";
However when I set the basepath it show this error on the console:
Uncaught TypeError: Cannot read property 'ltr' of undefined
I searched oline for solution and none of them solved this. Here is what I have tried:
Clearing the cache, I have done this multiple times, tried different browsers, heck I even uploaded my source to server and tried on different computers but same error.
Setting the language, I seen this solution couple of times online. I added the line
config.language = 'en'
I have downloaded the latest ckeditor without having a previous version. I tried deleting ckeditor files and re-adding them. I probably tried a lot of things. Things I don't remember. But I have been stuck with this for two days. Please any suggestion might help.
Regards.

My easeljs project doesn't work online

I am developing a videogame using EaselJS, a Javascript library.
My project works pretty fine offine, or on a local server. However, when I try to upload it on a website (ex: http://streetfighterjs.lixter.com/ ), it doesn't work anymore : my sprites aren't loading, and nothing is shown in my canvas.
The strange thing is that I tried to use PreloadJS to preload my images, but it doesn't seems to work. I was wondering if anyone already had this kind of problem, and how did he made to fix it.
You only included easel.js and sound.js.
preload.js is missing. Therefore createjs.LoadQueue is undefined.
Just include preload.js and your code should work.
You need to include preloadjs in your head (or prefferably just after your footer element).
In my project right now, I have the following order and it works fine:
<script src="../js/vendor/easeljs-0.7.1.min.js"></script>
<script src="../js/vendor/soundjs-0.5.2.min.js"></script>
<script src="../js/vendor/preloadjs-0.4.1.min.js"></script>
You should check your console from time to time:
Which is occuring from this line:
Sounds like PreloadJS is not included, or not loaded. Can you provide
a link to the sample?
Source
You are getting a typeffor from perso1 which is undefined. I notice that you are creating your perso1 global variable, but you are not actually saying what perso1 is equal to. Well you might be later in the code, but when you are getting that typerror, perso1 is not yet set.
Currently, the issue with the site is that perso1 is undefined during your tick (deplacement function). This will happen as long as the first image (imgPerso1) is not loaded.
I am also seeing XMLHttpRequest errors in the console, indicating that something is attempting to load cross-domain. If your LoadQueue is causing this, then you might want to change it to load content using tag-based loading instead of XHR:
new createjs.LoadQueue(false);
A few miscellaneous notes:
1. You don't need to constantly call stage.update() when you make changes, because you have a ticker that will constantly update the stage for you.
2. You are still using the default timing mode for Ticker (timeout-based). There is no useRAF property in version 0.8.1 - instead set the timingMode of the Ticker:
createjs.Ticker.timingMode = createjs.Ticker.RAF;
Hope that helps.

Uncaught SyntaxError: Unexpected token )

*NOTE - This code is from a third party extension. I had no part of it's creation and several years ago when used it was the only extension available at the time. So while I appreciate your opinions, I do hope all comments can be just for suggestions on a resolution. Thanks!
We have many sites running a Google Maps component for a CMS that allows for clients to add markers and outlines (polygons) to their Google Maps.
This has been working for years. To note, it uses Google Maps JS API 2, which has been discontinued rather than API 3. However, Google has noted API 2 will still work well into 2013 so that is not the issue. However, they must have changed something because as of the other day, on all our sites though the Maps appear the markers and polygons do not. They are on different servers.
Before there was no errors but now in Chrome it says:
"Uncaught SyntaxError: Unexpected token )" for line 1669 in a JS File. You can see the file in the following Gist:
https://gist.github.com/2238148
As you can see there is no missing ")" and the code has work unmodified for years on nearly 100 sites, so assume something on Google's end must have changed. But is there something we can adjust to this code to help counter there change? -Update on March 25th when all of this broke Google made an update to their Google Maps API 2.
Searched the web and here is an example site using the same component with the same error: http://goo.gl/GMgOs
This issue appears to be near:
// extract current digraph from overlay function
var digraph = GMap.addOverlay.toString().replace(/\s/g,'').replace(/.push\([^{]+\);a.initialize\([^{]+\);a.redraw\([^{]+\).+$/,'').replace(/^.+\./,'');
// add multiple overlays at once (api hack to improve loading speed)
GMap2.prototype.addOverlays = function(a) {
var b = eval('this.' + digraph);
var i = a.length;
while (i--) {
b.push(a[i]);
a[i].initialize(this);
a[i].redraw(true);
}
}
If that code needs to be alterted could someone post the modified version on a gist or pastie?
Another Update - That code in the pre above I commented out since it supposively is not needed by was a hack to speed things up. Still gets an error however noted in the comments. I did notice however here: https://developers.google.com/maps/documentation/javascript/v2/reference#GMap2.Methods.Overlays that it calls the code, "addOverlay" rather than "addOverlays" so wondering if maybe the s was taken off in the most recent API Google update. Removing the s in all three locations just shoots out a new error which repeats [object] many times.
The code is an abomination, in fact I've not seen a worse add-on in five years of working with and helping users of Version 2. It overwrites GMap (part of the Version 2 API to provide compatibility with Version 1) with no redeclaration. The error you're getting is a direct result of a hack to minified code: this was bound to fail at some point and should never have been implemented.
The best thing you can do is to remove the var digraph line and then redefine the new method GMap2.prototype.addOverlays which follows it. That will allow the code to use the API's addOverlay() function and should eliminate the problem.
GMap2.prototype.addOverlays = function(a) {
var i = a.length;
while (i--) {
this.addOverlay(a[i]);
}
It appears that addOverlays() takes an array of overlays. The existing method attempts to add them directly to the internal array of overlays, which has moved. The suggested method simply uses GMap2's own addOverlay() method to add each member of the array of objects. Thus we use an exposed method and don't try and hijack the minified code of the API — if we did that again, it would almost certainly break again.
GMarker.prototype.openInfoWindowFX and GMarker.prototype.updateInfoWindow are additions to GMarker and unlikely to cause problems (especially if they currently work), although even they use properties of GMarker -- which isn't really recommnded.
Clearly, the GMap.addOverlay function definition has been changed and your RegExp hacking at its source code no longer works.
alert(GMap.addOverlay.toString())
and
alert(digraph)
To see what the new function is and what your regexes are doing to it.
Why exactly do you need to in-place modify their code, anyways? Why didn't you just copy the function definition you wanted, make the changes, and then use that version? (Without needing an eval, either.)
The code you posted relies on internal implementation details for GMap2.prototype.addOverlay which are free to change at any time.
It would be better to rely only on the external interface for GMap2. You can implement an addOverlays method as such:
GMap2.prototype.addOverlays = function(overlays) {
for (var i = 0, I = overlays.length; i < I; ++i) {
this.addOverlay(overlays[i]);
}
};
Can you replace the code snippet from your post with this and see if it works?
That code is ugly. You do GMap.addOverlay.toString(), replace something with regular expressions and execute it then with eval.
Why do you need to replace something in a function's code? What is the code of GMap.addOverlay? If you can answer these questions, you should be able to see why your regexp doesn't work any more and returns invalid code.

Categories