增加Android版Maps API的热图半径 [英] Increase radius on heat map for Maps API on Android
问题描述
我已经在Android的Google Maps API上创建了热点地图.问题是当我增加缩放比例时,热图会变松"半径,并且外观不是那么好.
I've created an heat map on Google Maps API for Android. The problem is when I increase zoom, the heat map "looses" radius and the look is not that good.
有一种方法可以将半径增加到50以上(可能是最大值)? :/
There`s a way to increase radius above 50 (Probably the maximum)? :/
推荐答案
来自
半径:应用于热图的高斯模糊的大小,
以像素表示.默认值为20.必须介于10到50之间.
创建热图时使用Builder的radius()设置值,或者
稍后使用setRadius()更改值.
Radius: The size of the Gaussian blur applied to the heatmap,
expressed in pixels. The default is 20. Must be between 10 and 50. Use
the Builder's radius() to set the value when creating the heatmap, or
change the value later with setRadius(). 因此,如果您使用 So, if you use the 看看 GitHub存储库,您可以看到 Taking a look at the GitHub repository you can see that the 无论如何,您都可以使用 Anyway there is a 因此,由于 So, as the 以警察局为例,并将半径设置为50: Using the police stations example, and setting the radius to 50: 并将半径设置为100: And setting the radius to 100: 您可能要根据缩放级别动态更改HeatMap的半径. You may want to dynamically change the radius of the HeatMap based on the zoom level. 注意:,请考虑Javac中关于 NOTE: Take into account that, as stated in the Javadoc for the 用户应在之后清除覆盖的图块缓存(使用 User should clear overlay's tile cache (using 这篇关于增加Android版Maps API的热图半径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
HeatmapTileProvider.Builder
中的radius(int val)
函数,并且半径不在10到50之间,则会收到IllegalArgumentException("Radius not within bounds.")
异常.radius(int val)
function from the HeatmapTileProvider.Builder
you will receive an IllegalArgumentException("Radius not within bounds.")
exception if the radius is not between 10 an 50.radius(int val)
函数检查参数是否在MIN_RADIUS
和MAX_RADIUS
之间.radius(int val)
function checks if the parameter is between MIN_RADIUS
and MAX_RADIUS
.HeatmapTileProvider
类上的setRadius(int radius)
函数(看看setRadius(int radius)
function on the HeatmapTileProvider
class that you can use (take a look at he implementation in the GitHub repository).setRadius(int radius)
函数不会检查该参数,因此可以按如下所示调用build()
后更改HeatmapTileProvider
的半径:setRadius(int radius)
function does not check the parameter, you can change the radius of the HeatmapTileProvider
after calling build()
as follows:HeatmapTileProvider mProvider = new HeatmapTileProvider.Builder()
.data(list)
.build();
mProvider.setRadius(100);
setRadius
函数的说明:setRadius
function:
clearTileCache()
)
叫这个.
clearTileCache()
) after
calling this.