Ejemplo n.º 1
0
def connect2repo(path, remote='localhost', repo_type='local'):

    print 'connect 2 repo %s' % path
    if os.path.isdir(os.path.join(path, '.geogig')):
        print "Set to existing repo"
        try:
            repos = Repository(path)
        except GeoGigException, e:
            print e

        return repos
    else:
        if repo_type == "remote":
            try:
                repos = Repository.newrepofromclone(remote, path)
            except GeoGigException, e:
                print e
            print "New repo from clone"
        else:
            try:
                repos = Repository(path, init=True)
            except GeoGigException, e:
                print e
            print "New repo initialized at : %s" % path
    return repos


def export_to_geojson(repos, filepath):
    for t in repos.trees:
        print "t: %s" % t.path
Ejemplo n.º 2
0
def connect2repo(path, remote='localhost', repo_type='local'):

    print 'connect 2 repo %s' % path
    if os.path.isdir(os.path.join(path, '.geogig')):
        print "Set to existing repo"
        try:
            repos = Repository(path)
        except GeoGigException, e:
            print e

        return repos
    else:
        if repo_type == "remote":
            try:
                repos = Repository.newrepofromclone(remote, path)
            except GeoGigException, e:
                print e
            print "New repo from clone"
        else:
            try:
                repos = Repository(path, init=True)
            except GeoGigException, e:
                print e
            print "New repo initialized at : %s" % path
    return repos


def export_to_geojson(repos, filepath):
    for t in repos.trees:
        print "t: %s" % t.path