CSV to KML Help

CSV to KML generates either placemarks or a track from a CVS file. It takes 3 input input files: a data file which contains the data in CSV format, a schema file, which describes the data types, and a format file which describes how to format the description of each data point. Only the data file is required. If no schema file is given however, the first column of data is treated as a name and the second column is treated as a location (address or latitude,longitude).


The data is comma-separated values in the same order as the schema. Values which include commas must be double quoted. The number of data columns must match the number of schema types. If you are starting with a spreadsheet, you will need to save your data in CSV format first.

The schema is a list of type/name pairs, separated by a colon. Schema types are described below:

nameA name string (always required)
addressAn address string, double quoted (required if no latlng)
latlngA latitude,longitude pair or a latitude,longitude,altitude triplet, double quoted (required if no address)
urlA web site address
emailAn email address
dateA date in ISO format
timestampA Unix timestamp
textArbitrary text

The format is a template using Jinja2 syntax which specifies the format of the description of each KML placemark. (Jinja2 calls this the context). If you omit the format, the KML placemark description will default to the address or latlng.


Data (CSV)

A and E,"Sparks Terrace,Rostrevor,SA 5073",Joe and Bob,
SA Woodcarving Academy,"133 Payneham Rd,St Peters,SA 5069",Shirley and Ted,www.sawa.com.au
Andrew's School of Art,"43 Valley View Dr,Highbury,SA 5089",Emma,
The Sea House,"1-5 Sussex St,Glenelg,SA 5045",Lily,www.theseahouse.com.au
Panorama Art Group,"30 Glenhuntly Dr,Flagstaff Hill,SA 5159","Jo Jo, Anne, and Sue",

Schema (type:name pairs)



Artists: {{ Artists }}
Address: {{ Address }}
{% if URL %}Web site: {{ URL|urlize }}{% endif %}

DXF to KML help

The primary requirement for converting from DXF to KML is a pair of corresponding points, which we call a projection. For example, in the case of the Adelaide_terraces.dxf, the drawing point (136,0) corresponds to lattitude-longitude (-34.936275,138.588364) and the drawing point (2143,1752) corresponds to lattitude-longitude (-34.920925,138.610779). All the other parameters are optional.

When you view the resulting KML in Google Earth it should overlay perfectly over Adelaide's central business district (CBD). Watch this video tutorial.

The only time a projection is not required is when your drawing uses UTM coordinates, in which case you just need to specify the UTM grid zone.

DXF to KML only extracts entities of types LINE, POLYLINE and LWPOLYLINE from the DXF file; all other entities are ignored. Contiguous LINE entities are merged into polylines.

Stroke, line, fill, and scale are used when drawing HTML and SVG. Stroke and fill are #rrggbb colors. Stroke is #000000 (black) by default. Line (width) is 1 (pixel) by default. Scale is computed automatically to limit the drawing to a maxium width of 8192 pixels, but can be overriden. Only specify fill for closed paths that you wish to fill.


Keyhole Markup Language (KML)

KML is the open data format used by Google Earth and Google Maps.

KML Tools supports Polygon, MultiGeometry, LinearRing and LineString coordinates.

GPS Exchange Format (GPX)

GPX is an open data format used by many GPS devices.

KML Tools extracts all GPX trkpt coordinates into a single track.

Drawing Exchange Format (DXF)

DXF is the file format used by design tools, such as SketchUp and AutoCAD, to exchange (import/export) drawings.

KML Tools supports the following DXF enitities: LINE, POLYLINE and LWPOLYINE.

For more information refer to the DXF specification.

Universal Transverse Mercator (UTM)

The UTM coordinate system is a way of representing locations on the Earth on a 2D grid. The UTM system divides the surface of the Earth between 80°S and 84°N latitude into 60 longitudinal zones, each 6° of longitude in width, starting from zone 1 centered on 177°W. The UTM grid is formed by subdividing each zone into lattitude bands, designated by a letter between "C" and "X" (omitting "O" and "I"). Each grid is identified by combining a zone number and a lattitude band. For example, 54H represents the zone centered on longitude 141° in band "H" (between 32°S and 40°S). Refer to this map of UTM grid zones.

UTM coordinates comprise an easting,northing pair. The easting is the distance east from the zone's central longitude plus 500,000, and the northing is either the distance north from the equator, or in the southern hemisphere, 10,000,000 minus the distance south of the equator. The grid zone differentiates whether a point is in the southern or northern hemisphere. For example, 54H 280782,6132238 represents the location 219,218m (= 500,000 - 280,782) west of longitude 141° and 3,867,762m (= 10,000,000 - 6,132,238) south of the equator (which corresponds to a latitude,longitude of -34.928661,138.599975). Note that one degree of lattitude corresponds to approximately 111km (60 nautical miles), and 34.928661 * 111 = 3,877km =~ 3,868km.

When converting KML files with large geometries that span multiple UTM zones, KML Tools adjusts UTM coordinates so they are relative to the zone of the first coordinate. Points more than 500km to the west will result in negative eastings, and points more than 500km to the east will result in eastings greater than 1,000,000.