Class: Gpx2png::OsmBase

Inherits:
Base
  • Object
show all
Extended by:
Calculations::OsmClassMethods
Includes:
Calculations::OsmInstanceMethods
Defined in:
lib/gpx2png/osm_base.rb

Direct Known Subclasses

Osm

Constant Summary collapse

TILE_WIDTH =
Calculations::OsmClassMethods::TILE_WIDTH
TILE_HEIGHT =
Calculations::OsmClassMethods::TILE_HEIGHT

Instance Attribute Summary

Attributes included from Calculations::OsmInstanceMethods

#bitmap_point_x_max, #bitmap_point_x_min, #bitmap_point_y_max, #bitmap_point_y_min, #lat_max, #lat_min, #lon_max, #lon_min, #tile_x_distance, #tile_y_distance

Attributes inherited from Base

#layers, #simulate_download

Class Method Summary collapse

Methods included from Calculations::OsmClassMethods

calc_zoom, convert, point_on_absolute_image, point_on_image, reverse_convert

Methods included from Calculations::OsmInstanceMethods

#auto_zoom_for, #calculate_for_crop, #calculate_for_crop_with_auto_zoom, #download_and_join_tiles, #expand_map, #initial_calculations

Methods inherited from Base

#add, #add_layer, #color, #coords=, #destroy, #fixed_size, #initialize, logger, logger=, simulate_download=, #simulate_download?, #zoom, #zoom=

Methods included from Calculations::BaseClassMethods

#deg2rad, #rad2deg

Methods included from Calculations::BaseInstanceMethods

#calculate_minmax_latlon, #enlarge_border_coords

Constructor Details

This class inherits a constructor from Gpx2png::Base

Class Method Details

.licence_stringObject



29
30
31
# File 'lib/gpx2png/osm_base.rb', line 29

def self.licence_string
  "Map data OpenStreetMap (CC-by-SA 2.0)"
end

.url(zoom, coord, server = 'b.') ⇒ Object

Convert OSM tile coords to url



23
24
25
26
27
# File 'lib/gpx2png/osm_base.rb', line 23

def self.url(zoom, coord, server = 'b.')
  x, y = coord
  url = "http://#{server}tile.openstreetmap.org\/#{zoom}\/#{x}\/#{y}.png"
  return url
end

.url_convert(zoom, coord, server = 'b.') ⇒ Object

Convert latlon deg to OSM tile url TODO add algorithm to choose from diff. servers



17
18
19
20
# File 'lib/gpx2png/osm_base.rb', line 17

def self.url_convert(zoom, coord, server = 'b.')
  x, y = convert(zoom, coord)
  url(zoom, [x, y], server)
end