Last active
October 13, 2017 05:55
-
-
Save rlisowski/1f9647bc111f2a08eb4977af8d036a1c to your computer and use it in GitHub Desktop.
MapFilters importer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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