Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapMode::Tile truncated labels #3189

Open
demiantres opened this issue Feb 1, 2025 · 0 comments
Open

MapMode::Tile truncated labels #3189

demiantres opened this issue Feb 1, 2025 · 0 comments

Comments

@demiantres
Copy link

When using MapMode::Tile (or MapMode::Raster) for creating map tiles, then text is sometimes truncated along tile borders:

Image

Code:

std::unique_ptr<mbgl::HeadlessFrontend> frontend;
std::unique_ptr<mbgl::Map> map;

int tileSize = 512;
float pixelRatio = 2.0;
Size s(tileSize/pixelRatio, tileSize/pixelRatio);
auto mapTilerConfiguration = TileServerOptions::DefaultConfiguration();
frontend.reset(new HeadlessFrontend(s, pixelRatio));
			
map.reset(new Map(
	*frontend,
	*this,
	MapOptions().withMapMode(MapMode::Tile).withSize(s).withPixelRatio(m_pixelRatio),
	ResourceOptions()
		.withTileServerOptions(mapTilerConfiguration)));
map->getStyle().loadURL("maptiler streets v2");


BoundingBox bb; // the bounding box of the tile
auto bounds = mbgl::LatLngBounds::hull(LatLng(bb.getMinLatitude(), bb.getMinLongitude()),
									   LatLng(bb.getMaxLatitude(), bb.getMaxLongitude()));

auto cameraOptions = map->cameraForLatLngBounds(bounds, mbgl::EdgeInsets());
map->jumpTo(cameraOptions);
auto image = m_frontend->render(*map);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant