Class: MySociety::MapIt::Point

Inherits:
Object
  • Object
show all
Includes:
LocalAuthorityFinder, UriToHash
Defined in:
lib/my_society/map_it.rb

Constant Summary collapse

SYSTEM_WGS84 =
4326
SYSTEM_IRISH_NATIONAL_GRID =
29902
SYSTEM_BRITISH_NATIONAL_GRID =
27700

Constants included from LocalAuthorityFinder

LocalAuthorityFinder::LOCAL_AUTHORITY_TYPE_CODES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UriToHash

#to_hash

Methods included from LocalAuthorityFinder

#local_authority

Constructor Details

#initialize(x, y, coordinate_system = SYSTEM_WGS84) ⇒ Point



84
85
86
87
88
# File 'lib/my_society/map_it.rb', line 84

def initialize x, y, coordinate_system = SYSTEM_WGS84
  self.x = x
  self.y = y
  self.coordinate_system = coordinate_system
end

Instance Attribute Details

#coordinate_systemObject

Returns the value of attribute coordinate_system.



81
82
83
# File 'lib/my_society/map_it.rb', line 81

def coordinate_system
  @coordinate_system
end

#xObject

Returns the value of attribute x.



75
76
77
# File 'lib/my_society/map_it.rb', line 75

def x
  @x
end

#yObject

Returns the value of attribute y.



78
79
80
# File 'lib/my_society/map_it.rb', line 78

def y
  @y
end

Instance Method Details

#to_pointObject



94
95
96
# File 'lib/my_society/map_it.rb', line 94

def to_point
  self
end

#uriObject



90
91
92
# File 'lib/my_society/map_it.rb', line 90

def uri
  "#{MySociety::MapIt.base_url}/point/#{coordinate_system}/#{x},#{y}"
end