GWT-Maps-V3-Api
GWT-Maps-V3-Api copied to clipboard
Exception Creating a Heat Map from non-encoded values
I'm trying to create a heat map using points sourced from a database. This is my code:
JsArray<LatLng> points = JsArray.createArray().cast();
for(int i = 0; i < count; i ++){
GPSCoordinate point = routeList.get(i);
double latitude = Double.parseDouble(point.getLatitude());
double longitude = Double.parseDouble(point.getLongitude());
points.push(LatLng.newInstance(latitude, longitude));
}
HeatMapLayer heatMapLayer = HeatMapLayer.newInstance(options);
heatMapLayer.setData(points);
But i get this exception: a[Qb] is not a function.
If I add:
String path = EncodingUtils.encodePath(points);
points = EncodingUtils.decodePath(path);
Before:
heatMapLayer.setData(points);
All works fine. But I plan to use WeightedLocation and this solution not be working.
@joni-jones to isolate that this is not the code filling the points, can you confirm this behavior with hardcoded LatLngs? Just to make sure NULL
or similar is not being passed in. That way I've at least got a test case without GPSCoordinate
to work with. Thanks.
Thanks for your answer. I'm also tried 'hardcode' single LatLng
point and get this exception.
Also i checked JsArray
of points it not empty.
If I'm call this code:
JsArray<LatLng> newPoints = JsArray.createArray().cast();
newPoints.push(LatLng.newInstance(12.936992205764442, 77.62094830425235));
HeatMapLayer heatMapLayer = HeatMapLayer.newInstance(options);
heatMapLayer.setData(newPoints);
I'm get exception, but if add:
String path = EncodingUtils.encodePath(newPoints);
newPoints = EncodingUtils.decodePath(path);
Heat showing on the map.
@joni-jones Thanks for confirming this. I'll check it out when I get home tonight.