Skip to content
Browse files

updated documentation

  • Loading branch information...
1 parent 853ab2b commit eb97cd0a1a47662e579c644e434f6595d6374b90 @jrasky jrasky committed Mar 8, 2012
Showing with 20 additions and 18 deletions.
  1. +2 −2 README.rst
  2. +18 −16 geocamLayer/static/geocamLayer/main.js
View
4 README.rst
@@ -62,7 +62,7 @@ TODO: this section.
A sample server-side implementation of this could be::
url_patterns += [
- (r'^points/', 'views.get', {'objects':objects})
+ (r'^points/(?P<zoom>[-.0-9]*)/(?P<x>[-.0-9]*)/(?P<y>[-.0-9]*)', 'views.points', {'objects':objects})
]
The values passed to this "get" views are passed in the URL ("GET" parameters) and are as follows (all are optional):
@@ -76,7 +76,7 @@ reverse: 1 or 0 for yes or no, respectively
A sample URL could be::
- http://www.server.com/point/?cluster=1&bbox=7.095248,-142.99263,46.496068,-101.13472
+ http://www.server.com/points/5.997071742313324/-75.00732421875/27.350839455709888?cluster=1
The client side interface for the geojson is designed to be easy to read for gmap clients. The way that it is designed to be implemented is json parsing through an XMLHTTPRequest, which then pushes points or clusters depending on the subtype to the gmap interface. An example implementation is provided in the static folder.
View
34 geocamLayer/static/geocamLayer/main.js
@@ -46,22 +46,24 @@ function initialize() {
function getClusters() {
if (typeof(map.getBounds()) == 'undefined') {return;}
- if (updating) {concurent = true; return;}
- clearClusters();
- updating = true;
- bounds = map.getBounds()
- lat = map.getCenter().lat()
- lng = map.getCenter().lng()
- zoom_x = 360/(bounds.getNorthEast().lng()-bounds.getSouthWest().lng())
- zoom_y = 180/(bounds.getNorthEast().lat()-bounds.getSouthWest().lat())
- zoom_p = (zoom_x > zoom_y)?zoom_y:zoom_x;
- zoom_n = (zoom_x > zoom_y)?zoom_x:zoom_y;
- zoom = (zoom_x < 0 || zoom_y < 0)?zoom_n:zoom_p;
- conn = new XMLHttpRequest();
- conn.open("GET","/points/"+zoom+"/"+lng+"/"+lat+"?cluster=1",true);
- conn.send();
- conn.onreadystatechange = setClusters;
- //Clusters();
+ else if (updating) {concurent = true; return;}
+ else {
+ clearClusters();
+ updating = true;
+ bounds = map.getBounds()
+ lat = map.getCenter().lat()
+ lng = map.getCenter().lng()
+ zoom_x = 360/(bounds.getNorthEast().lng()-bounds.getSouthWest().lng())
+ zoom_y = 180/(bounds.getNorthEast().lat()-bounds.getSouthWest().lat())
+ zoom_p = (zoom_x > zoom_y)?zoom_y:zoom_x;
+ zoom_n = (zoom_x > zoom_y)?zoom_x:zoom_y;
+ zoom = (zoom_x < 0 || zoom_y < 0)?zoom_n:zoom_p;
+ conn = new XMLHttpRequest();
+ conn.open("GET","/points/"+zoom+"/"+lng+"/"+lat+"?cluster=1",true);
+ conn.send();
+ conn.onreadystatechange = setClusters;
+ //Clusters();
+ }
}
function clearClusters() {

0 comments on commit eb97cd0

Please sign in to comment.
Something went wrong with that request. Please try again.