Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Experimental layer management functionality for GeoCam Share

tree: db7fa84233

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc_src
Octocat-spinner-32 example
Octocat-spinner-32 geocamLayer
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 TODO.txt
Octocat-spinner-32 USAGE.txt
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
README.rst

1st paragraph describes point 2nd paragraph "here is the exact install instructions"

The point of the geocamLayer project is to provide a server-side application that performs the tasks of managing & clustering points on a map, reducing to a minimum the client-side requirements in the area of processing power. This application provides a json and a kml interface, which both account for clustering automatically.

To get the included demo running:

  1. Install django
  2. cd into example
  3. python manage.py syncdb
  4. python manage.py runserver

The server should now be running on localhost:8000. The web page should be a full-page google map, which should automatically load points and clusters as you move the map around. Clicking on a cluster should bring you down to a zoom level that includes all the points in the cluster.

Documentation for the use of this clustering software

The whole point of this clustering software is to be completely expandable without the need for modification of the code. The code as-is only needs to be provided with a list of objects that have the same functions as the ones in the models.py BaseFeature class. All of the clustering takes place within the "get" function, there is no database interaction whatsoever. This is in contrast to the Django system that this is based on, where most of the interactions are with databases.

The "get" function takes the request as a first argument and the list of points as the second. It has two encoding options, geojson and kml.

The geojson is formatted as follows:

{
  "type": "FeatureCollection",
  "features":
  [
    {"geometry": {
      "type":"Point",
      "coordinates":[
        [
          (lat-coordinate of feature),
        (lng-coordinate of feature)
      ]
      ]
    },
    "properties": {
      (for clusters)
      "bbox": [
        (north coordinate of bounding box containing points in cluster),
      (east coordinate),
      (south coordinate),
      (west coordinate)
      ],
      (for clusters:)
      "numpoints":(number of points in cluster),
      "subtype":"cluster"
      (for other points:)
      "timestamp":(timestamp of point),
      "timespan":(timespan of point),
      "name":(name of point),
      "description":(description of point),
      (all other properties that are provided by the getProperties function)
    }
    },
    (all the other points on the map)
    ]
}

The KML is formatted as follows:

TODO: this section.

A sample server-side implementation of this could be:

url_patterns += [
    (r'^points/', 'views.get', {'objects':objects})
]

The values passed to this "get" views are passed in the URL ("GET" parameters) and are as follows (all are optional):

cluster: 1 or 0 for yes or no, respectively bbox: toUrlValue() of a LatLngBounds gmap2 object encoding: geojson or kml start: start index end: end index 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

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.

The positions and bounding boxes of the objects sent through the geojson are intended to work well with google maps, and are in the right order to enable direct loading of the points into the gmap. The bounds included in each cluster can be translated into LatLngBounds with no change in order, which can then be passed to the fitBounds method which will correctly zoom down to a point where you can see all the points in the cluster.

To get the included demo running:

  1. Install django
  2. cd into example
  3. python manage.py syncdb
  4. python manage.py runserver
  5. demo is now running on localhost:8000
Something went wrong with that request. Please try again.