KML files and Geopointe
Whether via Geopointe or a free application like Google Earth, spatial data is best displayed on a map. Coordinates and addresses can be displayed in fields on a Salesforce record, or spreadsheet, but seeing the full spatial context of data can unlock powerful insights and conclusions which otherwise would have been overlooked.
Geopointe users will find all of their Salesforce data immediately available without any need for importation or saving to external files. Users of other mapping applications will have to find a way to package their data and import it into a mapping application, which can prove quite challenging.
Flat Files vs. Shapefiles
Many options, such as flat files and Shapefiles, exist for moving location data between systems. The trusty spreadsheet, for example, is reliable but can be difficult to manage. Spreadsheets and other flat file formats are not optimized to accommodate the complex and precise relationships among spatial data records.
For more complex datasets, a Shapefile may be the right choice. The Shapefile structure is ideal for storing spatial characteristics of records. Unfortunately, the creation and management of Shapefiles requires familiarity with a GIS system like ESRI’s ArcGIS or the open sourced alternative qGIS. Either application requires extensive training, debugging, and a stomach for frustration. Be prepared to troubleshoot and get creative, or hire a consultant!
Luckily, there is a happy medium between these two – the KML file. KML is a markup language similar to HTML which allows plain text files to store different types of spatial records and attribute data in a format which is readily understandable in many map applications. KMLs can handle fairly complex datasets, but are simple enough to be human creatable and editable.
KML is short for Keyhole Markup Language. Keyhole was the original developer of Earth Viewer, or what is now Google Earth. Google purchased Keyhole in 2004, and absorbed the Earth platform into Google’s spatial efforts. Fortunately, the KML framework has survived as a convenient way of packaging spatial data.
What is a KML?
A KML is a plaintext file which follows the Keyhole Markup Language framework. Structurally, the file is very similar to XML, and utilizes tagged, nested elements. A KML file can be edited in any developer focused text editor, such as TextWrangler or Notepad++. The file structure is simple and human readable.
What about KMZ?
A KMZ is simply a compressed KML. A KMZ will consume less storage space than the same data in a KML file, but KMZ files are not user readable. Opening a KMZ in a text editor results in a window of random characters, while opened a KML file will result in human readable code.
The same file formatted as a KMZ (left) and KML (right).
The KML file structure is well documented in Google’s Developer Resources. The KML Tutorial page provides the following example and description of a KML file containing a single point:
<?xml version="1.0" encoding="UTF-8"?>
<description>Attached to the ground. Intelligently places itself
at the height of the underlying terrain.</description>
The structure of this file breaks down as follows:
- An XML header. This is line 1 in every KML file. No spaces or other characters can appear before this line.
- A KML namespace declaration. This is line 2 in every KML 2.2 file.
- A Placemark object that contains the following elements:
- A name that is used as the label for the Placemark
- A description that appears in the “balloon” attached to the Placemark
- A Point that specifies the position of the Placemark on the Earth’s surface (longitude, latitude, and optional altitude)
When imported into a mapping application like Google Earth, the above placemark would be a point located at 37.42 degrees of latitude, and -122.08 degrees of longitude. Hovering the cursor over the point in Google Earth will display a popup containing the name and description of the feature.
Displaying KMLs in Geopointe
KML files are a convenient way to visually overlay spatial data on your Geopointe map. A KML file which is available at a public URL can be viewed on a Geopointe map. Geopointe utilizes Google’s KML file handling architecture, meaning that KML files may only be displayed in Geopointe if they comply with Google’s guidelines.
The following limits are specified on Google’s KML guidelines page:
|Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ)||3MB
|Maximum uncompressed KML file size||10MB
|Maximum number of Network Links||10
|Maximum number of total document-wide features||1,000
Natively stored data provides a far superior mapping experience. Salesforce records can be mapped at a very granular level. Filters and pin coloring rules are easily to implement against native data. A shape drawn in Geopointe or added via the Shape Library can be used for Geographic searching, selection, and bulk actions such as change owner or add to campaign.
When a KML file is opened in Geopointe, it’s rendered inside Google’s platform and is arrives in Geopointe along with the Google basemap. Important to note is the fact that KML files in Geopointe are strictly a visual overlay. KML features cannot be used to search against or filter records, nor can they be used to select records or bulk change owner. Clicking on a KML feature in Geopointe will display the attribute data of that feature in a pop-up balloon, but no other actions are possible with KML data.
Exporting from Geopointe
Perhaps it’s not always the case that external data needs to be displayed in Geopointe. Equally likely is that Salesforce data might need to be exported and displayed in another mapping application such as Google Earth. Luckily, it’s easy to export Geopointe’s search results directly to a KML file.
By default, export functionality is disabled to protect your data. To enable export to KML, go to Geopointe Setup>Actions and click edit next to “Export to KML” and tick the “active” button.
The “Actions” button on the map page (right hand side below the map and above the data table) will now have an option to export to KML. All results can be exported at once, or individual records can be selected and only those records will be exported.
Metadata can be exported as part of a KML file according to the fields selected for that dataset. As part of creating a data set in Geopointe, the user can select which fields are pulled from the record and displayed in Geopointe’s results. These same fields will be exported as part of a KML file.
KML files are a great tool to keep in mind when navigating the world of spatial data. Less complex than a Shapefile, KMLs provide more functionality than a plain spreadsheet and work well with a variety of open source and proprietary mapping applications. While Salesforce.com users will likely not need to export much data, KML files provide a convienent vehicle to do so.
Share these resources with your friends and colleagues.
Get more articles like this one sent to you via email
Keep up to date with Geopointe product announcements, articles, and webinars.
Don′t worry, you can unsubscribe any time