PIVARI.COM logo

csv2kml: csv to kml converter

version 3.2 01/25/2007

by Pivari.com© 2006-2007 http://www.pivari.com/

Contents

What is csv2kml?

csv2kml (csv to kml converter) is a versatile server tool to convert a csv file (Comma Separated Value) into a kml file (the format of Google Earth). You can see a kml file using Google Earth.
To make a csv file you can use Excel or every database.

Why do you need csv2kml?

With csv2kml you can batch convert your csv into kml and put the kml on your site (using ftp) or send it via email (in attach).
You can run csv2kml from your applications and the application could be a web application like I am here!

Download csv2kml

If you're interested in a binary for another operating system, such as Mac OS X, FreeBSD, SCO Unix, Irix, Digital Unix (tru64), please let us know, and we'll send you one. With enough requests, we'll also add one here permanently.

Demo versions have the same features of registered versions + watermarks

Purchasing, Licensing and Registration

csv2kml is shareware, the registration fee is only 20 euro for a personal license (only for personal use, no inside a company)
The registration fee is 140 euro for company license.
For both licenses you have not limitaton on the number of kml you can produce.
The only limitation is that you have to install your registered version only on the number of computers you have registered.

We have not protected the registered csv2kml version. You are not allowed to distribute or resell the registered csv2kml version without Pivari.com's authorization.
Obviously we can't verify this, simply we trust you.
For the registration email us at info@pivari.com an we will send you an invoice.
If you're a developer or a software house, and wish to use csv2kml inside of your own applications, please email us directly at info@pivari.com

Reseller Discount

Contact us directly! We're looking for resellers and partnerships.

Customization

We are the developers of this software. Contact us directly for modifications or customization.

Italian customers

Scriveteci per la fattura e le modalità di pagamento info@pivari.com

Configure and run csv2kml

At the moment csv2kml is a command line converter and works in the same way on every OS supported (Windows, using a dos windows, Linux, Solaris, AIX, HP-UX, if you need also Mac OS X, Tru64, BSD, SCO, ...)
csv2kml [-options]
where options include:
-help to print the line help
-verbose to print verbose messages
-version to print version
-mailto "name@domain.com" to send the generated kml to the specify email addresses -configure file to use a specific configuration file (the default is csv2kml.cfg in the same directory of the executable)

  1. csv2kml uses the file csv2kml.cfg as its configuration file. This file must reside in the same directory as the csv2kml file, since it searches for this file at runtime. You can create your own csv2kml.cfg file and use it with -configure option.
    Inside this file, you can change the values for the csv, label, latitude, longitude, address, html, skipfirstline, delimiter, kmlfile, documentname, ftphost, ftpuser, ftppassword, ftpdirectory, mailhost, mailfrom, mailsubject, mailbody, sendmail
  2. To change any of these values, you just need to edit csv2kml.cfg. You can also create a new .cfg file and tell csv2kml to read it at runtime, using the -configure yourfile.cfg option or the CSV2KMLCFG variable.

The csv variable allows you to set the input csv file. You can introduce also a relative or absolute path. The default is input.csv
By setting skipfirstline to 1 (default is 0) csv2kml will skip the first line of your csv file. Useful if the first line is a description line
The default delimiter in the csv file is ;. With delimiter variable you can set a different delimiter.
With the label variable you can set a column of your csv file. e.g. §1 to set the first column, §2 to set the second column, ...
csv2kml will create a placemarker for every different label.
With the longitude and latitude variable you can set two columns of your csv file that have the longitude and latitude values.
With address you don't have to know longitude and latitude and you can introduce the address in this way: street address, ZIP city, state. This feature cuerrently works for addresses in Europe, U.S., Canada, Australia and New Zeland. You can use more fields of the csv.
Pay Attention: you can use more columns of your csv but the set on the left has to be minor that the set on the right.
e.g. you can use
address : <a href="§1">§3</a><br>
you can't use
address : <a href="§5">§2</a><br>
because on the left there is §5 that is major than §2!
The html variable allows you to set the html code to put on the text you can see when you click on a placemarker.
Pay Attention: you can use more columns of your csv but the set on the left has to be minor that the set on the right.
e.g. you can use
html : <a href="§1">§3</a><br>
you can't use
html : <a href="§5">§2</a><br>
because on the left there is §5 that is major than §2!
With kmlfile you can change the name of the default kml created: index.kml

Pay attention: kml and kmz are 2 new file formats that Google Earth can read.
If you want to put a kml or kmz on your web server you need to add this information inside the web configuration file.
Another possible way is to make .htaccess (I'm sure it works with apache, I don't know with other web server) with inside these lines:
AddType application/vnd.google-earth.kml+xml kml
AddType application/vnd.google-earth.kmz kmz
abd put .htaccess filein your web home.

With documentname you can set the kml document name
Setting correctly ftphost, ftpuser, ftppassword, ftpdirectory the produced htmlfile, kmlfile and xmlfile will be copied in the correct ftpdirectory in your ftphost using ftpuser and ftppassord via ftp.

sendmail to set the local sendmail or similar command. The default is sendmail -t -oi -oem mailhost to set the local or remote smtp host (you can use also the ip address)
mailfrom please change this default nobody@nobody.com with your email mailsubject the Subject of the email (Your report is the default) mailbody the body of the email (In attach your report is the default). You can make a multiline body using \n like end of line.

Step by step our example

In the directory example you can find the files of this example.

These are the first 3 lines of my csv
lat;long;logo;url;company;company description;address;ZIP;city;state;email;emaillabel;phone;fax;other;image
45.463;9.181;http://www.pivari.com/images/1x1.jpg;www.peregosolera.it;Perego & Solera Comunicazione Integrata; ;Via Sant'Orsola, 10;20123;Milano;MI;info@peregosolera.it;info@peregosolera.it;+39 02 72021363;+39 02 72021652;<br />Ufficio in Germania<br />Tel. +49 (0) 8709 915498<br />Fax +49 (0) 8709 915997;
45.453;9.168;http://www.btp.it/images/logo%20btp%202.jpg;www.btp.it;BTP&P; ;Via Tortona, 14;20144;Milano;MI;btp@btp.it;btp@btp.it;+39 02 58104110;+39 02 89404410;

  1. I've edited csv2kml.cfg and I've set:
    skipfirstline : 1
    The first line is a comment line so I want csv2kml will skip it.
    Now to use csv data:
    label : §5
    to use the fiveth field (company) like label when the mouse pointer will stop on a placemaker and to put on the right column
    latitude : §1
    longitude : §2
    The latitude field is the first and longitude field is the second.
    If you don't know latitude and longitude you can try to use address (this feature cuerrently works for addresses in Europe, U.S., Canada, Australia and New Zeland).
    address : §7, §8 §9, Italia
    The more complex:
    html : <img src="§3"><br><a href="http://§4"><strong>§5</strong></a>§6<br />§7<br />§8 §9 (§10)<br>email: <a href="mailto:§11">§12</a><br>tel. §13<br>fax §14<br>§15
    This set means: when you click on a company placemaker I want to see every information about the company: the image logo, company name with the link to the server company name, company describtion, address, phone, fax, email and other possible informations. This is a normal html code.
    Using the registered version:
    kmlfile : agenzie.kml
    documentname : Mappa Agenzie PR e Comunicazione
    the name of kml file.
    ftphost : www.pivari.com
    ftpuser : xxxxxxxxx
    ftppassword : yyyyyyyyy
    ftpdirectory : /httpdocs/
    to automatically publish via ftp xmlfile, htmlfile, kmlfile in the ftpdirectory of ftphost.

History