Skip to content

Instantly share code, notes, and snippets.

View dkobia's full-sized avatar

David Kobia dkobia

View GitHub Profile
{
"payload": {
"domain": "http:\/\/ushahidi.dev\/",
"incidents": [
{
"incident": {
"incidentid": "3494",
"incidenttitle": "National Palace damaged",
"incidentdescription": "National Palace has extensive damage. President and First Lady are safe.",
"incidentdate": "2010-01-12 10:43:00",
<?php
/**
* Map helper class
*
* Portions of this class credited to: zzolo, phayes, tmcw, brynbellomy, bdragon
*
* @package Map
* @author Ushahidi Team
* @copyright (c) 2008 Ushahidi Team
* @license http://www.ushahidi.com/license.html
@dkobia
dkobia / gist:490967
Created July 26, 2010 18:18
Ushahidi Clustering - Python
#!/usr/bin/env python
import math
import sys
import MySQLdb
MAP_ZOOM = 21
MAP_OFFSET = 268435456 # half the Earth's circumference at zoom level 21
MAP_RADIUS = MAP_OFFSET / math.pi
def longitude_to_x(longitude):
@dkobia
dkobia / gist:460098
Created July 1, 2010 15:18
Ushahidi Export Query
SELECT incident.id as "#", incident_title AS "INCIDENT TITLE", incident_date AS "INCIDENT DATE", location.location_name AS LOCATION, incident_description AS DESCRIPTION, category.category_title AS CATEGORY, location.latitude AS LATITUDE, location.longitude AS LONGITUDE, CASE WHEN incident_active = 1 THEN "YES" ELSE "NO" END AS APPROVED, CASE WHEN incident_verified = 1 THEN "YES" ELSE "NO" END AS VERIFIED
FROM incident INNER JOIN location ON incident.location_id = location.id LEFT JOIN incident_category ON incident.id = incident_category.incident_id LEFT JOIN category ON incident_category.category_id = category.id
GROUP BY incident.id
ORDER BY incident.id ASC;