@staticmethod
    def generate_metadata(plan, districts):
        if len(districts) > 0:
            srs = SpatialReference(districts[0].geom.srid)
            districts[0].geom.transform(4326)
            e = None
            for i in range(1, len(districts)):
                districts[i].geom.transform(4326)
                if not districts[i].geom.empty:
                    if e is None:
                        e = Envelope(districts[i].geom.extent)
                    else: 
                        e.expand_to_include(districts[i].geom.extent)
        else:
            srs = SpatialReference(4326)
            e = Envelope( (-180.0,-90.0,180.0,90.0,) )

        site = Site.objects.get_current()

        dt_now = datetime.now()
        # All references to FGDC below refer to the FGDC-STD-001 June 1998 metadata
        # reference. A graphical guide may be found at the following url:
        # http://www.fgdc.gov/csdgmgraphical/index.html
        meta = {
            'idinfo':{ # FGDC 1
                'citation':{ # FGDC 1.1
                    'citeinfo':{
                        'origin':site.domain,
                        'pubdate':dt_now.date().isoformat(),
                        'pubtime':dt_now.time().isoformat(),
                        'title':'DistrictBuilder software, from the PublicMapping Project, running on %s' % site.domain
                    }
                },
                'descript':{ # FGDC 1.2
                    'abstract':'User-created plan "%s" from DistrictBuilder.' % plan.name,
                    'purpose':'Enable community participation in the redistricting process.'
                },
                'timeperd':{ # FGDC 1.3
                    'timeinfo':{
                        'caldate':dt_now.date().isoformat(),
                        'time':dt_now.time().isoformat()
                    },
                    'current':'Snapshot of user-created data at the time period of content.'
                },
                'status':{ # FGDC 1.4
                    'progress':'Complete',
                    'update':'Unknown'
                },
                'spdom':{ # FGDC 1.5
                    'bounding':{
                        'westbc':e.min_x,
                        'eastbc':e.max_x,
                        'northbc':e.max_y,
                        'southbc':e.min_y
                    }
                },
                'keywords':{ # FGDC 1.6
                    'theme': {
                        # The theme keyword thesaurus was chosen from 
                        # http://www.loc.gov/standards/sourcelist/subject-category.html
                        'themekt':'nasasscg', # NASA scope and subject category guide
                        'themekey': 'law'
                    }
                },
                'accconst': 'None', # FGDC 1.7
                'useconst': 'None', # FGDC 1.8
            },
            'spdoinfo':{ # FGDC 3
                'direct': 'Vector', # FGDC 3.2
                'ptvctinf': { # FGDC 3.3
                    'sdtstype': 'G-polygon',
                    'ptvctcnt': len(districts)
                }
            },
            'spref':{ # FGDC 4
                'horizsys': {
                    'planar': { # FGDC 4.1.2
                        'gridsys':{
                            'othergrd': srs.wkt
                        }
                    }
                }
            },
            'eainfo': { # FGDC 5 
                'detailed': {
                    'enttype': {
                        'enttypl': 'Plan "%s"' % plan.name,
                        'enttypd': 'Feature Class',
                        'enttypds': '%s (%s %s)' % (plan.owner.username, plan.owner.first_name, plan.owner.last_name,)
                    },
                    'attr':[] # must be populated later, with entity information
                }
            }, 
            'metainfo':{ # FGDC 7
                'metd': dt_now.date().isoformat(), # FGDC 7.1
                'metstdn': 'FGDC Content Standards for Digital Geospatial Metadata',
                'metstdv': 'FGDC-STD-001 June 1998'
            }
        }

        return meta
Read a single block from Agilent/Varian binary file.
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/tasks.py/DistrictShapeFile.generate_metadata--crossover with--dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/get_block