class MapPrint::Core

Constants

PROVIDERS

Attributes

images[RW]
legend[RW]
map[RW]
output_path[RW]
pdf_options[RW]
png_options[RW]
scalebar[RW]
texts[RW]

Public Class Methods

new(args) click to toggle source
# File lib/map_print/core.rb, line 24
def initialize(args)
  @format = args[:format]
  @pdf_options = args[:pdf_options]
  @png_options = args[:png_options]
  @map = args[:map]
  @images = args[:images]
  @texts = args[:texts]
  @legend = args[:legend]
  @scalebar = args[:scalebar]
  raise ParameterError.new("Please indicate the southwest point for the map ({map: {sw: {lat: -35.026862, lng: -58.425003}}})") unless @map && @map[:sw] && @map[:sw][:lat] && @map[:sw][:lng]
  raise ParameterError.new("Please indicate the northeast point for the map ({map: {ne: {lat: -29.980172, lng: -52.959305}}})") unless @map[:ne] && @map[:ne][:lat] && @map[:ne][:lng]
  raise ParameterError.new("Please indicate the zoom level for the map ({map: {zoom: 9})") unless @map[:zoom]
  raise ParameterError.new("Please indicate layers to be printed for the map ({map: {layers: [{type: 'osm'}]})") unless @map[:layers].is_a?(Array)
  Logger.warn 'Found geojson property defined outside map, it must be inside the map property' if @map[:geojson].nil? && args[:geojson]
end

Public Instance Methods

print(output_path) click to toggle source
print_geojson(map_image) click to toggle source
print_layers() click to toggle source
print_legend() click to toggle source
print_scalebar() click to toggle source