When I first started working with it, one of my favourite things was the excellent documentation that came with it. Sadly, since the shift to Material Design, it’s now very difficult to navigate and find anything. In fact, I’ve pretty much given up on it. It’s a lot easier to just use Stack Overflow.
Here are some fairly basic things I found, which, depending on your project, might make life easier.
Use a map object
Push overlays into arrays
When you add any overlay, for example a marker or polygon, the normal process is to read the geo data out of an object or array and use it to add the overlays. However, if you then want to interact with those overlays you have no way of selecting them. When you create an overlay push it into an array. That way you can loop through the items or select one by its index.
Add key or id property to get an overlay easily
Use polygons appropriate for zoom range
If you define a polygon it will work at any zoom range. For your map usage it’s worth considering if you need to allow the full zoom range to be used. It might be easier to limit it. Imagine a polygon for the outline of France. If you’re zoomed right out, looking at the world you can get away with just a hexagon shape. If you zoom in close you need to pick out each little twist and turn in the coastline. See what you need and use simplified polygons for speed and performance where possible.
Use dynamic SVGs as icons
You can use your own image files as markers instead of the standard pin. However, these don’t have to be static image files. You can create your own function which takes parameters for colours or values and uses these to return an SVG including these details. You can then set this function as the icon image.
Set bounds and extend them
When you create a map, also create a bounds object. This holds location data for the top right (NE) and bottom left (SW) of a box, which determines the portion of the map shown on screen. It manages the zoom level for you. Whenever you add a new overlay to your map you can extend these bounds so that all of your overlays will always be shown.