mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 916 forks source link

[Question/Request] Creating an HeatMap #1518

Open sam2x opened 7 years ago

sam2x commented 7 years ago

Hi, I'm trying to figure out how to integrate "properly" an HeatMap. I have found some thread which specify that old version of this plugin couldnt support it (https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/757 , https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/651)

So i would like discuss about your opinion how we can do this (with existing features, or/and with additional features).

Can you please give your point of view, on the following solutions :

With existing feature

With additional features

What's the best solution according to you ? Any others ideas ?

wf9a5m75 commented 7 years ago

Ohh, you used old version. (may be stable for you?)

I tell you one thing, I changed implementation of the TileOverlay. Currently, working with callback.

  map.addTileOverlay({
    // Load image files from the local file path
    getTile: function(x, y, zoom) {
      return "(path to your image)" + zoom + "_" + x + "-" + y + ".gif"
    }
  }, function(tileOverlay) {

  });

It means you can generate any URL. Unfortunately, data:image/(png|gif|jpeg);base64:.... is not available for TileOverlays.


While GroundOverlay supports data:image/(png|gif|jpeg);base64:.... protocol. The possible solution of at this time is to generate heatmap tile images with JS side, then pass it to GroundOverlay.


Or support data:image/(png|gif|jpeg);base64... protocol for PluginTileoverlay. (But I need to work)


If you (and someone) donate $1,000 USD to this project, I will implement the heatmap (like marker clustering which is working currently)

sam2x commented 7 years ago

No, i'm using v2 beta2 (20170510).

I'm not sure if 1k$ is right price to support this feature. Actually HeatmapTileProvider is only available for Google Map Android Sdk, and unsupported on the Google Map IOS Sdk (https://github.com/googlemaps/google-maps-ios-utils/issues/59). It's not even on their roadmap, they expect a community PR for this.

So I can only see two possibilities to solve this :

  1. Submitting PR which support heatmap for Google Map IOS Sdk, and then developing the Heatmap layer for this plugin (both IOS/Android)
  2. Or, using JS only layer, which implies some problematics to solve ("bridge" between native layout and DOM, heatmap should move appropriately too when actions occurs on the native map, perfs, the choice of the algorithms or use of heatmap lib, etc.).

Well, this said, about the donation:

According the way you'll do it and the timeline, I may participate up to 50$ max (I cant afford 1k$). Also I wont participate if community is lacking to also financially participate. It could looks like selfish, however this plugin has a good popularity, so I dont see any reasons to be the only supporter. If nobody is willing to participate i'll just hire a developper to help me integrate a workaround for my project only.

wf9a5m75 commented 7 years ago

No, i'm using v2 beta2 (20170510).

The v2 has been updated frequently. The latest version of right now is 2.0.0-beta2-20170625-1805. You can check the latest version at https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/multiple_maps/plugin.xml#L2

sam2x commented 7 years ago

Hooo nice to know, yeah it was kinda stable, but gonna check all commits, and try it, thx ;)

wf9a5m75 commented 7 years ago

Google Maps Utility library (Android and iOS) are not developed by Google. They are developed by community.

i'll just hire a developper to integrate it for my project only.

Yes, you can. I don't mind. If you hire an engineer, the code might be higher than $1,000USD (but depends on your country and the engineer) In general, one Android engineer for one month is $5,000USD in the US at least.

$1,000USD is too cheep for me actually. I'm not amateur or student programmer. I'm senior full stack engineer at work. (And you know what I'm a member of GDE, so I'm an expert of Google Maps API certified by Google long years actually)

This plugin project is for that improving my skillset, improve Google Maps community, and help developers for non-native code developers (not Android and iOS developer). Not work. It means I need to work in my private time (such as after working hour, or holidays)

If you still feel selfish and the cost is expensive, you can hire someone or try by yourself. The code is full open source.

You can fork the repository, and you can expand it. (Some people do this) Or you can fundraise (like marker clustering). Or you can just wait.

At least, I gave to you a hint (generate tile image, then pass it to ground overlay), you can try it.

sam2x commented 7 years ago

Just to be clear: i'm not doubting about your skills, nor the time involved in this project. I know about the implication of such works, and again thanks for your efforts (in the lib, and in issues managments, responses, etc.). I'm just doubting about the community support/implication. Here, i'm trying to quantify the work for this feature according the way to go. Dont see any hostilities in what i said.

wf9a5m75 commented 7 years ago

In order to implement the heatmap feature for this plugin, at least Java, Objective-C, and JS skills are required. The people who have those skills are expensive usually. And these people are typically busy for another project. That's why kind of high amount (not too high for people who are really want the feature, and not too cheep for working people). At least, no body works without any purpose. In order to involve someone who is not interested in this plugin but who has high skillset, someone need to pay for working.

It is difficult to evaluate the work to money. You might feel "the heatmap is already implemented in JavaScript, so porting to this plugin should be easy", but actually it is not so easy.

The difficult thing is this plugin has three threads: browser, native (main thread), and native (background thread). This is really tricky.

For example, zooming-in faster case. You control the map on the browser view. But drawing heatmap images in native side takes kind of long seconds. During the generating images in native side, you control the map (zoom-in) again. In that case, the native side code has to do something, such as cancel the work or redraw the image (depends on developer).

If implementation is in only JS, it's easy. All threads are running on browser. But handling with native code, not easy.

So what I want to say it is difficult to estimate the cost. Difficult or easy is really depends on implementation. That's why I asked fixed amount $1,000USD for all feature request cases.

If donation amount is reached to $1,000USD, and someone create this feature then send a pull request to this repository, I will check the pull request, and I will pass the amount to the developer.

Or nobody create the feature, I will create the feature, and I will pool the amount for future, and buy new devices or software for test (such as iPhone).

sam2x commented 7 years ago

Thanks for these clarifications, it definitely gives a better view of the technical challenges. I will on my side investigate some stuffs to get a whole idea. Meantime, I hope people who are interested about this feature will manisfest themselves.

homeportcz commented 5 years ago

@wf9a5m75 Is there any option to develop Heatmap support for 1000$ donation nowadays?

wf9a5m75 commented 5 years ago

@homeportcz Maybe, asking to @sam2x that he archived to implement heatmap or not. If he archived to implement, and he agree with you to use his code, you can get his heat map soon.

If you really want to desire to implement heat map feature into this plugin as official, I can implement it if someone pay $1000 USD for my work, like HTMLInfoWindow, and MarkerCluster.

vosecek commented 5 years ago

@wf9a5m75 Thanks, we will talk about it, as our company paid for MarkerCluster. @sam2x Any news about your work? our company could donate some money for working implementation for iOS and Android.

homeportcz commented 5 years ago

@wf9a5m75 1000$ donation for implementing Heatmap for Android and iOS (same functions as https://developers.google.com/maps/documentation/android-sdk/utility/heatmap and https://developers.google.com/maps/documentation/ios-sdk/utility/heatmap) is confirmed by our company.

Could you estimate delivery time and pass paying details?

Thanks

wf9a5m75 commented 5 years ago

@homeportcz Some hours later after answering your question (https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1518#issuecomment-518435322), my life stage was significantly changed. Let me hold your request one week, and sorry for inconvenience.

wf9a5m75 commented 5 years ago

@homeportcz Thank you for waiting one week. Are you still interested in the heatmap feature?

vosecek commented 5 years ago

@wf9a5m75 yes, we are still interested in.

wf9a5m75 commented 5 years ago

ok, I will create it. I will send you more details to your email.

diegodvv commented 5 years ago

2674 Just submited a pull request that integrates the Google Maps Utility Heatmap (for Android) to the plugin.