How to create and customize cluster markers in React

Поділитися
Вставка
  • Опубліковано 26 жов 2024

КОМЕНТАРІ • 38

  • @GoogleMapsPlatform
    @GoogleMapsPlatform  10 місяців тому

    Subscribe for more Google Maps Platform tutorials! → goo.gle/GoogleMapsPlatform

  • @adamwoolf9993
    @adamwoolf9993 7 місяців тому +2

    Leigh. The quality and clarity of your explanations, teaching style and of the video production is second to none IMO. Thanks so much for this and please keep up the great work!

  • @MaxI-fw1vv
    @MaxI-fw1vv 8 місяців тому +4

    Very nice exercise!
    Are you able to zoom with "zoom" property, not "defaultZoom"?

  • @LifeWithSeb99
    @LifeWithSeb99 5 місяців тому +2

    Could you make an example with dynamic points? Let's say we're loading new points from the server every time we drag the map - some of the points are new, and some of them are no longer there. I tried to that and it's not been successful...

  • @oleksandr1006
    @oleksandr1006 2 місяці тому +2

    To paint a pair of markers is absolutely not a practical task. Here is the task I decided: to draw 30 thousand delivery service markers across the country, which I receive in response to a request to their API. I figured out how to draw only those markers and clusters that fall into the map display grid. The map began to fly, because when trying to draw all 30 thousand, the page froze. It will probably be necessary to record a guide for UA-cam, because there is no video for such a practical task on all of UA-cam.

  • @yeetergonzales832
    @yeetergonzales832 Місяць тому

    Hello, is there a way to set zoom/pan to the lowest level of cluster markers? I don't get animations to center positions of a cluster, it sort of just jumps there, and the panTo and setZoom dont really help for some reason

  • @mohammadeslim9929
    @mohammadeslim9929 25 днів тому

    when i use the same workflow for like 50k markers the app crashes, any solutions ?

  • @faridmammadov4277
    @faridmammadov4277 26 днів тому

    Thank you very much man !

  • @oleksandr1006
    @oleksandr1006 3 місяці тому

    Hi, I wrote everything according to the instructions. I receive markers from requests to the API of the delivery service. If I show up to 1000 markers, then everything works fine. But I need to display 30,000 delivery points across the country. If I do this, the page freezes and nothing is shown on the map. But in many online stores, everything works.
    I also wrote an option to connect the map in pure JavaScript without clustering. All 30,000 markers are drawn. I don't have much experience to write my own clusterizer.
    But the option using libraries does not work.
    Please advise. Or write a guide on how to draw at least 10,000 markers.

  • @ninaandreeapopovici3264
    @ninaandreeapopovici3264 2 місяці тому +1

    Every time I add a Center to my Map, it keeps me stuck I can't move the Map around. How can I bypass this issue?

    • @amitd1927
      @amitd1927 2 місяці тому

      Anyone facing issues with the zoom, Do change "Center" to defaultCenter and "Zoom" to defaultZoom.
      For example: defaultZoom={8}
      defaultCenter={{ lat: 18.9499412, lng: 72.9486126 }}

    • @InfiNity-jw9hc
      @InfiNity-jw9hc Місяць тому

      same issue, have you found any solution?

    • @AngelaYuGoogle
      @AngelaYuGoogle Місяць тому

      See this example of setting an initial state of the map including center, but then updating the state of the map whenever the user changes the map state visgl.github.io/react-google-maps/examples/multiple-maps

    • @coding-soju
      @coding-soju Місяць тому +1

      This is late but, you need to use defaultCenter.

  • @tantoniou
    @tantoniou 4 місяці тому +3

    But how about custom icons for clustering? like svg's I mean

    • @amitd1927
      @amitd1927 2 місяці тому

      developers.google.com/maps/documentation/javascript/examples/advanced-markers-graphics
      Check out, this is possible

  • @jismonEnsol
    @jismonEnsol Місяць тому

    How can I change the color of clusters?

  • @developerism_
    @developerism_ 10 місяців тому +1

    Is it possible to create a React JS app, which provides navigation as google maps+ pop ups the images and snaps of nearby picnic spots?
    If yes, which APIs will be needed? Can you please make a tutorial for it?

  • @11King99
    @11King99 9 місяців тому +3

    It doesn't work when you trying to add new marker to the map.

    • @nazariisaviak6298
      @nazariisaviak6298 8 місяців тому

      The same issue...

    • @tsemibhutia4810
      @tsemibhutia4810 8 місяців тому

      ​@@nazariisaviak6298 you need to rerun the clustering method

    • @amitd1927
      @amitd1927 2 місяці тому

      Anyone facing issues with the zoom, Do change "Center" to defaultCenter and "Zoom" to defaultZoom.
      For example: defaultZoom={8}
      defaultCenter={{ lat: 18.9499412, lng: 72.9486126 }}

  • @kapsola2710
    @kapsola2710 3 місяці тому

    is this using the new cluster that google will be using from now on?

  • @JonnyOrtiz-wu8ii
    @JonnyOrtiz-wu8ii 8 місяців тому

    How do you add an InfoWindow for each? I'm having trouble trying to figure out how to implement the ref since the ref in the demo is a callback.

    • @adamwoolf9993
      @adamwoolf9993 7 місяців тому

      If you put the marker in its own component you can handle the state per marker.

  • @daltonrandall4348
    @daltonrandall4348 3 місяці тому

    Is typescript mandatory to use map clusters now, or can you still use normal javascript in the HTML page?

    • @chriscwc
      @chriscwc 2 місяці тому +1

      No, typescript is optional.

    • @daltonrandall4348
      @daltonrandall4348 2 місяці тому

      @@chriscwc Thanks so much. I find it so difficult to figure out how to embed these things without massive amounts of hassle.

  • @amitd1927
    @amitd1927 2 місяці тому

    if you're facing, then refer the github code of examples, that way I was able to resolve the issue of "Maximum update depth exceeded"

  • @obakengdiphoko7655
    @obakengdiphoko7655 6 місяців тому

    how do you enable zoom in and out?

    • @amersyu1458
      @amersyu1458 6 місяців тому +2

      instead of passing zoom into your map component, pass in defaultZoom. So upon rendering the map will have the defaultZoom value but enable user to zoom in and out.

  • @kpoplightsticks1443
    @kpoplightsticks1443 6 місяців тому

    How can I change the numbers on clusters to Arabic numbers? Thanks

    • @sumithme4305
      @sumithme4305 3 місяці тому

      Did you manage to find this

    • @kpoplightsticks1443
      @kpoplightsticks1443 3 місяці тому

      @@sumithme4305 Yes, I am using @react-google-maps/api and I changed it by customizing the calculator of MarkerCluster

    • @AngelaYuGoogle
      @AngelaYuGoogle Місяць тому

      Here's the reference documentation for the js-markerclusterer library that is powering this marker clustering, where the default renderer uses a String(count) of the markers for the Label of the marker. You can change the Label of the cluster's marker to be a different String. googlemaps.github.io/js-markerclusterer/classes/DefaultRenderer.html

  • @جعفر-س7ت
    @جعفر-س7ت 10 місяців тому

    ❤❤