Source code for the PDX Trees project
All original code is made available under the MIT License. See the readme.txt docs and the individual source files for details, and specifics about third-party libraries, frameworks and images.
iOS Source
For iOS 4.x running on iPhones and iPod Touch devices: GitHub
Django Source
The code for the RESTful API that manages tree image sharing: Download (zip, 53KB)
NOTE: The Django version of the backend has so many problems that I can't even recommend reading it, let alone using it. I'm in the process of moving everything to CouchDB. When that is complete, the source will be on GitHub and the Django backend phased out as soon as most people have upgraded their apps.
PDX Trees iPhone APIv1 URLs
POST
Tree Image Upload:
/treeimages/ (for now, related_tree_id is read from fields in the request, not the url)
Upload a photo for a tree with these fields:
Required:
- image (JPEG or PNG, < 2.5 mb please)
- related_tree_id (from the heritage tree data)
- related_tree_couch_id (for matching against PDXAPI.com's data)
- date_submitted (server overrides)
- flag_count (server overrides)
- review_status (server overrides)
Optional:
- caption (Up to about 90 characters will be displayed. May increase in the future.)
- submitter_name
- submitter_email (must validate if included)
Future:
- tags
- submitter_url
GET
Flagging:
- /treeimages/photo/<photoID>/flag/ - Flagging a photo/caption increments flag_count for the photo specified in the URL. If flag_count is above x (currently 1) the item is removed from public view and thrown into a moderator queue. The moderator can decrement to 0 if the flag is unwarranted. (Yes, this should be a PUT, but I couldn't get that to work, and I am burned out on troubleshooting quirks in django-piston, which I hope to replace as soon as I can.)
Fetching images:
- /treeimages/<tree_id>/ - (probably not used by iPhone because it lists urls to original size)
- /treeimages/<tree_id>/iphonethumbnail/ - list thumbnail urls and metadata for tree_id
- /treeimages/<tree_id>/iphonescreen/ - list fullscreen (480x320) urls and metadata for tree_id
- /treeimages/<tree_id>/iphonescreen2x/ - list fullscreen (960x640 for iPhone4) urls and metadata for tree_id
I haven't implemented it yet, but it wouldn't be hard to create URLs that use the CouchDB ID from PDXAPI instead of the city tree ID. If anyone would prefer that, let me know.
Future
Possible APIs to implement in the future:
- All photos for season
- Most recent photo feed
- All photos for type of tree (i.e. elm)
- Query tree data in arbitrary ways, i.e. highest tree in this bounding box, all elms in laurelhurst, etc.
If you have any other ideas, please let me know!