Question

I am trying to generate the heatmap on a googlemap, with around 2 million points (latitude and longitude). My idea is to read the points from a table, and pass them to the google api in a List. The problem is, loading the 2 million points into the List is causing out of memory error in the EJB. Following is the line that gives me the error.

 List<Earthquakerisk> earthquakeRiskList = em.createNativeQuery("SELECT ASTEXT(geomArea) as geomText, riskvalue,id FROM Earthquakerisk e",Earthquakerisk.class).getResultList();

What alternatives can be applied so as to read the points and load them into the map? I am using glassfish 3.2.2, jdk 1.7, jsf 2.2, ejb.

Was it helpful?

Solution

You can take a look at: http://code.google.com/p/vanilla-java/wiki/HugeCollections

Also, have you thought about creating your own implementation of Iterator? Then you can retrieve the needed data on-demand when the iterator performs the next step.

Another option would be to split your dataset - like when you are doing pagination.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top