Exemple #1
0
    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(errors.SvgisError):
            svgis.SVGIS(12)
Exemple #2
0
    def testDrawWithSameProjection(self):
        s = svgis.SVGIS(self.files, crs=2790)
        a = s.compose()

        self.assertIn('points', a)
        i = a.index('points')
        self.assertIn('points', a[i:])
Exemple #3
0
    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:])
Exemple #4
0
    def testDrawWithReProjection(self):
        s = svgis.SVGIS(self.files, self.bounds[2790], out_crs=EPSG3528, scalar=100)
        svg = s.compose()

        self.assertIn('points', svg)
        i = svg.index('points')
        self.assertIn('points', svg[i:])

        polygons = minidom.parseString(svg).getElementsByTagName('polygon')

        self.assertEqual(len(polygons), 2)

        self.assertIn('points', dict(polygons[0].attributes.items()))
        self.assertIn('points', dict(polygons[1].attributes.items()))
Exemple #5
0
    def setUp(self):
        self.multipolygon = {
            "properties": self.properties,
            "geometry": {
                "type": "MultiPolygon",
                "id": "MultiPolygon",
                "coordinates": [[self.lis1], [self.lis2]]
            }
        }
        self.polygon = {
            "properties": self.properties,
            "geometry": {
                "type": "Polygon",
                "id": "Polygon",
                "coordinates": [self.lis1]
            }
        }
        self.multilinestring = {
            "properties": self.properties,
            "geometry": {
                'type': 'MultiLineString',
                "id": "MultiLineString",
                'coordinates': [self.lis2, self.lis2]
            }
        }
        self.linestring = {
            "properties": self.properties,
            "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([])
Exemple #6
0
    def testDrawWithSameProjection(self):
        s = svgis.SVGIS(self.files, crs={'init': 'epsg:2790', 'no_defs': True})
        a = s.compose()

        i = a.index('points')
        self.assertIn('points', a[i:])
Exemple #7
0
 def setUp(self):
     logging.getLogger('svgis').setLevel(logging.CRITICAL)
     self.svgis_obj = svgis.SVGIS(self.file)
Exemple #8
0
    def testOpenZips(self):
        archive = 'zip://tests/fixtures/test.zip/fixtures/cb_2014_us_nation_20m.json'

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

        self.assertIn('cb_2014_us_nation_20m', result)
Exemple #9
0
 def setUp(self):
     self.svgis_obj = svgis.SVGIS(self.file)