Google
Official Google Earth Download Site

Google Earth Community System Reliability: HIGH

Education >> Tools

Jump to first unread post. Pages: 1 | 2 | >> (show all)
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
How to use a Spreadsheet & GE
      #550183 - 08/09/06 02:08 PM

This Tutorial shows how can a Spreadsheet be used to build a huge kml file, with thousands of placemarks in an very fast way.

Also, it introduces you in the use of an On Line Spreadsheet to create a Network Link file.

It doesnīt pretend to be a Spreadsheetīs Tutorial, just a guide to use this kind of products to automate actions with lot of Data.

The Tutorial was designed for people with no experience in Spreadsheets, nor kml editing.

Be careful with the Data you select. Choose Data Sets that can be used by public. Always mention the source. Ask for permit if you are not sure. Donīt make duplicated placemarks.

To make the Tutorial just follow the steps in this threath; 1,2,3,, etc...

I hope youīll find it useful...

Edited by Gerardo64 (04/02/08 08:58 AM)


Post Extras: Print Post   Remind Me!   Report this Post  
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
1- Whatīs a kml File? [Re: Gerardo64]
      #550282 - 08/09/06 03:53 PM

Maybe you once opened a Google Earth File with a text editor because you wanted to edit it and you found with some strange "language" like this:





Of course this canīt be edited...Is the KMZ File Format. Is the same info that youīll find in a kml but compressed . Is like a zip file with all the stuffs embebed. So, if you want to edit it in Word Pad (Windows) or any text editor you have to Save As...kml , in GE first.

Then, when you open the new kml file youīve just created, youīll see this:



We now can edit this....

What I will ask you now is to open the Google Earth Client ( that sounds serious...), or GE, and create, in any place, no matter where, a New Placemark. Name it Test, add a description saying: This will not be a duplicate placemark (just kidding..), and Accept.



OK. Good. Now, right clic over the Placemark Name and "Save as"



Choose the kml Format. Remember where you save it because after saving it as a kml file, we are going to open it with our Text Editor.



OK. Open it in the Text Editor. Youīll see this:



You are watching a kml file. There we can see commands. They are contained in < >signs. You see that when a command begins says, for instance <name> Here goes the name youīll see, then, the command is closed with a </name> command (see the "/" Slash?).

OK. See how the "Name" command start / ends, and the "description", and the "LookAt" also...everything in kml Start / Ends (like in real life, donīt you think? ).
All the elements needed to make a placemark are within the command "Placemark".
The first 2 lines of the file (<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">) are always the same, as the last line (</kml>).

Another important thing we have to know is that we can put all this data in one line and itīs going to work fine, this structure is just for a fast finding of the commands...but is not neccesary at all...

So what we are going to learn in this Tutorial is how to use a Spreadsheet to "cook" our data, big amount of data, to make a GE file very fast.

--------------------
"No branch of the United States Government is currently involved with or responsible for investigations into the possibility of alien life on other planets or for investigating Unidentified Flying Objects (UFO's)." NASA


Disclosure Project


Post Extras: Print Post   Remind Me!   Report this Post  
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
2- Letīs prepare a Spreadsheet [Re: Gerardo64]
      #550339 - 08/09/06 05:18 PM

We already know that:

- KML uses commands
- Commands Starts and Ends
- Data is within those Starts and Ends commands
- We can use a Text Editor to write data and then save the file as a KML file.

So, letīs go to a spreadsheet. First time you open one..? Isnīt boring?...but they are powerful, no doubt...
This Tutorial doesnīt pretend to be a Spreadsheet Tutorial; we will only see what we need for making a BIG kml file very fast.

What we are going to do is to began putting kml commands in the spreadsheet as we know, we need them to build our KML file.
We are only using the Spreadsheet to build the <Placemark> part of the kml. Once we obtain ALL that Placemarks code, we are going to copy them and paste in our Text Editor. But let me show you:



Remember I told you that in kml we can put ALL the data in one line? Well, here we "Opened" the "Placemark" and the "Name" commands. Put them in the first cell. As in the photo.

Now, leave the Second Column (B) empty. Go to the "C" Column. Type there:
</name><description><![CDATA[



OK. Now leave the "D" Column empty (then I tell you for what... ) and go to the "E" Column. Type there:
]]></description><LookAt><longitude>



Again, leave "F" Column empty and go to "G" Column. Type there:
</longitude><latitude>



Fine! You are doing well!! Be careful when typing..without errors, please..

Now leave the "H" Column empty and go to the "I" Column. Type there all this:
</latitude><altitude>0</altitude><range>13985.95086451406</range><tilt>0</tilt><heading>-0.03178491702290566</heading></LookAt>



A little messy? Donīt worry, use your arrows keys to move the cursor.

Now go to the "J" Column and type (I think you are already copying / pasting.. ) this:
<Style><IconStyle id="khIconStyle862_copy4"><Icon><href>root://icons/palette-4.png</href><y>128</y><w>32</w><h>32</h></Icon></IconStyle>



Now go to the "K" Column and copy/paste this:
<LabelStyle id="khLabelStyle864_copy4"><scale>0.5</scale></LabelStyle><LineStyle id="khLineStyle865_copy4"><color>19010000</color><width>0.5</width></LineStyle><PolyStyle id="khPolyStyle866_copy4"><color>b03f85cd</color></PolyStyle></Style>



Now go to "L" Column and paste this:
<Point><coordinates>



Now leave the "M" Column empty, go to the "N" Column and paste this:
</coordinates></Point></Placemark>



Save the file...PLEASE...!

Ok guys, letīs have a break here, go and eat a sandwich, drink something...and when you return, Iīll tell you how to mix the data to what we already have (remember the empty columns..), so go away, do something else, I donīt want to see you for 10 minutes, at least.....

See you...

--------------------
"No branch of the United States Government is currently involved with or responsible for investigations into the possibility of alien life on other planets or for investigating Unidentified Flying Objects (UFO's)." NASA


Disclosure Project


Post Extras: Print Post   Remind Me!   Report this Post  
Valery35
Master Craftsman


Reged: 09/02/05
Posts: 2272
Loc: Russia, Perm, Sun
Re: 1- Whatīs a kml File? [Re: Gerardo64]
      #552132 - 08/11/06 02:58 AM

Great, Gerardo! Thanks to you!

I add also.

In GE4 we can use Copy-Paste KML direct to editor and return to GE.
http://bbs.keyhole.com/ubb/showflat.php/Cat/0/Number/446272
I use Emeditor free www.emeditor.com
http://www.download.com/EmEditor-Free/3000-2352_4-10527010.html

All spreadsheets (not Excel only) support near functions.
Also small Excel discussion http://bbs.keyhole.com/ubb/showflat.php?Number=444126

--------------------
Applications | Blog | Geoblog(ru) | Spreadsheets | Photos | Pict'Earth | Eastgeology (ru)

Edited by Valery35 (08/11/06 03:08 AM)


Post Extras: Print Post   Remind Me!   Report this Post  
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
3- Letīs input the Data [Re: Gerardo64]
      #556366 - 08/14/06 01:31 PM

Now that you have your Base spreadsheet done, letīs go for the Data.

If you already have Data with geographics coordinates you can use it. If you donīt have any, search the Web till you find something like this:



It must be a page where the Data is presented as text, so you can select and copy it.

So, go to the Spreadsheet and clic the Sheet2 or Page2 tab at the bottom to go to the 2š page. Here weīll paste the copied data.
Right click over the A1 cell and choose Paste As, in the windows that opens, select Text and OK.



If you have formats problems (as Iīm having here, look at the Lat. / Long. data, there are points where there shouldnīt be..), you have to change the Cell Format. So click over the "D" Letter (the Column Ttile" to select all that column, right click over that title and select Cell Format, then choose Text, so all the data in that column will be considered as simple Text. OK, you still having problems? Paste again the copied data (right click over the A1 Cel, "Paste As", "Text") and now youīll see that is in the correct format. Do the same with the "E" Column.



Now itīs time to "mix" the imported data with the kml commands we have in the Sheet 1 so:
- Go to the Sheet 1
- Put the cursor in the B1 Cel. You see that there goes the Name info, because the info of B1 is between the <name> and </name> commands
- Click on the fx buttom

- We are going to aply a Formula here. The Concatenate formula. Select it from the Formula List. What is this Formula for?...She looks for data in one cel and paste it in the cel we indicate. So we have to say where is the data we want her to bring to this B1 cel.

- So you selected Concatenate from the Formula List, another windows appears..


-Now, leave that window opened and go to the Sheet2 (where we have the Data) and select the first "Name" of that data (in this case the A2 cel) (1)



You see that the name of that cel now appears in the opened window (2) (You can read the text info of that cel in (3) ). OK, clic Enter (4)

See what happened:


We have applied a formula to cel B1from Sheet1, that brings data from cel A2, Sheet2. Great!
For this was that I asked you to leave that column empty, remember?

Now apply the same formula (Concatenate) to cel Sheet1 D1 with the Description (this text will appear in the Decription Bubble of our kml). So, for Description select the Sheet2 C2 cell when applying the Concatenate formula.

In the Sheet1 F1 cel, we need the Longitud Data so apply the concatenate formula using the Sheet2 E2 cel. (Be careful because in this example the Lat Long columns are inverted)

Do the same with the Sheet 1 H1 cel (apply Concatenate formula using the Sheet2 D2 cel)

Now that we have the Description , the Longitude and the Latitude Data already set using the Concatenate Formula, we have to do one more thing with that formula. We have to put data from 2 Cels in one cel. Because we need to merge the "Longitud,Latitud" in just one cel, with a "," in the middle.
So go to Sheet 1M1 cel (where the Coordinates will be) and apply the Concatenate formula again.
Concatenate the Longitude, then, in the second space put a "," and then, in the third space, the Latitude and Click OK



Well done! Ok, letīs have a break here so in the next step weīll see last things we have to do.

--------------------
"No branch of the United States Government is currently involved with or responsible for investigations into the possibility of alien life on other planets or for investigating Unidentified Flying Objects (UFO's)." NASA


Disclosure Project


Post Extras: Print Post   Remind Me!   Report this Post  
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
4- Letīs have the Real Fun... [Re: Gerardo64]
      #556413 - 08/14/06 02:23 PM

Ok, letīs go for the Data.
Go to the Sheet2 and fill it with all the Data you want.
Remember:
- Copy the Data
- Go to the Spreadsheet and put the cursor in the first "A" empty cell
- Right click and Paste Special and select as Text
- Continue adding the Data (if it is in separated pages) till you finished (you have a lot of Records, donīt you?

But now you maybe asking one question: Do I have to do ALL the manual process again? (Using Concatenate and those stuffs?) Of course not...
Thanks programmers, Spreadsheets are very smart...They know what we want to do...let me show you:

Go to the Sheet one, the one with the kml Code already set.
Put the cursor in A1 cel and pressing Shift move the cursor with the Right Arrow to the right so you will select several cels:






Now, leave that selection for a second and go to the Sheet2, drag the lateral bar till the last record and look at his number, remember it.

Go back to Sheet1. Drag the bar to see the last cel of that selection. Put the cursor over the Black Point (in the right down corner of the selection, now the cursor is a black cross) and Drag Down till you reach the same Number of the Last Record of your Data



OK, Great! We have ALL the placemark Data we need for our kml!!

Now, leave that Data selected and open any Text Editor you have.

Make a new Document in your Text Editor and paste this text:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Folder>
<name>Name your Folder Here</name>



Go to the Spreadsheet and copy all the Data Selected.
Go back to the Text Editor and Paste Special as Text without Format .
Now, at the very bottom paste these lines:

</Folder>
</kml>



Now, Save that Document as a Text Document and at the end of the name type .kml

Go to GE and open it.....
Once you opened your Folder in GE you can edit it and share the changes, for instance the Placemark Icon, etc.

Final Recommendations:

Be careful with the Data you select. Choose one that can be used by public. Also donīt make duplicated placemarks.

Have Fun!


Post Extras: Print Post   Remind Me!   Report this Post  
Gerardo64
World Explorer


Reged: 09/07/05
Posts: 1276
Loc: Argentina
5- I donīt have a Spreadsheet....No problem... [Re: Gerardo64]
      #561427 - 08/18/06 02:41 PM

View in Google Earth         View in Google Maps (693 downloads)


Spreadsheet used in this example.

If you donīt have a Spreadsheet at home, no problem, you can download the Open Office Suite or, better than that, you can use EditGrid which is an OnLine Spreadsheet.

Which is the advantage of using an on line soft? One of them is that you can share it with other people so you can make a colaborative work together. Other wonderful characteristic is that every cell is like a URL that you can point to. What does this mean? That you can use as you already learned in this tutorial, then get ALL the data in one cel and finally make a Network Link that points to that cel, so you can view the data in GE dynamically.

So, letīs do an example of this.
First you have to register to EditGrid. Then create a New Spreadsheet. In the Sheet2 of this new file paste some Data with Lat / Long info (of course...)
Ensure that those columns have the right format, like here:



Now, go to the Sheet1. There, we are going to input our KML Commands.
Choose one cel, letīs say A3, and type the code of the first lines of every kml, remember? Here is the text:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Folder>
<name>Name your Folder Here</name>

So we have this: (I leave the rest of the data...donīt worry..)


Now letīs put in A4 the code corresponding to the lasts lines of every kml:



Ok. You see that Iīve already put the rest of the code (those data at the right). You know how to do that. Make the same steps as here.

In the C1 cel you have to Concatenate the Sheet2 A1 cel. Look at the Formula line. , you see how EditGrid name each cel? Sheet2 ! A1
Donīt forget the Admiration sign (!)



When you have to merge the Lon / Lat in one cel use this characters:
Name of cel 1 , "," , Name of cel 2
A comma after each element:



Ok. Complete all the Row 3 with all the kml Commands and the Concatenated Data from Sheet2.
Here, also works the trick of selecting the first line (from B3 to N3 included), then putting the cursor over the square, at the right bottom angle of the selection, drag down till you reach the number of your last record (as we do the first time in this tutorial)...the code is generated...

After you do this, go to the O3 cel and concatenate the first row (B3 to N3), so we are mergin in that cel (O3) all the data corresponding to the first line (or Placemark): Use the : sign. In this way you are saying "Concatenate from B3 to N3 cel)



Extend that Formula (draging the corner) to the others lines till you reach the last one.

Then, in P2 cel we are going to Concatenate all the data we have generated in Column O. So, put the cursor in P2 cel and apply Concatenate with O3:O18 (in this case O18 has the last data of the O Column) :



Ok! Great! We have ALL the Placemark Data in one cel!!, but, wait! we are forgetting something important. Remember the Code Lines at the beginning and the 2 lines that goes at the end of the KML?, We have to add this 2 parts to our "all in one cel"

So, choose Q2 cel, put the cursor there and apply the Concatenate formula with this data:
A3 (where the first part of the kml is)
P2 ( where all the Placemark data is) and
A4 (where the last lines of the kml are)

In this case we use the ( , ) commas to separete the cel names.


Ok, we have ALL the data we need to make our KML in one cel! In this case the Q2 cel.

But, how can I make a Network Link and use this KML? ....
Very easy...
Go to GE, make a new Network Link and in the Link line paste the URL of your EditGrid page, then a / and then the name of the cel where you have merged all the data (in my case, the Q2 cel) so the result is like this:



Iīm attaching this example NL here if you want to see it.
Also here is the EditGrid page of this example.

Hope all this would be useful for you. I leave the rest of the possibilities to your imagination....


Post Extras: Print Post   Remind Me!   Report this Post  
lorenzojuan
Tourist


Reged: 05/04/06
Posts: 102
Loc: san juan argentina
Re: How to use a Spreadsheet & GE [Re: Gerardo64]
      #572669 - 08/28/06 06:17 AM

View in Google Earth         View in Google Maps (666 downloads)


Muy bueno y útil tú trabajo adelante.

--------------------
Trabajar en epidemiologia con earth google


Post Extras: Print Post   Remind Me!   Report this Post  
askans
Tourist


Reged: 07/25/05
Posts: 4
Re: How to use a Spreadsheet & GE [Re: Gerardo64]
      #627003 - 10/05/06 03:36 PM

I greatly appreciated your tutorial, it was of magnificent help to me. Thanks for the easy and quick way to help me.

Cheers from Germany

Askan.


Post Extras: Print Post   Remind Me!   Report this Post  
niklas1973
Tourist


Reged: 01/12/07
Posts: 2
Re: How to use a Spreadsheet & GE [Re: Gerardo64]
      #752385 - 01/12/07 02:18 AM

Great help, Gerardo!
This will help a lot in my research.
Greetings from Sweden./Niklas


Post Extras: Print Post   Remind Me!   Report this Post  
Pages: 1 | 2 | >> (show all)




Extra information
0 registered and 9 anonymous users are browsing this forum.

Moderator:  Hill, Jumble, Kempster, mcshea98, jeffryv, dulce, esterrett, NormB, Frank_McVey, TheLedge, BeadieJay, no_stranger, LuciaM, Cyclonic, tekgergedan, Noisette, danescombe, Michal_Drewniak, mutex, marinerfan, Delta102, bebop, MarkAubin 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating: ***
Topic views: 29664

Rate this topic

Jump to

earth.google.com    bbs.keyhole.com

*
UBB.threads™ 6.5.1.1