Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Geo::GPS::Data
General interface for the perl-GPSData package.

Geo::GPS::Data - General interface for the perl-GPSData package.



NAME

Geo::GPS::Data - General interface for the perl-GPSData package.


SYNOPSIS


  use Geo::GPS::Data;

  my %href = (

    storage => 'MySQL',

    storage_params => {

      database => 'gpsdata',

      host => 'localhost',

      username => 'gpsuser',

      password => 'mypasswd',

    }

  );

  my $d = Geo::GPS::Data->new([\%href]);

  my $wp_raw_data = {

    'name'=> 'Test_Waypoint',

    'latitude' => 41.123,

    'longitude' => -7.123,

    'date_collected' => scalar localtime,

    'type_id' => 1,

    'ellipsoid' => 'WGS-84'

  };

  my $wp = $d->add_waypoint($wp_raw_data) || die "Error creating new waypoint: $@";

  my $wp = $d->get_waypoint({id => $wpt_id}) || die "Error retreiving waypoint: $@";

  my $wp_col_raw_data = {

    name => 'Test Collection',

    date_collected => $second_date,

    comment => 'Nice random collection just for testing.'

  };

  my $wp_col = $d->add_collection($wp_col_raw_data);


DESCRIPTION

This object is the primary interface to the whole perl-GPSData system. It is used to instantiate waypoint, route, track-log or waypoint-group objects which will then be manipulated on their own.

Data searches are also done via this module.

You should never use the other objects directly as their interface is not garanteed to be backward compatible in the future. This object's interface, however will not change unless some major (and I mean MAJOR) reason presents itself.

When this object is created it also defines which storage mechanism will be used for it's data.

Class Methods

new()

  use Geo::GPS::Data;

  my %href = (

    storage => 'MySQL',

    storage_params => {

      database => 'gpsdata',

      host => 'localhost',

      username => 'gpsuser',

      password => 'mypasswd',

    }

  );

  my $d = Geo::GPS::Data->new([\%href]);

All arguments are optional. Returns an Geo::GPS::Data-class object.

The possible arguments and their possible values are detailed in the the Geo::GPS::Data::Storage manpage class' documentation.

add_waypoint()

  my $wp_raw_data = {

    'name'=> 'Test_Waypoint',

    'latitude' => 41.123,

    'longitude' => -7.123,

    'date_collected' => scalar localtime,

    'type_id' => 1,

    'ellipsoid' => 'WGS-84'

  };

  my $wp = $d->add_waypoint($wp_raw_data) || die "Error creating new waypoint: $@";

Creates a new waypoint and fills it in with the data passed to it. This is the way to create new waypoints to add to the database. The newly-created waypoint will not yet have an ID, this will be added to it when the waypoint is saved into storage.

If successfull returns the newly-created waypoint object, otherwise the method returns with a value of 0 and with an error message in $@.

For the list of required and optional parameters please see the create() method in the Geo::GPS::Data::Waypoint manpage.

get_waypoint()

  my $wp_object_2 = $d->get_waypoint(id => 5);

Retrieves a waypoint from storage and returns a new waypoint object created with the retrieved data. If there is an error this method returns a value of 0 and there is an error message in $@.

For the list of required and optional parameters please see the load() function in the Geo::GPS::Data::Waypoint manpage.

add_collection()

  my $wp_col_raw_data = {

    name => 'Test Collection',

    date_collected => $second_date,

    comment => 'Nice random collection just for testing.'

  };

  my $wp_col = $d->add_collection($wp_col_raw_data);

Creates a new waypoint collection and fills it in with the data passed to it. This is the way to create new collection to add to the database. The newly-created waypoint collection will not yet have an ID, this will be added to it when the collection is saved into storage.

If successfull returns the newly-created collection object, otherwise the method returns with a value of 0 and with an error message in $@.

For the list of required and optional parameters please see the create() method in the Geo::GPS::Data::Collection manpage.


AUTHOR

Nuno Nunes, <nfmnunes@cpan.org>


SEE ALSO

the Geo::GPS::Data::Waypoint manpage, the Geo::GPS::Data::Route manpage, the Geo::GPS::Data::TrackLog manpage, the Geo::GPS::Data::Collection manpage, the Geo::GPS::Data::Search manpage, the Geo::GPS::Data::Storage manpage.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy