lib/spatial_features/importers/shapefile.rb in spatial_features-2.1.7 vs lib/spatial_features/importers/shapefile.rb in spatial_features-2.2.0

- old
+ new

@@ -19,10 +19,11 @@ end end end def proj4_from_file(file) - `gdalsrsinfo "#{file.path}" -o proj4`[/'(.+)'/,1] # Sanitize "'+proj=utm +zone=11 +datum=NAD83 +units=m +no_defs '\n" + # Sanitize "'+proj=utm +zone=11 +datum=NAD83 +units=m +no_defs '\n" + `gdalsrsinfo "#{file.path}" -o proj4`[/'(.+)'/,1].presence || raise('Could not determine shapefile projection. Check that `gdalsrsinfo` is installed.') end def data_from_wkt(wkt, proj4) ActiveRecord::Base.connection.select_one <<-SQL SELECT ST_Transform(ST_GeomFromText('#{wkt}'), '#{proj4}', 4326) AS geog, GeometryType(ST_GeomFromText('#{wkt}')) AS feature_type