How to create and customize cluster markers in React

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 38

  • @GoogleMapsPlatform
    @GoogleMapsPlatform  Год назад

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

  • @adamwoolf9993
    @adamwoolf9993 9 месяцев назад +3

    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 10 месяцев назад +4

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

  • @LifeWithSeb99
    @LifeWithSeb99 7 месяцев назад +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...

  • @tantoniou
    @tantoniou 6 месяцев назад +4

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

    • @amitd1927
      @amitd1927 4 месяца назад

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

  • @yeetergonzales832
    @yeetergonzales832 3 месяца назад

    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

  • @ninaandreeapopovici3264
    @ninaandreeapopovici3264 4 месяца назад +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 4 месяца назад

      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 3 месяца назад

      same issue, have you found any solution?

    • @AngelaYuGoogle
      @AngelaYuGoogle 3 месяца назад

      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 3 месяца назад +1

      This is late but, you need to use defaultCenter.

  • @developerism_
    @developerism_ Год назад +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?

  • @mohammadeslim9929
    @mohammadeslim9929 2 месяца назад

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

  • @jismonEnsol
    @jismonEnsol 2 месяца назад

    How can I change the color of clusters?

  • @oleksandr1006
    @oleksandr1006 4 месяца назад

    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.

  • @JonnyOrtiz-wu8ii
    @JonnyOrtiz-wu8ii 10 месяцев назад

    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 9 месяцев назад

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

  • @faridmammadov4277
    @faridmammadov4277 2 месяца назад

    Thank you very much man !

  • @11King99
    @11King99 11 месяцев назад +3

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

    • @nazariisaviak6298
      @nazariisaviak6298 10 месяцев назад

      The same issue...

    • @tsemibhutia4810
      @tsemibhutia4810 10 месяцев назад

      ​@@nazariisaviak6298 you need to rerun the clustering method

    • @amitd1927
      @amitd1927 4 месяца назад

      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 }}

  • @daltonrandall4348
    @daltonrandall4348 5 месяцев назад

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

    • @chriscwc
      @chriscwc 4 месяца назад +1

      No, typescript is optional.

    • @daltonrandall4348
      @daltonrandall4348 4 месяца назад

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

  • @youtubechoices
    @youtubechoices 5 месяцев назад

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

  • @oleksandr1006
    @oleksandr1006 4 месяца назад +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 RUclips, because there is no video for such a practical task on all of RUclips.

  • @obakengdiphoko7655
    @obakengdiphoko7655 8 месяцев назад

    how do you enable zoom in and out?

    • @amersyu1458
      @amersyu1458 8 месяцев назад +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.

  • @amitd1927
    @amitd1927 4 месяца назад

    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"

  • @kpoplightsticks1443
    @kpoplightsticks1443 8 месяцев назад

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

    • @sumithme4305
      @sumithme4305 5 месяцев назад

      Did you manage to find this

    • @kpoplightsticks1443
      @kpoplightsticks1443 5 месяцев назад

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

    • @AngelaYuGoogle
      @AngelaYuGoogle 3 месяца назад

      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ت Год назад

    ❤❤