nofxx/georuby

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

Closed this issue · 2 comments

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.

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

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