Code Monkey home page Code Monkey logo

clustering_google_maps's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

clustering_google_maps's Issues

65,000 Objects

  • The clustering works pretty well

I have a data set of 65000 items and i am having issues with the db side. It will block the UI thread when first creating the data base.

Any ideas on where to start?

I am using a isolate to prepare the data.

Need to custom Markers or at least i can execute onTap inside Marker()

i need to override onTap in this Marker()

Future<void> updateAggregatedPoints({double zoom = 0.0}) async { .... for (var i = 0; i < aggregation.length; i++) { ... final marker = Marker( markerId: markerId, position: a.location, infoWindow: InfoWindow(title: a.count.toString()), icon: bitmapDescriptor, onTap: , // need this ); } }

How create custom cluster markers?

Hi!
First - thansk for this library!

It works fine.
But I can't get how can I create my custom markers within clusters?
It looks like you create them under the hood, but it would be nice if we (lib customers) will have an opportunity to ovverride createMaker function ๐Ÿ˜‰
Right now I am using the next trik to fix it:

void _updateMarkers(Set<Marker> markers) async {
    final knownMarkers = _convertToKnownMarkerSet(markers);
    setState(() {
      this.currentMapMarkers = knownMarkers;
    });
  }

Set<Marker> _convertToKnownMarkerSet(Set<Marker> clusteredMarkers) {
    final Set<Marker> newMarkers = Set();
    for (Marker marker in clusteredMarkers) {
      final converted = _getKnownMarker(marker);
      newMarkers.add(converted);
    }
    return newMarkers;
  }

  Marker _getKnownMarker(Marker newMarker) {
    for (Marker marker in allMapMarkers) { //`allMapMarkers` is set of all my markers.
      if (marker.position == newMarker.position) {
        return marker;
      }
    }
    return newMarker;
  }

it works, but its dirty...

as proposition: it would be nice to have something similar to createFromMemory, but instead list of LatLngAndGeohash as param, pass list of Markers (which under the hood can be converted to list of LatLngAndGeohash, if needed). Then there will be no need to override createMarker ๐Ÿ˜‰


The same question about claster marker icon, it would be nice to have an opportunity to override it create func.

openDatabase() return null.

Hi !

I'm using your library and I have a problem with the _init() method. In this method, _database is null at the end and I get an error while aggregating.

The code of the _init():

Future _init() async {
    print("AppDatabase: init database");
    // Get a location using path_provider
    Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "wily.db");
    print(path);
    _database = await openDatabase(path, version: 1,
        onCreate: (Database db, int version) async {
          // When creating the db, create the table
          await _createToiletTable(db);
        }, onUpgrade: (Database db, int oldVersion, int newVersion) async {
          await db.execute("DROP TABLE TOILETS_TABLE");
          await _createToiletTable(db);
        });
  }

The logs (btw it's doing aggregation twice) :

`I/flutter ( 9389): loading aggregation
I/flutter ( 9389): --------- START QUERY AGGREGATION
I/flutter ( 9389): Exception: Database must not be null
I/flutter ( 9389): --------- COMPLETE QUERY AGGREGATION WITH ERROR
I/flutter ( 9389): aggregation lenght: 0
W/System  ( 9389): A resource failed to call release. 
I/flutter ( 9389): rebuild
I/flutter ( 9389): loading aggregation
I/flutter ( 9389): --------- START QUERY AGGREGATION
I/flutter ( 9389): --------- COMPLETE QUERY AGGREGATION
I/flutter ( 9389): aggregation lenght: 0`

EDIT : FORGOT TO POPULATE DB -_- Problem solved. Can delete this stupid post.

facing this issue

i am facing given below issue ...

Running "flutter packages get" in clustering_google_maps-master...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.

Because clustering_google_maps requires SDK version >=2.1.0 <3.0.0, version solving failed.

pub get failed (1)
Process finished with exit code 1

Update Google Maps Package Dependency Version

Please update the Google Maps dependency version to google_maps_flutter: ^0.5.28+1
so that this may be used with other google maps packages that depend on a higher version of google maps than this one does.

Problem with double precision

Sometimes when creating a LatLng the precision of the double numbers get compromised. So for example if I send a location with latitude -63.816533 it becomes -63.8165332999999.

This affects if you want to customize the marker. Every time I'm updating the markers I check if the marker corresponds justs to one location and then I'm able to discover the metadata from the location based on the location but this precision makes more complicated to find.

I'm having to do the following workaround to get the metadata:

if (
  widget.locations[i].geopoint.latitude  == num.parse(item.position.latitude.toStringAsFixed(7))
&& widget.locations[i].geopoint.longitude == num.parse(item.position.longitude.toStringAsFixed(7)) ) {
///customize imarker
}

It stills fasts but I fear that it can compromise the speed with a big dataset.

Not sure if the best solution would be to change the way that LatLnt are created in the package or just add better ways to handle it in the documentation.

Change cluster icon colors random.

This package is working perfectly. But as in the example GIF in there, I want to change the cluster icons randomly, or want to have multiple colors. But there I only get the same colors (Grey Color) for every cluster

Animate Marker Expansion

This library works well but i want to know, how can i make the cluster markers expansion animated like native maps. It just expands without any animation!!!

Change cluster image

Hi,

Managed to make it work and it's very nice.
However, I have two questions.

First, is there a way to update the clusters during the zoom in/out and not only when the user release the screen ?

Second, is there a way to customize the cluster image. Like having a GoogleMap marker with the number of items on top of it or something like the GoogleMap clusters in native Android ?

Best

Dependency error with google_maps_flutter: ^0.5.7

Hi!
I have some problems with your plugin.
I need to use google_maps_flutter: ^0.5.7 and it's not working.

From console:

Because clustering_google_maps 0.0.4+2 depends on google_maps_flutter 0.4.0 and no versions of clustering_google_maps match >0.0.4+2 <0.1.0, clustering_google_maps ^0.0.4+2 requires google_maps_flutter 0.4.0.
So, because manager_mobile_client depends on both google_maps_flutter ^0.5.7 and clustering_google_maps ^0.0.4+2, version solving failed.

infowindow option to display custom title and snippet

Current state

-info window displays title as either lat lng or the count id , overrides previous created info windows
would be better in some cases if info window displays a custom title

Needed

info window to display custom title and snippet

Markers aggregation radius

SVID_20191029_121952_1
I'm trying to setup aggregation max zoom limits for clustering. But when zoom level is above 13.5 it stops clustering. When I set another values (for example [5.0, 7.5, 10.5, 13.0, 13.5, 14.5, 15.5] instead of standard [ 3.0, 5.0, 7.5, 10.5, 13.0, 13.5, 14.5]) nothing changes.
Because of that app starts lagging.
How to clustering at zoom level above, for example, 15.0?

Error: aggregation length 1 although it should be more

Hi,

I'm using this plugin on my flutter app and it's great. However, I think there is a problem with the initial zoom. Indeed, when I set a zoom at 12 like below, there is only one big marker. And I need to move the map with my finger of zoom in/out to make the different cluster appears.

static final CameraPosition _kInitialPosition = const CameraPosition(
    // Paris position by default
    target: LatLng(48.8534, 2.3488),
    zoom: 12.0,
  );

I did exactly like the example so I don't know if this happens to you as well.

Best

Update clustering on google maps

The problem i want to solve is to update the clusters at run time
say the initial list contains 100 items and are shown on the map, when i do some filteration, the list will be 50, so how to update the cluster to show only 50 not 100 ?

@override
  Widget build(BuildContext context) {
    super.build(context);
    final appState = Provider.of<AppState>(context);
    return FutureBuilder(
      future: initMemoryClustering(appState.latlgm),
      builder: (context, snapshot) {
        if (snapshot.connectionState == ConnectionState.waiting) {
          return Center(child: Text('waiting'));
        }
        //return Container(child: Text('${appState.latlgm.length}'));
        return Container(
          height: 400,
          child: GoogleMap(
            markers: markers,
            onCameraIdle: clusteringHelper.onMapIdle,
            onCameraMove: (newPosition) {
              clusteringHelper.onCameraMove(newPosition, forceUpdate: false);
            },
            myLocationButtonEnabled: true,
            myLocationEnabled: true,
            scrollGesturesEnabled: true,
            zoomGesturesEnabled: true,
            tiltGesturesEnabled: true,
            mapType: MapType.normal,
            initialCameraPosition: cairo,
            onMapCreated: (GoogleMapController controller) {
              clusteringHelper.mapController = controller;
              _controller.complete(controller);
              clusteringHelper.updateMap();
              clusteringHelper.updateAggregatedPoints();
            },
          ),
        );
      },
    );



updateMarkers(Set<Marker> markers) {
    setState(() {
      this.markers = markers;
    });
  }

  initMemoryClustering(List<LatLngAndGeohash> list) {
    clusteringHelper = ClusteringHelper.forMemory(
      list: list,
      updateMarkers: updateMarkers,
      aggregationSetup: AggregationSetup(markerSize: 130),
    );
  }

  @override
  bool get wantKeepAlive => true;

improvement: take off the "prints"

Hi,

Thanks for the package :D.

I noticed that the package has lots of prints show list length, aggregation length etc. Probably to help debug, but it can decrease the performance while in production. Would be nice to take off these print or make it be executed only while in debugMode.

Usually I use this function to check if is DebugMode:

bool get isInDebugMode {
  bool inDebugMode = false;
  assert(inDebugMode = true);
  return inDebugMode;
}

NoSuchMethodError: The method 'getVisibleRegion' was called on null.

Hi,

I added the aggregationSetup: AggregationSetup() argument to make the new release work. However, aggretation is not working anymore. I got this log which seems to cause the problem :

NoSuchMethodError: The method 'getVisibleRegion' was called on null.

It looks like the mapController is null. In the file clustering_helper.dart, mapController is not initialized anywhere. Is this normal ?

Could you please help me to solve this ?

Thx

EDIT : it appears that "mapController" is not defined in clustering_helper.dart. It is declared but never assigner. I think it should be passed as an argument when instantiating the ClusteringHelper class. If i'm right, lib must be updated

Custom Info windo

Currently, info window displays the title as count id. I need to to display q custom title.

(inCorrect Clustering number) ClusteringHelper.forMemory version 0.0.4+2

Hi,

The version 0.0.4+2 is having an issue with cluster numbering. No matter how many points are clustered together, the total cluster numbering is alway the same.

Here is how I'm setting the markers in memory.
Splash.dart

Screen Shot 2019-04-14 at 11 07 24 AM

Screen Shot 2019-04-14 at 11 09 28 AM

When I run the repo app, this is the result of the error. The number above the marker is what shows when I tap on the marker.

screenshot-1555260363621

screenshot-1555261262550

screenshot-1555260409386

screenshot-1555260456741

Custom Clustering Aggregation

I see only sum option for clustering,

It can be good if we could display other data types on cluster, actually it's only a sum of child in cluster. In exemple, process additional data from points to display an average on clusters point

Change clusterIcon.onPress behavior

As far as I remember, nativa clcuster implementation behave next way:
if user click on cluster icon, map zoomIn with animation to fit all markers, presented in that cluster.

So I guess it would be nice to have same behaviour in flutter ๐Ÿ˜‰

Or as aesy solution - please, give an opportunity to customise cluster markers ๐Ÿ˜„ #11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.