Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

greatly improved tile loading by making one simple change

  • Loading branch information...
commit 16eea3d6f24e154d9c9c4dffb0ccae424e4c28b3 1 parent 8a52268
@jrasky jrasky authored
View
24 TODO.txt
@@ -1,10 +1,9 @@
Todo list for geocamlayer
-- Figure out tiling
- - document protocol, interface behavior
- - integration problem
- - test suite
- - client side
+- Fix bugs
+
+- Figure out clustering, once and for all.
+
- Actually get kml working
- Top level link that will load the kml in gearth and do the right stuff
@@ -14,7 +13,20 @@ Done list
- Remove dependancy on geodjango
- Instead of point, lat/long fields
-Probably done list
+- Figure out tiling
+ - document protocol, interface behavior
+ - integration problem
+ - test suite
+ - client side
- Fix the documentation
- make install process as easy as possible
+
+Bug List
+
+- We still have issues with tiling
+- Largest zoom level has problems
+- We need to handle cases in the javascript where the zoom level is past what exists (i.e. zoom 11)
+- Maybe we need to load the next biggest zoom level
+- Not loading correct tile on zoom change
+- Clusters are still being weird
View
BIN  example/database.db
Binary file not shown
View
11,548 example/nsd_bbsss.txt
11,548 additions, 0 deletions not shown
View
12 geocamLayer/management/commands/restruct.py
@@ -23,16 +23,18 @@ def add_point(self, point):
self.numPoints += 1
if self.numPoints == 1 or self.finalZoom:
self.points.append(point)
+ else:
+ self.points = []
x, y = point.getPosition()
self.xSum += x
self.ySum += y
- if self.west is None or x < self.west:
- self.west = x
- if self.east is None or x > self.east:
+ if self.east is None or x < self.east:
self.east = x
- if self.south is None or y < self.south:
+ if self.west is None or x > self.west:
+ self.west = x
+ if self.south is None or y > self.south:
self.south = y
- if self.north is None or y > self.north:
+ if self.north is None or y < self.north:
self.north = y
def get_json(self):
View
2  geocamLayer/static/geocamLayer/main.js
@@ -87,7 +87,7 @@ function setClusters() {
else {
marker = new google.maps.Marker({position:new google.maps.LatLng(pos[0], pos[1]), map:map, clickable:true, icon:new google.maps.MarkerImage(url='/static/arrow.png')});
bboxes[new google.maps.LatLng(pos[0], pos[1])] = cluster['properties']['bbox'];
- google.maps.event.addListener(marker,"click",function(event){clearClusters();bbox=bboxes[event.latLng];bounds = new google.maps.LatLngBounds(new google.maps.LatLng(bbox[0],bbox[1]),new google.maps.LatLng(bbox[2],bbox[3]));map.fitBounds(bounds);});
+ google.maps.event.addListener(marker,"click",function(event){clearClusters();bbox=bboxes[event.latLng];bounds = new google.maps.LatLngBounds(new google.maps.LatLng(bbox[0],bbox[1]),new google.maps.LatLng(bbox[2],bbox[3]));console.log(bbox);console.log(bounds);map.fitBounds(bounds);});
clusters[clusters.length] = marker;
}
}
View
23 geocamLayer/static/geocamLayer/static_tiles.js
@@ -68,8 +68,9 @@ function boundsChanged() {
if (isNaN(zoom)) zoom = 1;
tile_size = 360/Math.pow(2,zoom);
- x = Math.floor((west-(-180))/tile_size)*2;
- y = Math.floor((south-(-90))/tile_size)*2;
+ center = map.getCenter();
+ x = Math.floor((center.lng()-(-180))/tile_size)*2;
+ y = Math.floor((center.lat()-(-90))/tile_size)*2;
if (currentZoom != zoom) {
clearPoints();
@@ -89,6 +90,7 @@ function boundsChanged() {
function loadTile(zoom,x,y) {
conn = new XMLHttpRequest();
+ console.log("getting /staci/tiles/"+zoom+"/"+x+"/"+y+".json", true);
conn.open("GET", "/static/tiles/"+zoom+"/"+x+"/"+y+".json", true);
conn.onreadystatechange = processTile;
conn.send(null);
@@ -122,17 +124,18 @@ function processTile() {
cluster = parsed['features'][x];
pos = cluster['geometry']['coordinates'].toString().split(',');
if (cluster['properties']['subtype'] == 'point') {
- marker = new google.maps.Marker({position:new google.maps.LatLng(pos[0], pos[1]), map:map});
+ marker = new google.maps.Marker({position:new google.maps.LatLng(pos[1], pos[0]), map:map});
points[points.length] = marker;
} else {
- marker = new google.maps.Marker({position:new google.maps.LatLng(pos[0], pos[1]), map:map, clickable:true, icon:new google.maps.MarkerImage(url='/static/arrow.png')});
- bboxes[new google.maps.LatLng(pos[0], pos[1])] = cluster['properties']['bbox'];
+ marker = new google.maps.Marker({position:new google.maps.LatLng(pos[1], pos[0]), map:map, clickable:true, icon:new google.maps.MarkerImage(url='/static/arrow.png')});
+ bboxes[new google.maps.LatLng(pos[1], pos[0])] = cluster['properties']['bbox'];
google.maps.event.addListener(marker,"click",function(event){
- bbox = bboxes[event.latLng];
- console.log(bbox);
- bounds = new google.maps.LatLngBounds(new google.maps.LatLng(bbox[0],bbox[1]),
- new google.maps.LatLng(bbox[2],bbox[3]));
- map.fitBounds(bounds);
+ bbox = bboxes[event.latLng];
+ console.log(bbox);
+ bounds = new google.maps.LatLngBounds(new google.maps.LatLng(bbox[0],bbox[1]),
+ new google.maps.LatLng(bbox[2],bbox[3]));
+ console.log(bounds);
+ map.fitBounds(bounds);
}
);
points[points.length] = marker;
Please sign in to comment.
Something went wrong with that request. Please try again.