Skip to content

Instantly share code, notes, and snippets.

@rlisowski
Last active October 13, 2017 05:55
Show Gist options
  • Select an option

  • Save rlisowski/1f9647bc111f2a08eb4977af8d036a1c to your computer and use it in GitHub Desktop.

Select an option

Save rlisowski/1f9647bc111f2a08eb4977af8d036a1c to your computer and use it in GitHub Desktop.
MapFilters importer
class ShapefileImporter
def call
RGeo::Shapefile::Reader.open(shapefile_path, srid: 4326) do |shapes|
shapes.each do |shape|
Shapefile.create!( area_name: shape.attributes['post_dist'], geometry: shape.geometry)
end
end
end
private
attr_reader :shapefile_path
def initialize(shapefile_path:)
@shapefile_path = shapefile_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment