Skip to content

KML Getting started

Roly Hudson edited this page Jun 17, 2020 · 5 revisions

KML Getting started

The current BHoM KML implementation allows pushing meshes with a default style to a KML file.

A simple demo file is available here (publicly accessible file needed)

KML Document Structure

The current implementation uses a simple hierarchy for the KML document.

The KMLDocumentBuilder object will create a single KML Document.

The document is structured with folders, each folder contains the contents of one KMLGeometry.

KMLGeometry is a group of BHoM IGeometry that share the same Geographic reference material.

Each folder in the KML document contains one KMLGeometry divided into one ot more Placemarks.

Each Placemark contains each of the BHoM IGeometry objects in the KMLGeometry.Geometries.

Workflow

Collect the geospatial reference material for the GeoReference object:

  • Identify a recognisable point in your model (in the example this is the pitch centre)
  • Locate the site in Google Earth
  • Find the reference point
  • Place mouse over reference point in Google Earth copy the latitude, longitude and altitude Locate reference
  • In google earth you first need to make sure you have a top view by clicking on the 2d/3d icon: 2d button Then click the compass icon to set north up: north up
  • Zoom to fit the area you want and take a screen shot.
  • Using Picture or PictureFrame in Rhino reference the image into the model.
  • In the example we have a fairly good scaling reference - the football pitch, which we can assume to be 105 x 65.
  • Rotate and scale the image to fit this in Rhino. If you have got the north arrow up the edge of the image will always provide a north-south reference.
  • This allows you to model in a convenient orientation - not needing to use north up although you can do if you prefer. https://user-images.githubusercontent.com/6618854/81672709-716de000-9442-11ea-813b-88502df00823.jpg
  • In this case the image does not align with the XY plane of the model. So the input NorthVector can be defined using the Reference (0,0,0 in this case) and a point perpendicular on the image edge.
  • The Reference can be anywhere in the model that corresponds to the reference latitude longitude.
  • If for some reason you don't have altitude (metres above sea-level) of your object you can try AltitudeMode.RelativeToGround which if Google Earth's estimate of the ground is nice and smooth should place your model on the surface of the earth. Although in practice it is rare to have a nice smooth section of ground and the result can be a bit wobbly.

Overview

Home

Schema Documentation

gbXML

KML

Clone this wiki locally