Real-Time information sharing with KML and Google Docs

Started by berkley, April 06, 2012, 13:57:41

0 Members and 1 Guest are viewing this topic.

berkley

Hi everybody,

I found a very nice way, to manage the informations you need on some POIs and tracks. Especially for informations, that change very often.
So I'll write this little turorial to get started.

What we'll gonna do:
    Creating this kml File:
https://docs.google.com/open?id=0BwG8sR ... LTQ1R1J0UQ[/list]
    Enter data in a Google Doc:
https://docs.google.com/spreadsheet/ccc ... FlYUlhDd2c[/list]
    Edit your data and see changes in Locus

What you need on your phone:
    Locus :mrgreen:
https://play.google.com/store/apps/deta ... .locus.pro[/list]
    Google Docs
https://play.google.com/store/apps/deta ... .apps.docs[/list]
What you need on your Desktop PC:
    a text editor, i prefer Notepad++, but i works with others too
    Google Earth

(1) Create your kml file with Google Earth
Create a new folder in Google Earth and give it a name. Create 3 new points. Doesn't matter where these points are. Give them names. In this example, I chose "POI 1", "POI 2" and "POI 3". Right-click on the folder name and click "save location...". Save as kml file.
I created a sample file, you can download here: https://docs.google.com/open?id=0BwG8sR ... Z0tNek1UQQ

(2) Create the Spreadsheet on Google Docs
Log in to Google Docs: https://docs.google.com/ and create a new spreadsheet with 3 sheets called "POI 1", "POI 2" and "POI 3".
Enter your information for every POI you created in step (1). You can use all features that comes with Google Docs. In general, you can do this with every kind of Google Docs (Document, Presentation, Table,...), but for this example, I'll stay with a spreadsheet.
Same as in step (1), i created a sample spreadsheet, that you can use with the kml file, that gets linked later on: https://docs.google.com/spreadsheet/ccc ... FlYUlhDd2c

(3) Get the URL for every sheet
On the menu bar in Google Docs click on "File -> Publish to the Web". (Btw, no need for sharing options!)
On the dialog under "Sheets to publish" choose "POI 1"and click "Start publishing".
Under "Get link to the published data, choose "WebPage" and "POI 1")
For our example, we'll get this link:
https://docs.google.com/spreadsheet/pub?key=0AgG8sRcjn3q6dDVnM1B3Z0ZGdEs3TU4zdFlYUlhDd2c&single=true&[b]gid=0[/b]&output=htmlThe interesting part about this link is almost at the end: "gid=0". The sheets are counted from 0. So sheet 1 or "POI 1" is gid=0. POI 2 is gid=1.

(4) Adding description to the kml from step (2)
It's getting a bit tricky now, i hope you understand this part :D
Now you open your kml in your favorite text editor. You should see something like this for every point:
<Placemark>
<name>POI 1</name>
<Point>
<coordinates>12.4644505116075,51.2073920580829,0</coordinates>
</Point>
</Placemark>

What we now do is adding the description to this POI. between the tags <name> and <Point>, we'll add the description tag: "<description></description>". In addition with iframe, we'll get our Google Spreadsheet working. Your code should now look like this now:
<Placemark>
<name>POI 1</name>
<description>
<![CDATA[
<iframe src="https://docs.google.com/spreadsheet/pub?key=0AgG8sRcjn3q6dDVnM1B3Z0ZGdEs3TU4zdFlYUlhDd2c&single=true&gid=0&output=html"
scrolling="yes" width="500" height="600" frameborder="0"> </iframe>
]]>
</description>
<Point>
<coordinates>12.4644505116075,51.2073920580829,0</coordinates>
</Point>
</Placemark>
where the additional tags mean:
scrolling="yes": options yes or no. En- or disable scrolling
width="500" height="600": the width and the height for the iframe
frameborder="0": options 0 and 1. display a boarder around the iframe
Do this procedure for every POI in the description.
You should get this file: https://docs.google.com/open?id=0BwG8sR ... LTQ1R1J0UQ

(5) Open this kml in Locus
Now open this file in Locus and see how it works.  :mrgreen:
As this is a kml file, you can import it or use it in MapsItemsManager.
Click on a POI and see the description. Make changes on the Google Document, wait 5 minutes for the next auto-refresh and your changes are there!

This is just a tutorial to get started. There are plenty of possibilities for iframes used in a kml file in combination with Google Docs. Imagine the possibilities!!!  :mrgreen:
As I heard, there is a planned feature for CSV Import. The export of the Spreadsheet can be changed from "output=html" to "output=csv" and you'll get an updated and always synced CSV file for import to Locus... :ugeek:

Cheers, berkley
Search before posting!!!
XDA Orbit, HTC Touch HD, SGS1, SGS2, Nexus S, S4 Active, OnePlus One, Innos D6000
OnePlus X
  •  
    The following users thanked this post: ColdAutumn