Class: Google::Cloud::Vision::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/vision/location.rb

Overview

Location

A latitude/longitude pair with values conforming to the WGS84 standard.

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
vision = gcloud.vision

image = vision.image "path/to/landmark.jpg"
entity = image.landmark

location = entity.locations.first

location.latitude #=> 43.878264
location.longitude #=> -103.45700740814209

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#latitudeFloat

The degrees latitude conforming to the WGS84 standard.

Returns:

  • (Float)

    the current value of latitude



44
45
46
# File 'lib/google/cloud/vision/location.rb', line 44

def latitude
  @latitude
end

#longitudeFloat

The degrees longitude conforming to the WGS84 standard.

Returns:

  • (Float)

    the current value of longitude



44
45
46
# File 'lib/google/cloud/vision/location.rb', line 44

def longitude
  @longitude
end

Instance Method Details

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


59
60
61
# File 'lib/google/cloud/vision/location.rb', line 59

def to_a
  [latitude, longitude]
end

#to_hHash

Converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


68
69
70
# File 'lib/google/cloud/vision/location.rb', line 68

def to_h
  { latitude: latitude, longitude: longitude }
end