How to Embed a Map Anywhere

You have some data you want to put on a map, but then you want to make your interactive map available for others to use. You want to put that map into a website, on social networks, in emails, and everywhere else someone might look.

We’ve created this article to help you embed a map anywhere:

Are there other places you’d like to put a map? Let us know!

Embed a Map in HTML

If you have control of your whole website, or use a platform that lets you include full HTML, an interactive map is the way to go. You’ve likely used these to get driving directions, look up store locations, or find restaurant reviews. You can drag and zoom the map with your mouse, and there are icons on the map (typically called “map markers”) to show locations.

While these maps have become easier to create in the last decade, they still require some knowledge of JavaScript code to make them behave exactly as you want. Since learning to code is beyond the scope for many people who want to create embedded maps, we’ve compiled a few easy ways to make a Google Map.

Rather than learn to code, use one of these non-code approaches.

Point and Click Maps

Google provides a tool that allows you to create maps through its simple interface. You can create markers, lines, and add directions.

  1. Go to Google My Maps
  2. Click “Create a New Map”
  3. Click the marker icon, then click on the map to add markers
  4. To add addresses or businesses, search then choose “Add to map” in the results

Continue until you have all the markers on the map. To embed, choose the settings menu (three vertical dots) and select “Embed on my site” option.

You’ll need to make your map publicly shareable for the embed option to work.

PROS: Easy to create small maps
CONS: Unable to create complex maps, especially when marker filtering is needed

Copy and Paste Maps

Many times when you want to create an interactive map it’s because you have a lot of data you want to make visible. For example, you might have a spreadsheet of locations that you want to turn into a map. You want something as easy as copy and paste.

  1. Go to BatchGeo’s map maker
  2. Copy and paste your spreadsheet data, including the header rows

BatchGeo does the rest, up to spreadsheets with thousands of rows. It will intelligently find the columns that reference location data and there are options for you to override its settings. Then, it quickly turns every address into latitude and longitude coordinates on the map.

View US President Births and Burials in a full screen map

You can also use other columns in the spreadsheet to filter the map, such as only viewing locations by a specific type or category. In the example above, the map shows US president birth and burial locations. Using the menu in the lower left of the map, you can select to only see the birthplaces or only see the burial locations. These grouping options are automatic and also work with number ranges.

PROS: Simple interface for creating maps with many markers
CONS: Unable to manually add markers, though you can rearrange them

WordPress

The most popular way to host website can also display your excellent maps. WordPress allows you full control of the code that produces your website, and you can use any HTML when you create WordPress pages and blog posts.

HTML embeds, like both of those mentioned in the previous section, use an IFRAME to hold the contents of the map, similar to how YouTube videos are embedded. The frame references an entirely other site, but it’s made to seamlessly blend in to look like it belongs on the site. If you use a lot of custom CSS on your website (or use a WordPress theme that does) you may have issues with your map embed. Look out for “iframe” in the CSS file and double check that you aren’t forcing the width of the IFRAME larger than the available space available.

Alternatively, there are over 150 WordPress plugins for Google Maps. The use cases these plugins support varies. Some will only show a single place, while others let you build entire maps. If you have more than a few

Facebook

Unlike web properties that you control, the world’s largest social network does not allow for embedded HTML. That means you will not be able to have your interactive custom map on Facebook. However, you still have several options to get your location data in front of friends and fans through the use of image posts.

If you’d like your map to show up in the news feed, the size Facebook recommends Is 1200×900 (that is: 1,200 pixels wide and 900 pixels tall). At a minimum, look to maintain an aspect ratio of 4:3 with news feed images, where the image is 1/3 wider than tall.

There are a couple ways to generate the image for your Facebook post:

1.Take a screenshot: you can use the screenshot feature of your operating system or get software that lets you capture whatever is on your screen.
2.Automate with BatchGeo: BatchGeo Pro comes with high resolution, printable files in PDF and PNG. The latter is ready to go as the recommended format for Facebook posts.

Once you have your image, upload it to Facebook. Be sure to write a status that points back to your site or map.

Better yet, include the image in your HTML and Facebook will pick it up and include it automatically.

Twitter

Twitter is similar to its social media counterpart in many ways, yet there are also differences between the platforms. When it comes to interactive maps, the story is the same: no embedded HTML in tweets, so we need to use images.

The size specifications are a little different for Twitter. Here you’ll want to keep a 2:1 ratio (two times as wide as tall). The minimum size to show up in a user’s timeline is 440×220 (440 pixels wide, 220 pixels tall).

You can use the same methods as described in the Facebook section to make your Twitter images, too: manual screenshot or automatic with BatchGeo Pro. In addition, due to Twitter’s image format, another choice available is BatchGeo’s map badges.

These graphics provide a small preview of the map to give you a feel of what’s to come with the larger map.

There are two main ways to include images in your tweets:

  1. As an image attachment: include a direct link to the image or upload it to Twitter. Be sure to also include a link to your website or map so your followers can see the interactive version.
  2. As a Twitter card: If you have access to the full HTML of the site with your map embed, you can add special header meta tags to point to your image. That way, Twitter will include the image automatically, even when someone else tweets our your link.

For those extra-serious about their Twitter presence, you can even use special versions of these cards in the second example on Twitter’s ad platform.

Email

Email is a great way to re-engage an audience who is already interested in hearing from you. Once someone is reading your email, you need a way to capture their attention and likely encourage them to take some kind of action (like click to your website). A beautiful map sparks the kind of curiosity you want readers to feel in an email.

For a couple reasons, it’s probably best to borrow from social media and use images for emails, rather than depending on an interactive map:

  1. Since you likely want the reader to take an action in your email, you don’t want to give everything away before that happens. Let the image be the taste that leads to the full meal on your site.
  2. There are so many email clients that you can’t be certain how an interactive map would display. It might show up a different size, strangely positioned, or not at all. That’s the nature of email design.

For these reasons, both business and technical, it’s best to use an image when embedding a map in your email.

Google Slides

A previous version of Google Slides supported IFRAME embeds, but the current version does not. Unfortunately, that means you can no longer embed interactive maps in Google Slides. Instead, we recommend you use an image of a map. If you wish to have the feeling of an embedded map, you can record your screen and use an animated image in your presentation.

iPhone

Many websites include maps that are mobile-optimized. When you load them on your iPhone, you’ll be able to explore them as you might expect on a phone, with an experience slightly below desktop.

For easy and fast access to your maps on the iPhone, there’s BatchGeo Mobile. It provides a native experience and gives you direct access to any maps you’ve created.


Are you ready to easily create an embedded map? Try BatchGeo for free.

NBA Finals on a Map: Most Appearances, Most Wins

Every year, the NBA season marches toward the goal of determining the best team in the league. Sixteen teams make the playoffs, all hoping to make it through three seven game series in order to get the chance to play one other team in the NBA Finals. Some teams have fared better than others in this conquest over the years (and some have had more years in the league to try it). Explore the map below to see the teams with the most appearances, most wins, and more.

View NBA Finals in a full screen map

Only the Boston Celtics and the Los Angeles Lakers have appeared in the NBA Finals 10 or more times. Between them, they’ve appeared in 40 finals, including 12 together. With 31 appearances, the Lakers have the Celtics beat at 21 appearances. The only other teams with five or more appearances are the Golden State Warriors (9), Philadelphia 76ers (9), New York Knicks (8), Detroit Pistons (7), Chicago Bulls (6), San Antonio Spurs (6), and Miami Heat (5).

As for wins, that’s where Boston beats LA. The Celtics have 17 wins, only losing four times in the finals—three times to the Lakers. Los Angeles is next with 16 wins, but they’ve lost 15 times—including nine times to the Celtics. There is one thing the Lakers can hang over the Celtics: then in Minneapolis, the Lakers won the very first NBA Finals. In 1950 they bested the Syracuse Nations (now Philadelphia 76ers) four games to two.

The Celtics have been around two more years than the Lakers. Boston was founded in 1946, while Los Angeles entered in 1948 (although, the Lakers were in Minneapolis until 1960). The 1940s were a great decade to start a basketball team. Seven were founded in 1946 alone. No teams started in the 1950s, but there was a similar resurgence in the 1960s with nine teams added. Among those the Chicago Bulls (1966) has the most wins, with six. Five teams joined in the 1970s, with Cleveland leading the way with its four NBA Finals appearances. For teams founded in 1980 or later, the Miami Heat (1988, three titles) and the Dallas Mavericks (1980, one title) are the only teams to have won an NBA Finals.

There are only 10 teams to have won more than one championship:

  • Boston Celtics (17)
  • Los Angeles Lakers (16)
  • Chicago Bulls (6)
  • San Antonio Spurs (5)
  • Golden State Warriors (4)
  • Philadelphia 76ers (3)
  • Detroit Pistons (3)
  • Miami Heat (3)
  • New York Knicks (2)
  • Houston Rockets (2)

Losing multiple times appears to be easier than winning. There are 17 teams who have made it to the finals only to lose on at least two occasions. Additionally, four teams have multiple losses within ever bringing home the trophy: Brooklyn Nets, Phoenix Suns, Utah Jazz, and Orlando Magic all are 0-2 in the finals.

The Pacers famously lost in their only finals appearance. Of course, they were lucky to just make it there. Seven teams have no appearances: Los Angeles Clippers (founded in 1970), Denver Nuggets (1976), Charlotte Hornets (1988), Minnesota Timberwolves (1989), Memphis Grizzlies (1995), Toronto Raptors (1995), and New Orleans Pelicans (2002).

Never making the finals is an ominous kind of perfection, but other teams have the kind others covet. Only three teams have won in every finals appearance. The Chicago Bulls, most notably, are 6-0. The team’s combined record across those six championship series is 24-11.

The other two teams with perfect records have either moved or no longer exist. The Sacramento Kings won in their only appearance in 1951 back when they were the Rochester Royals. The Baltimore Bullets won the BAA title in 1948, before the NBA was formed. The team went on to fold in 1954, the only former champion to cease to exist. Two other teams, have gone out of business. The Chicago Stags and Washington Capitols both lost in their only finals appearances.

Is the West Coast the Best Coast?

While it’s clear the Celtics lead the way in wins and the Lakers in appearances, those teams don’t represent everyone. We thought it would be useful to answer the age old question of East versus West. Here we’ve separated the teams in the league geographically, with the mighty Mississippi River used as the division point.

Total wins: East

East coast teams together have won 40 championships, while the West has taken the other 30. However, there are twice as many teams on the East coast as the West.

Wins per team: West

The 13 West coast teams average well over two championships each, while the east has less than two. With considerably more victories per team, the West clobbers the East here.

Win per opportunity: West

We needed a tie breaker, so we looked to the number of opportunities each coast has had at a championship. The Pelicans, for example, have only had 15 opportunities, while the Pistons have had five times that. East coast teams are an average of 53 years old, with 1,008 opportunities combined. The younger west coast averages about 50 years old, but that translates to only 651 opportunities. That means west coast teams win every 21 opportunities, whereas east coast teams need 25 opportunities to gain a victory.

There you have it: the West coast is the best coast! Of course, BatchGeo is based on the west coast, so our bias is showing clearly. Got your own take on which region is the ultimate NBA champion? Let us know by making your own map for free.

World’s Largest Map of the World’s Largest Roadside Attractions

Collage of the World's Largest

Ask around the world and you’ll hear that everything is bigger in the United States. Perhaps that explains why there are at least 195 roadside attractions in the US that consider themselves the “world’s largest.” They aren’t all verified—some are outright wrong. But each makes its claim with the gusto of a carnival barker, another trait that could be considered very American.

Across 41 states, here is the World’s Largest Map of the World’s Largest Roadside Attractions. Or is it?

View World’s Largest Roadside Attractions in a full screen map

Click around, search for attractions near you, or filter based on these categories:

  • Animals: fish, buffalo, and larger than life dinosaurs
  • Things: thermometer, chairs, and the biggest ball of twine in Minnesota
  • Foods: artichoke, peanut, and a really big ketchup bottle
  • Places: water towers, truck stops, and the World’s Largest Collection of World’s Smallest Versions of World’s Largest
  • People: Abe Lincoln, Paul Bunyan, and the giantest Jolly Green Giant
  • Plants: a catchall for trees, vines, and stumps

Nation’s Most of the World’s Largest

At first glance, you’ll see these attractions are well distributed across the country. Sure, they get a little sparse in the open fields of the west, but everything does. There are six states that have more than 10 of these attractions, with California and Ohio leading the way.

Cabazon Dinosaurs

California (14)

The Golden State tops out 48 other states with more than a dozen “World’s Greatest” to explore. Perhaps best known are the dinosaur statues of Cabazon, California. These creatures off the I-10 were featured in the 1985 film Pee Wee’s Big Adventure. The Brontoosaurus and Tyrannosaurus rex weigh a combined 250 tons.

Other California attractions include a thermometer, an artichoke, and the famous donut at Randy’s Donuts in Inglewood.

Ohio (14)

Midwest stalwart Ohio hangs with the coastal elites when it comes to roadside attractions. The Buckeye State is tied with California, though perhaps not with the acclaim of some of the west coast locations. Still, the list includes a crystal ball, a cuckoo clock, a cheese wheel and — not just a pumpkin, but also a pumpkin pie. Each one claiming to be the world’s largest.

Catsup watertower

Illinois (11)

If you find yourself driving through Illinois toward St Louis, you really owe yourself a stop at the World’s Largest Ketchup Bottle. You can’t miss the big red water tower with a white cap and an old timey looking “CATSUP” spelled across a green label.

The Ketchup (or Catsup) Bottle is joined by 10 other world’s largest people, places, and things. They include the largest statue of the state’s native son, Abraham Lincoln, a wind chime, and rocking chair. Notably, seven of the 11 are located in the city of Casey, by far more than any other single city.

Michigan (11)

From a crucifix to a lugnut, Michigan has you covered. The state’s two cherry pie champions are detailed in the disputed records below, but there’s still fun to be seen without desserts. For example: Ishpeming, Michigan, is home to both the World’s Largest Running Chain Saw and the World’s Largest Working Rifle. That sounds like the World’s Largest Liability.

Minnesota (11)

The land of lakes pays homage to, among other things, its state bird. The World’s Largest Loon in Vergas welcomes visitors each August for Looney Dayz. Of course, you can find it any time of year, sitting near highways 4 and 228, standing nearly 20 feet tall.

Seven of the 11 Minnesota roadside attractions are animals. In addition to the loon, there’s a Fish, Prairie Chicken, Pelican, Turkey, Tiger Muskie, and Walleye.

Not to mention that ball of twine.

Texas (11)

Finally, the biggest state in the contiguous United States weighs in at 11 world’s largest roadside attractions. And this Texas list is so folksy, we just can’t help but share the whole darn thing: World’s Largest Caterpillar, Fire Hydrant, Jackrabbit, Muleshoe, Pecan, Rattlesnake, Roadrunner, Watermelon, Patio Chair, Peanut, and Strawberry.

Most of these are outside the state’s largest cities. But if you find yourself in Dallas, you might as well go check out that patio chair. It comfortably seats two.

Disputed Records Abound

The veracity of the claim “world’s largest” is not always respected. Indeed, there are many duplicate and disputed examples on the map. In fact, the Wikipedia article from which we created this map is under review, as editors has out which are the real world’s largest. In the meantime, these roadside attractions are likely delighting those who see them. Does it really matter which cherry pie is largest?

There are competing claims for these attractions:

  • World’s Largest Cross (Orlando and Louisiana)
  • World’s Largest Peanut (Ashburn, Georgia; Pearsall, Texas)
  • World’s Largest Rocking Chair (Casey, Illinois; Fanning, Missouri)
  • World’s Largest Egg (Mentone, Indiana; Winlock, Washington)
  • World’s Largest Pencil (Glen Burnie, Maryland; St. Louis)
  • World’s Largest Pecan (Brunswick, Missouri; Seguin, Texas)
  • World’s Largest Fire Hydrant (Columbia, South Carolina; Beaumont, Texas)
  • World’s Largest Strawberry (Ellerbe, North Carolina; Poteet, Texas; Strawberry Point, Iowa)

Can you believe it? Three world’s largest strawberries. I think the others should concede it to a city with “strawberry” in the name.

Orlando gladly gives World’s Largest McDonald’s to Vinita, Oklahoma. That’s because the Florida city proudly claims the second-largest location of the popular fast food restaurant.

Oh, and that cherry pie? It matters to some folks in two Michigan towns. When the record was set in 1976 by the town of Charlevoix, Michigan. At 17,420 pounds, you’d think nobody would try to break it. After all, the Charlevoix pie was made with cement mixers, dump trucks, and required a helicopter to sprinkle the sugar on top. Yet, just 11 years later, Traverse City, Michigan, just 50 miles away, eclipsed the record with its own 28,000 pound pie. This article traces the history of that rivalry, though both have since been beat by a city in British Columbia.

Biggest ball of twine in Minnesota

Unique Enough to Not Be Questioned

Some claims are so specific or unwanted, that they deserve every commendation.

  • The Berkeley Pit in Montana is a former copper mine that is now the Worlds Largest Man Made Body of Toxic Water. You can have that one, Montana.
  • While Minnesota does not have the World’s Largest Ball of Twine, it does have the largest one created by one man, which makes it notable. Cawker City can keep their record, as the entire community continues to add twine.
  • World’s Largest Collection of World’s Smallest Versions of World’s Largest is also the longest name of any on the map.
  • And finally, the World’s Largest Squirting Clam in Long Beach, Washington, doesn’t really need the “squirting” qualifier. Though sometimes called a Spitting Clam, there appears to be nobody else claiming the World’s Largest Non-Squirting Clam.

Explore more of our World’s Largest Roadside Attractions Map in a full window. See what unique and wonderful things you can find. And when you’re ready to add your own strange locations to a map, check out our super simple map building tool.

The Biggest Hotels in the World on One Map

These hotels better have stock in pillow chocolates. There are over 200 hotels in the world with 1,000 or more rooms. Many of the hotels have even more than that—over 50 of them have 2,000 or more rooms, and 4,000 rooms isn’t even enough to get you in the top 10. That’s a lot of tiny bars of soap!

While the United States leads the way in the number of hotels, Malaysia claims the largest in the world. Macau, Russia, and Thailand join the highest ranks, as well. Over half of the top 10 are in the same city, and you probably won’t be surprised to learn where that is.

View Biggest Hotels in the World in a full screen map

Click around the map, using the grouping functionality, or read on for our assessment of the top 10, countries with the most hotels, and what the biggest hotel rakes in every night when at full capacity.

Top 10 Biggest Hotels in the World

  1. First World Hotel (7,351 rooms), Genting Highlands, Malaysia
  2. The Venetian and The Palazzo (7,117 rooms), Las Vegas, United States
  3. MGM Grand + The Signature (6,852 rooms), Las Vegas, United States
  4. CityCenter (6,790 rooms), Las Vegas, United States
  5. Sands Cotai Central (6,000 rooms), Macau, Macau
  6. Izmailovo Hotel (5,000 rooms), Moscow, Russia
  7. Wynn Las Vegas + Encore Las Vegas (4,750 rooms), Las Vegas, United States
  8. Mandalay Bay + Delano + Four Seasons (4,426 rooms), Las Vegas, United States
  9. Luxor Las Vegas (4,407 rooms), Las Vegas, United States
  10. Ambassador City Jomtien (4,219 rooms), Pattaya, Thailand

Together, these top 10 hotels in the world have 56,912 rooms. At double occupancy, the entire city of Clearwater, Florida, could all go on vacation at these 10 properties at the same time.

First World Hotel

The First World Hotel, number one on the list, has two towers and over 50 stories total. In addition to rooms, the nearly 2 million square foot facility includes a shopping mall and a theme park. If the hotel uses industry standard workloads for its housekeepers, full capacity requires a staff of over 500 just to clean the rooms. Of course, there would be plenty of money to cover those costs: a sold out First World Hotel would be over $700,000 per night if guests paid full price. And that just includes what they spend on the room, not their trips to the cineplex, dining, or casino.

Speaking of casinos, the most popular city for large hotels is clear with a glance through the top 10. Six in the list are in the same “little" city in Nevada. Some of Las Vegas’ most recognizable names are included above, with 32 hotels in all on the map, far more than any other city.

New York City is next on the list of cities with the most high capacity hotels. There are nine hotels on the map in The Big Apple. The largest, the New York Hilton Midtown, has nearly 2,000 rooms across 47 floors.

Disney World is to credit for Lake Buena Vista and Orlando’s many large hotels. Each city has eight. Five other cities have five or more of the biggest hotels: Atlantic City (7), Chicago (7), Macau (6), Mecca (6), and Reno (5).

Countries With the Most Large Hotels

Nearly two-thirds (139) of the 209 hotels in the world with 1,000 or more rooms are in the United States. The map may make that clear, showing nearly half of the 50 states represented. However, the map also shows the remaining 70 large hotels are spread throughout the rest of the world. Five continents have large hotels—South America and Antarctica don’t make the cut.

There are 13 countries that have three or more high capacity hotels:

  • United States (139), total capacity 263,739
  • Saudi Arabia (7), total capacity 9,665
  • Macau (6), total capacity 20,401
  • Russia (5), total capacity 10,738
  • Japan (5), total capacity 8,368
  • France (5), total capacity 5,134
  • China (4), total capacity 6,525
  • Canada (4), total capacity 5,338
  • Thailand (3), total capacity 6,879
  • Singapore (3), total capacity 4,873
  • United Arab Emirates (3), total capacity 4,157
  • United Kingdom (3), total capacity 3,710
  • Germany (3), total capacity 3,145

The total capacity, of course, only includes the hotels with over 1,000 rooms. (That is, Germany obviously has more than 3,145 rooms in the entire country when you include its many lower capacity hotels). Nevertheless, the 190 hotels represented in these 13 countries together include over 350,000 rooms. If each of those rooms had a minibar, those small refrigerators would take up more than half of a Panamax container ship. Imagine all that expensive booze!

A whole lot of insights can fit in a single map. Why not create your map today?

How to Cluster Map Markers: Demo and Tutorial

Maps are a great way to show location data. The stories within the numbers appear when you can see them geographically. It might seem natural that the more points you add to a map the better story it tells, but that’s not always the case. Ideally you could summarize the underlying data, which requires map clustering technology. There are several ways to convert hundreds of markers into a reasonable number that still share the underlying story underneath. The approaches vary in effort and programming ability required, but all can bring even more understanding to your geographic data.

End Marker Overload

Marker Overload

We’ve all probably seen web maps like this. There are so many markers on that map, you can’t even see the map. The colors of the markers tell some kind of story, but there’s so much overlap with other icons that you might well just be missing other data.

A map with fewer markers allows the viewer to take in the information, rather than being overwhelmed. The way marker clustering works is that it provides a summary marker that gives you an idea of what’s “below” at closer zoom levels. Typically, you click a clustered marker to automatically zoom into an area with either additional clustered markers or individual markers. The viewer is able to see just enough at each stage to make sense of where to click to investigate further.

Gridded clustering to reduce Marker Overload

One way of creating clustered markers is to overlay a grid, as in the example above. Though, usually a visible grid is not used. Instead, the grid is defined by latitude and longitude coordinates to evenly segment the area of the map currently in view. Then, any markers within a particular grid are removed and replaced by a single marker, often labeled with the number of markers beneath.

Markers clustered

Above is one example of how a clustered map might look. In that example, the meaning of the color is removed in favor of the number of markers. However, you’ll see in the next section an alternative method that keeps that data visible within the clusters.

Copy-Paste Map Clusters

The easiest way to make web maps is to paste spreadsheet data into BatchGeo. You can include addresses, city names, or other location data, which get converted automatically into latitude and longitude coordinates. There are also several clustering options built into the service, which means you can get data-rich, readable maps in minutes.

Marker clustering showing averages

Let’s say you have a spreadsheet with the average household income of every county in the United States. That’s actually the exact example of marker overload from the previous section. At over 3,000 counties to display, the map looks very crowded without clusters. Here’s how to make a much simpler map that better communicates the meaning of the data.

  1. Copy and paste your spreadsheet into the map making tool
  2. Click Validate and Set Options, then Advanced Options
  3. Click Enabled clustering for high density markers
  4. Select the new option to choose average and Median Income (or whatever your data example)
  5. Finally, click Make Map


The result will be a map like this, with the average of the Median Income values for each county in a cluster displayed as the label.

View Household income, average clustering in a full screen map

You can also get a much simpler cluster that merely counts the number of markers below each cluster. To achieve this basic clustering, just skip step 4 in the instructions below. You can see this example on the BatchGeo marker clustering page, along with sum clustering, which adds up all values in a cluster, rather than averaging.

If these examples don’t suit what you need, you’ll likely need to dig in and write a little code yourself, though you may still be able to copy-paste some of it.

Use MarkerClusterer Library

Google Maps is essentially a standard on the web now. It’s everywhere, used by sites big and small. In fact, it’s the foundation of the BatchGeo example above. Though, when you make Google Maps yourself, you’ll need to write the code to perform some of the fancier bits.

Google provides an open source library to help turn existing Google Maps with markers into a clustered map. While you’ll need some programming background, you can find map tutorials on Google’s site. We can’t go into detail in this post about programming Google Maps, but we’ll show enough to see how the MarkerClusterer works.

The short version is that instead of making a marker like this:

var marker = new google.maps.Marker({
  position: {lat: 37.8077333, lng: -122.4750286},
  map: map
});

You add all markers to a clusterer, like this:

var marker1 = new google.maps.Marker({
  position: {lat: 37.8077333, lng: -122.4750286}
});
var marker2 = new google.maps.Marker({
  position: {lat: 37.9077333, lng: -122.5750286}
});
// Continue creating markers like above...
var markers = [marker1, marker2]; // add additional markers to the array if you have them
var markerCluster = new MarkerClusterer(map, markers);

So, instead of including the map variable in each marker, you pass map and an array of markers to the MarkerClusterer, which creates the clusters if necessary.

You’ll also notice that to create Google Maps, you must know the latitude and longitude coordinates. If you don’t already have those for your locations, you’ll need to use a geocoder to convert your addresses (and other location values) into coordinates.

Despite requiring code, using the MarkerClusterer is about as simple as you can get when building Google Maps yourself. If this is too much work, we recommend the copy-paste option above, which provides a lot of advanced mapping in a very simple approach.

However, if you want to dig even deeper, you’ll probably be writing your own clustering algorithm, or building off of other open source technology.

Write Your Own Clustering

This option is the most customizable, but obviously requires some significant coding skills. Since there are hundreds of different directions this could take, we won’t go into details here, but instead give a few resources to consider:

  • Leaflet is an open source library used by the most hardcore of web mappers
  • Leaflet.markercluster is a clustering plugin for Leaflet
  • Anycluster is server-side clustering for use with Geodjango

These and more can be found in this GitHub search for those comfortable with code.

For all others, we recommend checking out our spreadsheet to map tool right now. It’s free and has clustering built in.