background

When I originally created my "mymaps" map, I decided organization via layers was the way to go. Unfortunately, I soon hit the layer ceiling (which I believe is 10). Undoing this mistake has been a mindblowingly frustrating experience. In order to reduce layers and assimilate all the maps and points of interests I can find on the internet, I've wasted hours of my life trying to merge the layers using a variety of stupid and frustrating methods.

After about a decade of dealing with this nonsense, I finally realized how easy the solution is.

THE PROBLEM:

When I tried to move the placemarks from one layer to another from within mymaps itself, I get about 5-10 moved before mymaps crashes. EVERY TIME. So I hit the error message > Reload link it generates and find that most of the ones I moved didn't get saved. It takes forever and crashes and loses all your work.

Google results for this problem were all unnecessarily convoluted bullshit which doesn't work.

I wasted a bunch of time with online tools that automatically merge kml's for you. But they seem to lose the icon styles/colors and default everything to blue. It'd take a LONG time to redo all the individual placemark icons. All of the automatic KML merger tools are dumb and useless and the people who made them need to be depantsed ASAP.

THE SOLUTION:

KML files are just XML files. And each layer is simply a "<folder>". Which means...

All you have to do is modify the code to remove the separate folders and thus contain your placemarks within WHICHEVER LAYER(\FOLDER) YOU WANT THEM IN.

Depending on your ability to CTRL+F and search through XML code, this is EASY and takes mere SECONDS.

How To Merge Layers In Google Mymaps

Download your KML file. Make a copy of it to back it up because you're a dumbass who will probably overwrite the original by accident. Change the file extension to XML. Open it with Notepad++

The top part of the XML file contains a bunch of (apparently useless) information. The important stuff starts with the first <Folder> tag. In my case, this is generally around line # 3593. Simply CTRL+F and search for <Folder>. That's your first layer. In the code, each layer is called a <folder>. The first <folder> tag should be just below the </StyleMap> tag. Look at the tag above it and verify the <folder> tag is just below the </StyleMap> tag.

What you'll want to do is find each layer (aka folder) that needs to be removed. This is simple. Search for the <Folder> and </Folder> tags. The tag with the backslash indicates the end of your layer (aka folder). Here's an example snippet of code. The name of the next layer (aka folder) is always just below these tags. You just need to keep track of which layer (aka folder) you're in because every tag must have an opening tag: <> (without forward slash); and close tag :</> (with forward slash).

This code snippet shows the important bits:

</Placemark>

</Folder>

<Folder>

<name>Layer 2</name>

<Placemark>

In order to remove a layer, simply DELETE the tags between the </Placemark> and <Placemark> tab from every layer (aka <folder>) that you're wanting to remove in your code.

NOTE: The <name> tags are what define the name of the layer (aka folder) so delete each name along with every pair of folder tags otherwise layer names could get all mixed up.

Note that every pin from your map is a <Placemark> in the code. The code is read top to bottom, so everything below this point would inherit the layer (aka folder) name from the preceding folder's name tag. Referring to the above example in which Layer 2 is being removed: all placemarks down to the next </Folder> tag will subsequently be in Layer 1 (assuming the preceding layer was named Layer 1).

So the above code snippet should now look like this:

</Placemark>

<Placemark>

This indicates a layer and a layer name has been removed. SUCCESS.

The very end of your code should look like something like this:

</Placemark>

</Folder>

</Document>

</kml>

Simply note that there's very little code here: There's the end of your last placemark, the </Folder> end tag and the document and kml closing tags. You should have at least one <Folder> start tag at the top of the code (directly under </StyleMap> tag), at least one set of <name> tags, and one </Folder> end tag at the bottom like this. Do not change these tags, just be aware that they need to exist and remain as they were before you started messing around with the code.

You can put a set of folder (with accompanying <name>) tags basically anywhere in the code between placemarks. You just can't have more than 10 or so layers (aka folders) in a mymaps file.

When you're done, just change the extension back to KML and upload. Create a new mymap to test/verify.

If you're merging X number of layers into one, then you should only have ONE <Folder> start tag at the top and one </Folder> end tag at the bottom and that's it. If you want more layers, just make sure you have both start and end folder tags to contain them. All you gotta do is realize that the <Folder> tags designate your layers start point and </Folder> designates your layer end point.

By doing this, you also RETAIN ALL of your icons/colors/etc.

I have NO IDEA why this information wasn't posted elsewhere on the internet, or why all the online mergers/etc that I've tried totally erase all the icon/color settings when it's this EASY to do it correctly and RETAIN ALL ICONS AND COLORS.

I've tested this on various map KML files of mine and I've found that the (apparently useless) header information makes literally no impact on any of my maps. Cutting and pasting the content of the <Folder></Folder> tags (and all placemarks contained therein) WORKS FINE across any of my maps. I can cut and paste all my maps together however the fuck I want. It works.

Organic Maps is what Google's Mymaps should have been

If you're this deep into maps, you should know that Organic Maps is what Mymaps should have been. It works offline, it's compatible with KML's and you can download maps for a given area. I am not affiliated, just a fan.

0 Comments:

Post a Comment