How to use the svgis.svgis.SVGIS function in svgis

To help you get started, we’ve selected a few svgis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fitnr / svgis / tests / test_svgis.py View on Github external
def testOpenZips(self):
        archive = 'zip://tests/test_data/test.zip/tests/test_data/cb_2014_us_nation_20m.json'

        result = svgis.SVGIS([archive], simplify=60).compose()

        self.assertIn('cb_2014_us_nation_20m', result)
github fitnr / svgis / tests / test_projection_draw.py View on Github external
def testDrawWithReProjectionRepeat(self):
        s = svgis.SVGIS(self.files[::-1], self.bounds[4269], out_crs=EPSG3528, scalar=100)
        s.compose()

        u = s.compose(bounds=(-87.6475, 42.0705, -87.5165, 42.1452))

        i = u.index('points')
        self.assertIn('points', u[i:])
github fitnr / svgis / tests / test_projection_draw.py View on Github external
def testDrawWithSameProjection(self):
        s = svgis.SVGIS(self.files, crs={'init': 'epsg:2790', 'no_defs': True})
        a = s.compose()

        self.assertIn('points', a)
        i = a.index('points')
        self.assertIn('points', a[i:])
github fitnr / svgis / tests / test_draw.py View on Github external
"geometry": {
                'coordinates': self.lis2,
                'type': 'LineString',
                "id": "LineString",
            }
        }
        self.point = {
            "properties": self.properties,
            "geometry": {
                'coordinates': (0.0, 0),
                'type': 'Point',
                "id": "Point",
            }
        }

        self.obj = svgis.SVGIS([])
github fitnr / svgis / tests / test_svgis.py View on Github external
def testSvgisCreate(self):
        self.assertEqual(self.svgis_obj.files, [self.file])
        assert self.svgis_obj._projected_bounds == (None,) * 4
        assert self.svgis_obj.out_crs is None
        assert self.svgis_obj.style == svgis.STYLE

        svgis_obj2 = svgis.SVGIS([self.file])
        assert svgis_obj2.files == [self.file]

        with self.assertRaises(ValueError):
            svgis.SVGIS(12)
github fitnr / svgis / tests / test_svgis.py View on Github external
def setUp(self):
        self.log = logging.getLogger('svgis')
        self.log.setLevel(logging.WARN)
        ch = logging.StreamHandler()
        ch.setLevel(logging.WARN)
        self.log.addHandler(ch)

        self.svgis_obj = svgis.SVGIS(self.file)
github fitnr / svgis / tests / test_svgis.py View on Github external
def testSvgisCreate(self):
        self.assertEqual(self.svgis_obj.files, [self.file])
        assert self.svgis_obj._projected_bounds == (None,) * 4
        assert self.svgis_obj.out_crs is None
        assert self.svgis_obj.style == svgis.STYLE

        svgis_obj2 = svgis.SVGIS([self.file])
        assert svgis_obj2.files == [self.file]

        with self.assertRaises(ValueError):
            svgis.SVGIS(12)
github fitnr / svgis / svgis / svgis.py View on Github external
simplify (int): Integer between 1 and 99 describing simplification level.
                99: not very much. 1: a lot.

    Returns:
        String (unicode in Python 2) containing an entire SVG document.
    '''
    scale = (1. / scale) if scale else 1.
    bounds = bounding.check(bounds)

    # Try to read style file(s)
    styles = u''.join(_style.pick(s) for s in kwargs.pop('style', []))

    class_fields = set(a for c in kwargs.pop('class_fields', []) for a in c.split(','))
    data_fields = set(a for c in kwargs.pop('data_fields', []) for a in c.split(','))

    drawing = SVGIS(
        layers,
        bounds=bounds,
        scalar=scale,
        crs=kwargs.pop('crs', None),
        style=styles,
        clip=kwargs.pop('clip', True),
        id_field=kwargs.pop('id_field', None),
        class_fields=class_fields,
        data_fields=data_fields,
        simplify=kwargs.pop('simplify', None)
    ).compose(**kwargs)

    return drawing
github fitnr / svgis / svgis / cli / actions.py View on Github external
:padding int Pad around bounds by this much. In projection units.
    :project string EPSG code, PROJ.4 string, or file containing a PROJ.4 string
    '''
    scale = (1 / scale) if scale else 1

    # Try to read style file
    styles = pick_style(kwargs.pop('style', None))

    use_proj, out_crs = pick_projection(kwargs.pop('project'))

    if kwargs.get('class_fields'):
        kwargs['classes'] = kwargs.pop('class_fields').split(',')

    kwargs.pop('class_fields', None)

    drawing = SVGIS(
        layers,
        bounds=bounds,
        scalar=scale,
        use_proj=use_proj,
        out_crs=out_crs,
        padding=padding,
        style=styles,
        clip=kwargs.pop('clip', True)
    ).compose(**kwargs)

    return drawing