def __init__(self, store=None, config=None):
        """
        Create a new spatial utility, based on the stored config.

        @keyword store: Optional L{StoredConfig} that contains configuration settings.
        @keyword config: Optional configuration settings.
        """
        if not store is None:
            self.store = store

            mapconfig = self.store.get_mapserver()

            self.host = mapconfig.get('hostname')
            self.port = 8080 # should this be parameterized?

            self.ns = mapconfig.get('ns')
            self.nshref = mapconfig.get('nshref')

            user_pass = '%s:%s' % (mapconfig.get('adminuser'), mapconfig.get('adminpass'))

            self.styledir = mapconfig.get('styles')
        elif isinstance(config, dict):
            try:
                self.host = config['host']
                self.port = 8080

                self.ns = config['ns']
                self.nshref = config['nshref']

                user_pass = '%s:%s' % (config['adminuser'], config['adminpass'])

                self.styledir = config['styles']
            except:
                logger.error('SpatialUtils is missing a required key in the settings dictionary.')
                raise

        else:
            logger.error('SpatialUtils requires either a stored config or a dictionary of settings.')
            raise Exception()

        if self.host == '':
            self.host = 'localhost'

        auth = 'Basic %s' % base64.b64encode(user_pass)
        self.headers = {
                'default': {
                'Authorization': auth, 
                'Content-Type': 'application/json', 
                'Accepts':'application/json'
            },
            'sld': {
                'Authorization': auth,
                'Content-Type': 'application/vnd.ogc.sld+xml',
                'Accepts':'application/xml'
            }
        }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/config.py/SpatialUtils.__init__/original