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::COUNTY_TYPE_CODES, LocalAuthorityFinder::COUNTY_WARD_TYPE_CODES, LocalAuthorityFinder::DISTRICT_TYPE_CODES, LocalAuthorityFinder::PARISH_TYPE_CODES, LocalAuthorityFinder::UNITARY_TYPE_CODES, LocalAuthorityFinder::WARD_TYPE_CODES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UriToHash

#to_hash

Methods included from LocalAuthorityFinder

#county, #county_ward, #detect, #district, #local_authority, #parish, #two_tier?, #unitary, #ward

Constructor Details

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

Returns a new instance of Point.



153
154
155
156
157
# File 'lib/my_society/map_it.rb', line 153

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.



150
151
152
# File 'lib/my_society/map_it.rb', line 150

def coordinate_system
  @coordinate_system
end

#xObject

Returns the value of attribute x.



144
145
146
# File 'lib/my_society/map_it.rb', line 144

def x
  @x
end

#yObject

Returns the value of attribute y.



147
148
149
# File 'lib/my_society/map_it.rb', line 147

def y
  @y
end

Instance Method Details

#to_pointObject



163
164
165
# File 'lib/my_society/map_it.rb', line 163

def to_point
  self
end

#uriObject



159
160
161
# File 'lib/my_society/map_it.rb', line 159

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