Locus Map - forum

Content & Tools => Tools => Topic started by: berkley on April 06, 2012, 13:57:41

Title: Real-Time information sharing with KML and Google Docs
Post by: berkley on April 06, 2012, 13:57:41
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:
https://docs.google.com/open?id=0BwG8sR ... LTQ1R1J0UQ (https://docs.google.com/open?id=0BwG8sRcjn3q6N3dsZjVEYnZRenlzTVFwLTQ1R1J0UQ)[/list]
https://docs.google.com/spreadsheet/ccc ... FlYUlhDd2c (https://docs.google.com/spreadsheet/ccc?key=0AgG8sRcjn3q6dDVnM1B3Z0ZGdEs3TU4zdFlYUlhDd2c)[/list]

What you need on your phone:
https://play.google.com/store/apps/deta ... .locus.pro (https://play.google.com/store/apps/details?id=menion.android.locus.pro)[/list]
https://play.google.com/store/apps/deta ... .apps.docs (https://play.google.com/store/apps/details?id=com.google.android.apps.docs)[/list]
What you need on your Desktop PC:

(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 (https://docs.google.com/open?id=0BwG8sRcjn3q6NTEyQjctcy1UUnVSVVJTZ0tNek1UQQ)

(2) Create the Spreadsheet on Google Docs
Log in to Google Docs: https://docs.google.com/ (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 (https://docs.google.com/spreadsheet/ccc?key=0AgG8sRcjn3q6dDVnM1B3Z0ZGdEs3TU4zdFlYUlhDd2c)

(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 (https://docs.google.com/open?id=0BwG8sRcjn3q6N3dsZjVEYnZRenlzTVFwLTQ1R1J0UQ)

(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