예제 #1
0
def import_zip_from_shapefile(filename, zipcode):
    layer = layer_from_shapefile(filename, 0)
    importer = ZipImporter(layer, 'ZCTA5CE')
    try:
        importer.import_zip(zipcode)
    except:
        log_exception()
        return
예제 #2
0
def import_zip_from_shapefile(filename, zipcode):
    layer = layer_from_shapefile(filename, 0)
    importer = ZipImporter(layer, 'ZCTA5CE')
    try:
        importer.import_zip(zipcode)
    except:
        logger.exception('Zipcode import failed')
        return
 def import_zips(self):
     fkey = 'zips'
     Location.objects.filter(location_type__slug='zipcodes').delete()
     zip_layer = DataSource('%s/%s.shp' % (self.zip_dir, self.datafiles[fkey]['file_name']))[0]
     zip_importer = ZipImporter(zip_layer,
         name_field=self.datafiles[fkey]['name_field'],
         source=self.datafiles[fkey].get('source', 'Unknown'),
         filter_bounds=True,
         verbose=True)
     zip_importer.bounds = self.county_location.location
     loc_created_count = zip_importer.save()
     return loc_created_count