Difference between revisions of "Eyesis Panorama Database"

From ElphelWiki
Jump to: navigation, search
Line 23: Line 23:
 
==PHP Methods==
 
==PHP Methods==
  
  Array GetData (ID)
+
  Array GetNodeData (ID)
 
Returns all database fields of a specific Node ID as array
 
Returns all database fields of a specific Node ID as array
  
 +
Array GetRouteData (ID)
 +
Returns all database fields of a specific Route ID as array
  
 
  AddNode (Array Data)
 
  AddNode (Array Data)
 
Save a new node to the DB supplying all database field
 
Save a new node to the DB supplying all database field
  
 +
AddRoute (Array Data)
 +
Save a new node to the DB supplying all database field
 +
 +
void AddNodeToRoute (int NodeID, int RouteID)
 +
Adds one Node to a Route. Both have to exist already.
  
 
  Array GetNodesAt (Lat, Long, MaxDistance, Limit)
 
  Array GetNodesAt (Lat, Long, MaxDistance, Limit)
Line 38: Line 45:
 
the results found so far.
 
the results found so far.
  
  void ImportKML (String KMLfile)
+
int GetNextNodeinRoute (int NodeID)
Works just like AddNode but can import a high number of nodes with a single function - read from a KML file  
+
Routes are a sequence of nodes, Next means recorded later = higher timestamp
 +
 
 +
int GetPreviousNodeinRoute (int NodeID)
 +
Routes are a sequence of nodes, Previous means recorded earlier = lower timestamp
 +
 
 +
  void ImportKML (String KMLfile, int RouteID)
 +
Works just like AddNode but can import a high number of nodes with a single function - read from a KML file, if you supply a RouteID all new Nodes will automatically be added to an existing route.
  
 
==Notes==
 
==Notes==

Revision as of 09:54, 7 July 2011

MySQL DB Structure

Nodes Table:

ID
Name
Description
Longitude
Latitude
Timestamp
Altitude
Heading
Tilt
Roll
Panorama URL
Visibility3d -  list of ranges [from,to] - which nodes are visible from the current one. from, to are both relative to the current node, so merging several segments should not break visibility (not so easy in the map that is not linear path, but we'll think of something  - adding new nodes (importing KML) should not change the relative sequence of indices (kml "name" tag).

Routes Table

ID
Name
Description
Nodes List

PHP Methods

Array GetNodeData (ID)

Returns all database fields of a specific Node ID as array

Array GetRouteData (ID)

Returns all database fields of a specific Route ID as array

AddNode (Array Data)

Save a new node to the DB supplying all database field

AddRoute (Array Data)

Save a new node to the DB supplying all database field

void AddNodeToRoute (int NodeID, int RouteID)

Adds one Node to a Route. Both have to exist already.

Array GetNodesAt (Lat, Long, MaxDistance, Limit)

Find an array of nodes that are not further away from the supplied coordinates (Lat, Long) than the MaxDistance. To prevent huge number of results being return I would add a limit parameter here. If the results reach the limit count it will just stop searching and return the results found so far.

int GetNextNodeinRoute (int NodeID)

Routes are a sequence of nodes, Next means recorded later = higher timestamp

int GetPreviousNodeinRoute (int NodeID)

Routes are a sequence of nodes, Previous means recorded earlier = lower timestamp

void ImportKML (String KMLfile, int RouteID)

Works just like AddNode but can import a high number of nodes with a single function - read from a KML file, if you supply a RouteID all new Nodes will automatically be added to an existing route.

Notes

function distance ($lat1,$long1,$lat2,$long2) {
 $earthRadius=6378100; //meters
 $dlat= $lat2- $lat1;
 $dlong=$long2-$long1;
 $lat=($lat1+$lat2)/2;
 $dlong*= cos(deg2rad($lat));
 return pi()*$earthRadius/180* sqrt($dlat*$dlat+$dlong*$dlong);
}