def _get_source(self, uri): b = VectorTileVectorSourceConfigBuilder() \ .with_class_inference(class_id_to_filter=self.class_id_to_filter, default_class_id=None) \ .with_uri(uri) \ .with_zoom(14) \ .with_id_field('__id') \ .with_buffers(line_bufs={1: 0.0001}, point_bufs={1: 0.0001}) \ .build() config = VectorTileVectorSourceConfig.from_proto(b.to_proto()) aoi_path = data_file_path('vector_tiles/lv-aoi.json') extent_geojson = json.loads(file_to_str(aoi_path)) extent = Box.from_shapely( shape(extent_geojson['features'][0]['geometry'])) source = config.create_source(self.crs_transformer, extent, self.class_map) return source
def test_from_shapely(self): shape = ShapelyBox(self.xmin, self.ymin, self.xmax, self.ymax) output_box = Box.from_shapely(shape) self.assertEqual(output_box, self.box)