I can't seem to import a shapefile - I keep getting the same error:
user warning: Incorrect column name '' query: CREATE TABLE geo_data_north_america ( `2` VARCHAR(0) DEFAULT NULL, `` VARCHAR(0) DEFAULT NULL, `comappl` VARCHAR(114) NOT NULL DEFAULT 0, `9b29601saf` VARCHAR(99) NOT NULL DEFAULT 0 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /Users/michael/Sites/drupalgeo/includes/database.inc on line 515.
It appears that the second column has no name defined. I have tried it with 4 different shapefiles - all with the same result. I've traced the issue back to the "_dbf_headers()" function in the shp2sql.inc file - it looks like this function is incorrectly reading the headers (I think).
I'm using MAMP (PHP 5.2.5 with php_zip enabled and MySql 5.0.41)
Thanks,
-mike
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | NorthAmerica_adm0.zip | 171.15 KB | ultimike |
| NorthAmerica_adm0.zip | 171.15 KB | ultimike |
Comments
Comment #1
becw commented@ultimike -- are you on a G4 Mac? PHP has several platform-specific issues around dealing with binary (as found in shapefiles), which means that the shp2sql code doesn't work when you're running it on a PPC (Big Endian) architecture.
I wasn't quite ready to dive into the shp2sql code, but I did write a patch for the WKB parsing code (which also suffers from PHP's Endian-related issues). Patching the WKB parsing code means that I can at least use database dumps of imported shapefiles.
See http://drupal.org/node/429256 for the patch.
Comment #2
ultimikeBec,
Nope - I'm on an Intel Mac.
Allie actually went ahead and sent me a shape file that worked for her and I was able to import that just fine.
I've attached one of the shapefiles that didn't work for me to this message.
-mike
Comment #3
Bill Choy commentedUsing GEO Module 6.x-1.0-alpha1,....
I initially got the same result with your NorthAmerica_adm0.zip
CREATE TABLE geo_data_northamerica ( `2` VARCHAR(0) DEFAULT NULL, `` VARCHAR(0) DEFAULT NULL, `comappl` VARCHAR(114) NOT NULL DEFAULT 0, `9b29601saf` VARCHAR(99) NOT NULL DEFAULT 0 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Note: I have to recreate my geo tables with the correct Spatical Engine (Acquia uses the non-spatical InnoDB by default)
Also Note: Got rid of "user warning: The used table type doesn't support SPATIAL indexes query:" by adding the following alter table.
db_create_table($ret, $table_name, $schema);
db_query("ALTER TABLE {$table_name} ENGINE = MyISAM");
After I re-Zipped your data without the "_macrosx" and the directory (NorthAmerica_adm), the module properly created the table. And I got the following country and the associated gobble-gook in the "GEO" column. Oh... is there any way of reading the gobble-gook.
ANTIGUA AND BARBUDA
BAHAMAS, THE
BARBADOS
BELIZE
CANADA
COSTA RICA
CUBA
DOMINICA
DOMINICAN REPUBLIC
EL SALVADOR
GREENLAND
GRENADA
GUADELOUPE
GUATEMALA
HAITI
HONDURAS
JAMAICA
MARTINIQUE
MEXICO
NICARAGUA
PANAMA
PUERTO RICO
ST. CHRISTOPHER-NEVIS
ST. LUCIA
ST. VINCENT AND THE GRENADINES
TRINIDAD AND TOBAGO
TURKS AND CAICOS ISLANDS
UNITED STATES, THE
But after I add the Managed Field "Spatrical Geo Data Reference" type, I do not get anything in the dropdown... just a empty "Please select" list.Forgot that you have to click on "Configure" again, after you add the field.
Comment #4
allie mickaThere are now 3 issues that suggest similar problems. Please try and see if there is already a similar issue before filing a new one - that saves everyone a lot of time!
ultimike & DrupalFocus, can you see if the changes at #640704: Shapefile Parsing Issue fix this? If so, please follow up there. If not, please reopen _this_ ticket.
Thanks!