nofxx / georuby

This is intended as a holder for geometric data. The data model roughly follows the OGC.
MIT License
245 stars 55 forks source link

*.SHP, *.SHX *.DBF files not supported (File extensions are capitalized) #35

Closed fluxlife closed 8 years ago

fluxlife commented 9 years ago

if you have Shapefiles that have file extensions that are capitalized (i.e. shape_file.SHP instead of shape_file.shp), it throws a MalformedShpException despite the file(s) actually existing and being valid.

@file_root = file.gsub(/.shp$/i, '')

works as to pulling the correct root file because you are ignoring case.

However

unless File.exist?(@file_root + '.shp') && File.exist?(@file_root + '.dbf') && File.exist?(@file_root + '.shx')

fails to pick up the files because you are looking for files with the lower cased extensions.

Renaming all files from .SHP to .shp (etc) resolves the issue now, but would be nice if the code could figure this out.

nofxx commented 9 years ago

Really tricky, going to try a refactor while a tackle this, that file needs. Thanks for the feedback.

nofxx commented 9 years ago

Ok, going to make extensions case insensitive, but filename must be the same as supplied on the parameters. To avoid confusions.