Process a layer using ogr2ogr.

def process_ogr2ogr(self, name, layer, input_path):
        """
        Process a layer using ogr2ogr.
        """
        output_path = os.path.join(TEMP_DIRECTORY, '%s.json' % name)

        if os.path.exists(output_path):
            os.remove(output_path)

        ogr2ogr_cmd = [
            'ogr2ogr',
                '-f', 'GeoJSON',
                '-clipsrc', self.config['bbox']
        ]

        if 'where' in layer:
            ogr2ogr_cmd.extend([
                '-where', '"%s"' % layer['where']
            ])

        ogr2ogr_cmd.extend([
            output_path,
            input_path
        ])

        sys.stdout.write('* Running ogr2ogr\n')

        if self.args.verbose:
            sys.stdout.write('  %s\n' % ' '.join(ogr2ogr_cmd))

        r = envoy.run(' '.join(ogr2ogr_cmd))

        if r.status_code != 0:
            sys.stderr.write(r.std_err)

        return output_path