Exemplo n.º 1
0
    def handle(self, *args, **options):
        filename = options['filename'][0]
        cl = ChangesetList(filename, geojson=settings.CHANGESETS_FILTER)
        imported = [create_changeset(c['id']) for c in cl.changesets]

        self.stdout.write(
            '{} changesets created from {}.'.format(len(imported), filename)
            )
Exemplo n.º 2
0
def test_changeset_list():
    c = ChangesetList('tests/245.osm.gz')
    assert len(c.changesets) == 25
    assert c.changesets[0]['id'] == '31982803'
    assert c.changesets[0]['created_by'] == 'Potlatch 2'
    assert c.changesets[0]['user'] == 'GarrettB'
    assert c.changesets[0]['comment'] == 'Added Emerald Pool Waterfall'
    assert c.changesets[0]['bbox'] == Polygon([(-71.0646843, 44.2371354),
                                               (-71.0048652, 44.2371354),
                                               (-71.0048652, 44.2430624),
                                               (-71.0646843, 44.2430624),
                                               (-71.0646843, 44.2371354)])
Exemplo n.º 3
0
def test_changeset_list_with_filters():
    """Test ChangesetList class filter method."""
    c = ChangesetList('tests/245.osm.gz', 'tests/map.geojson')
    assert len(c.changesets) == 1
    assert c.changesets[0]['id'] == '31982803'
Exemplo n.º 4
0
def get_filter_changeset_file(url, geojson_filter=settings.CHANGESETS_FILTER):
    """Filter the changesets of the replication file by the area defined in the
    GeoJSON file.
    """
    cl = ChangesetList(url, geojson_filter)
    group(create_changeset.s(c['id']) for c in cl.changesets)()