+/**
+ * vik_waypoint_apply_dem_data:
+ * @wp: The Waypoint to operate on
+ * @skip_existing: When TRUE, don't change the elevation if the waypoint already has a value
+ *
+ * Set elevation data for a waypoint using available DEM information
+ *
+ * Returns: TRUE if the waypoint was updated
+ */
+gboolean vik_waypoint_apply_dem_data ( VikWaypoint *wp, gboolean skip_existing )
+{
+ gboolean updated = FALSE;
+ if ( !(skip_existing && wp->altitude != VIK_DEFAULT_ALTITUDE) ) {
+ gint16 elev = a_dems_get_elev_by_coord ( &(wp->coord), VIK_DEM_INTERPOL_BEST );
+ if ( elev != VIK_DEM_INVALID_ELEVATION ) {
+ wp->altitude = (gdouble)elev;
+ updated = TRUE;
+ }
+ }
+ return updated;
+}
+
+/*
+ * Take a Waypoint and convert it into a byte array
+ */