-
Notifications
You must be signed in to change notification settings - Fork 18
Heatmap Details
We are using Solr heatmaps to replace the GPU based map tiles. The map tiles provided contained a red icon for each item. Clicking on the map calls up a list of items near the mouse event. The GPU based version of JDA sends a getFeatureInfo request and puts the list of nearby items in a pop-up window. This request includes a SQL query and looks like:
http://geops.cga.harvard.edu/getFeatureInfo&_SQL=select id from jda where dist(point(media_geo_longitude,media_geo_latitude),point(140.45471209375,37.756601563905)) < 2.746582031260301 LIMIT 50&COLUMNS=all
The request goes to the geops (GPU) server. The point is the location of the mouse event. The request returns at most 50 items. The distance (in this case, 2.74...) changes with zoom level. It is computed with:
bounds = jda.app.eventMap.map.getExtent();
latLngBounds = bounds.transform(jda.app.eventMap.map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));
dist = 1000*Math.abs(latLngBounds.left-latLngBounds.right)/window.innerWidth;
Here is a sample response (text removed and simplified):
{"n":1,"results": [{"description":"...","display_name":"Hypercities","goog_x":15495339.15782527,"goog_y":4924635.272722726,"id":"391836","layer_type":"Tweet","media_creator_realname":"Unknown","media_creator_username":"skobl_fumiya","media_date_created":1300332945,"media_geo_latitude":40.40270,"media_geo_longitude":139.1970,"media_type":"Tweet","text":"...","thumbnail_url":"http://a0.twimg.com/profile_images/1238183171/skobl_fumiya_normal.jpg","title":"","uri":"48256182158229504","username":"hypercities"}]}
Removing the geops server implies the JDA client must obtain item data in a new way. Since this data is in Solr, we will use it as the source. The required distance calculation can use the new field of type RPT and Solr geofilt spatial filter.