Skip to content

tile size other than 256 using url with center lat/long #62

@lionelmazeyrat

Description

@lionelmazeyrat

Thank you for this amazing lib !

I try to use it with goole maps static api and others provider.
With these tiles providers, we have to use a center latitude,longitude

(version 2.3 from maven)

It works well with tile of 256px with the following code, but with other tile size the map displayed is not ok.
Have you ever done some test with other tile size ??? 512 or 640, does it works ???
Is there any other change to do if the tile size change ????

MyTileFactoryInfo myTileFactoryInfo = new MyTileFactoryInfo("Google", 1, 20, 20, 256,
true,true,"https://maps.googleapis.com/maps/api/staticmap", ....

in TileFactoryInfo Class I use this code to convert x/y to lat/long

public String getTileUrl(int x, int y, int zoom)
{
	zoom = getTotalMapZoom() - zoom;
	
	double xtile = x + 0.5;
	double ytile = y + 0.5;

	double n = Math.pow(2.0,zoom);
	double lon_deg = ((xtile / n) * 360.0) - 180.0;
	double lat_rad = Math.atan(Math.sinh(Math.PI * (1 - 2 * ytile / n)));
	double lat_deg = (lat_rad * 180.0) / Math.PI;
	...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions