County Outlines Mod/Creating Outline Files

From TNG Wiki

Jump to: navigation, search


The County Outlines Mod allows use of cfile in addition to the auto detect mod for US and Canadian counties. You can create other outlines for any geopolitical feature, such as for the Regions or Departments in France.

The Mod is able to parse data in three related formats -- KMZ, KML and XML. Instructions for creating files in all three formats are listed below. See bottom of page for additional online map resources.

Creating and using Keyhole Markup Language (KML) Outlines

Keyhole Markup Language (KML) is the standard used by Google Earth for creating custom shapes and features. See Google Earth tutorial for more information about the contents of the .kml file.

KML is now the preferred format for map outlines in the TNG County Outlines Mod.

To create an outline in KML format:

If you are unable to save the file in KML format, save as KMZ and follow these additional steps:

Your file is now ready to use.

Creating and using KMZ Outlines

Keyhole Markup Zip (KMZ) files are compressed mapping files produced by Google Earth. Their primary purpose is to serve as a package file for complex mapping or drawing projects that utilize both vector and raster data. See Google's KMZ tutorial for more information about the format.

Google Maps, such as those used within TNG, can only display a subset of the features available within the KMZ format, so it is recommended that you convert the KMZ file into a KML file by following the steps listed above. However, if you obtain KMZ files from a third-party source that has additional data beyond a KML file, you can also use them directly with the Outlines Mod.

Make sure the KMZ file has an appropriate file name. Your file is ready to use.

NOTE: Due to the way Google servers must fetch and parse them, KMZ files are unable to be displayed on localhost installations. KML and XML files do not have this limitation and can be displayed in any server setting.

Creating XML Outlines

Previously, XML-based polygon files were the only option available for drawing polygon shapes onto Google Map images.Thus the original version of the US County Boundaries Mod was written to read this format, and all of the US County Boundaries provided by Bret Rumsey are in this format. The polygon XML format is a derivative of KML format. Although the current County Outlines Mod continues to read this format, there is no advantage to using this format over KML, and the use of KML is now preferred due to ease of file creation.

If you want to create polygon XML files, first follow the steps listed above to create a KML shape within Google Earth. (If you have a .KMZ file, rename it to .zip, unzip it and extract the doc.kml file.))

Editing the KML

You must manually edit the .kml file to convert it into the Google Maps polygon XML format.

The easiest way to do this is to use a text editor that offers a find/replace all function.

The resultant file should look like the following

<boundary> <polygon>
  <pt lng="-0.04890072185177896" lat="47.11330564897132" />
  <pt lng="-0.07382456621640499" lat="47.06483820872138" />
  <pt lng="-0.04890072185177896" lat="47.11330564897132" />
</polygon> </boundary>

Note that the last set of coordinates should be the same as the first set of coordinates.

Save (or rename) the file to an .xml extension (e.g. filename.xml). Your file is ready to use.

Using the new outline file

CAUTION: In some rare instances, a server will not serve files with unusual file extensions such as .kml and .kmz without modifying .htaccess or the server configuration. In the event that your server has this problem, the easiest workaround is to add .xml to the end of the file names (e.g. filename.kml.xml).

Map Resources

Related Links

Personal tools
TNG Guides
Items of Interest