Class: NSWTopo::GPS

Inherits:
Object
  • Object
show all
Defined in:
lib/nswtopo/gis/gps.rb,
lib/nswtopo/gis/gps/gpx.rb,
lib/nswtopo/gis/gps/kml.rb

Defined Under Namespace

Modules: GPX, KML

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ GPS

Returns a new instance of GPS.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/nswtopo/gis/gps.rb', line 6

def initialize(path)
  @xml = REXML::Document.new(path.read)
  case
  when @xml.elements["/gpx"] then extend GPX
  when @xml.elements["/kml"] then extend KML
  else
    raise "invalid GPX or KML file: #{path}"
  end
rescue SystemCallError
  raise "couldn't read file: #{path}"
end

Class Method Details

.load(path) ⇒ Object



18
19
20
# File 'lib/nswtopo/gis/gps.rb', line 18

def self.load(path)
  new(path).collection
end