def test_vtile_z22_higher_precision(self): """ Test adding points at zoom 22 with larger than standard path multiplier """ merc = renderer.SphericalMercator() x, y = -8526703.378081053, 4740318.745473632 xyz_bounds = merc.xyz([x, y, x, y], 22) req = renderer.Request(xyz_bounds[0], xyz_bounds[1], 22) vtile = renderer.VectorTile(req, path_multiplier=512) layer = vtile.add_layer(name="points") vtile.add_point(layer, x, y, {}) j_obj = vtile.to_geojson() feature = j_obj['features'][0] coords = feature['geometry']['coordinates'] self.assertAlmostEqual(coords[0], x, 4) self.assertAlmostEqual(coords[1], y, 4)
def test_vtile_z22(self): """ Test adding points at zoom 22 """ merc = renderer.SphericalMercator() x, y = -8526703.378081053, 4740318.745473632 xyz_bounds = merc.xyz([x, y, x, y], 22) req = renderer.Request(xyz_bounds[0], xyz_bounds[1], 22) vtile = renderer.VectorTile(req) layer = vtile.add_layer(name="points") vtile.add_point(layer, x, y, {}) j_obj = vtile.to_geojson() feature = j_obj['features'][0] coords = feature['geometry']['coordinates'] self.assertAlmostEqual(coords[0], x, 2) self.assertAlmostEqual(coords[1], y, 1)
def test_spherical_mercator(self): merc = renderer.SphericalMercator() z0_extent = merc.bbox(0, 0, 0)