CivicSpleen / ambry

A comprehensive data package manager
BSD 2-Clause "Simplified" License
4 stars 5 forks source link

Automatic detection of shapefiles. #121

Closed nmb10 closed 9 years ago

nmb10 commented 9 years ago

run:

python load_pre10.py ../../pre-10-bundles/converted/civicsd.org-neighborhoods/civicsd.org-neighborhoods.yaml

error:

Starting import ../../pre-10-bundles/converted/civicsd.org-neighborhoods/civicsd.org-neighborhoods.yaml...
Loading bundle: civicsd.org-neighborhoods-0.0.2~d035002
INFO civicsd.org-neighborhoods ---- Synchronized ----
Starting ingest...
INFO civicsd.org-neighborhoods Ingesting: neighborhoods from http://ds.civicknowledge.org/civicsd.com/neighborhood.zip
Traceback (most recent call last):
  File "load_pre10.py", line 253, in <module>
    main()
  File "load_pre10.py", line 222, in main
    _ingest(b)
  File "load_pre10.py", line 179, in _ingest
    b.ingest(force=force, clean_files=clean_files)
  File "/home/nmb10/projects/ambry_project/ambry/bundle/bundle.py", line 873, in ingest
    clean=force, account_accessor=account_accessor)
  File "/home/nmb10/.virtualenvs/ambry/local/lib/python2.7/site-packages/ambry_sources/download.py", line 76, in get_source
    .format(spec.name, file_type))
ambry_sources.sources.exceptions.SourceError: Failed to determine file type for source 'neighborhoods'; unknown type 'dbf' 
ericbusboom commented 9 years ago

The file, http://ds.civicknowledge.org/civicsd.com/neighborhood.zip is a shapefile, but since that isn't noted in the sources, ambry reads the first file, which is a .dbf.

Shapefiles can be detected from the extensions in the archive. They virtually always will have a .shp and a .dbf file with the same base name.

ericbusboom commented 9 years ago

Actually, don't auto detect; just mark this particular source as a shapefile. Moved to: CivicKnowledge/pre-10-bundles#6