Permalink
Browse files

closes #773. added missing prj specific error to importer

  • Loading branch information...
1 parent d644a2c commit c1f42aba6e7a4eccbeb4359e6f88aa0e4bdcf40e @andrewxhill andrewxhill committed Jun 1, 2012
@@ -81,8 +81,9 @@ module API
3004 => 'Unable to read SHP file',
3005 => 'SHP to PGSQL error',
3100 => 'Projection error',
- 3101 => 'Unsupported or missing projection',
- 3102 => 'Unable to force geometry to 2-dimensions',
+ 3101 => 'Missing projection (.prj) file',
+ 3102 => 'Unsupported projection',
+ 3110 => 'Unable to force geometry to 2-dimensions',
3200 => 'Unsupported geometry type',
3201 => 'Geometry Collection not supported',
4000 => 'Raster errors',
Binary file not shown.
@@ -8,6 +8,15 @@ def process!
@data_import = DataImport.find(:id=>@data_import_id)
log "processing shp"
+
+ #check for available PRJ file
+ unless File.exists?(@path.gsub(".shp",".prj"))
+ @runlog.log << "Error finding a PRJ file for uploaded SHP"
+ @data_import.set_error_code(3101)
+ @data_import.log_error("ERROR: CartoDB requires all SHP files to also contain a PRJ file")
+ raise "Error finding a PRJ file for uploaded SHP"
+ end
+
shp2pgsql_bin_path = `which shp2pgsql`.strip
host = @db_configuration[:host] ? "-h #{@db_configuration[:host]}" : ""

0 comments on commit c1f42ab

Please sign in to comment.