Skip to content

jgosier/SULSa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=======
ABOUT
=======
 
SULSa (Swift User Location Services App) was created to allow programmers and developers to easily add the location info of users to their POST requests to Ushahdi.  The location information is updated monthly from http://www.hostip.info to a server managed by Ushahidi to ensure it never goes offline permanently. Returns JSON, standard XML as well as PFIF, GeoRSS, and EDXL.

Why use it? SULSa is a service that applications can use to get lat/lon coordinates of users, using only their IP address, which the Ushahidi API requires for all POST requests. In a nutshell, if you've got a user's ip address, you can use SULSa to get their location returned in a format that's easy for third party applications to parse.
 
Developers - Moses Mugisha, Jon Gosier

The source code can be found at http://github.com/appfrica/SULSa
The raw database information can be found at http://www.hostip.info/dl/index.html
 
=======
API
=======
 
url - http://67.23.24.128:3000/find_loc/<user ip address>/<format>
 
replace <user ip address> with an actual ip address.  ex. 67.23.24.128
 
replace <format> with the format you want to return. (Currently XML, JSON, PFIF, EDXL and GeoRSS are supported.)
 
=========
EXAMPLES
=========
 
XML example - http://67.23.24.128:3000/find_loc/67.23.24.128/xml
Click here to see it in Action
 
<ip-group-cities type="array"> 
  <ip-group-city> 
    <city>Mercer Island</city> 
    <country-code>US</country-code> 
    <country-name>United States</country-name> 
    <dstOffset>-7</dstOffset> 
    <gmtOffset>-8</gmtOffset> 
    <ip-start type="integer">1125586944</ip-start> 
    <latitude type="float">47.5602</latitude> 
    <longitude type="float">-122.228</longitude> 
    <region-code>53</region-code> 
    <region-name>Washington</region-name> 
    <timezone>-8</timezone> 
    <zipcode>98040</zipcode> 
  </ip-group-city> 
</ip-group-cities> 
 
JSON example - http://67.23.24.128:3000/find_loc/67.23.24.128/json
Click here to see it in Action
 
[{"ip_group_city":{"region_name":"Washington","country_code":"US","city":"Mercer Island","latitude":47.5602,"gmtOffset":"-8","region_code":"53","dstOffset":"-7","zipcode":"98040","timezone":"-8","ip_start":1125586944,"longitude":-122.228,"country_name":"United States"}}]

PFIF example - http://67.23.24.128:3000/find_loc/67.23.24.128/pfif
Click here to see it in Action

<pfif:pfif xsi:schemaLocation="http://zesty.ca/pfif/1.1 http://zesty.ca/pfif/1.1/pfif-1.1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pfif="http://zesty.ca/pfif/1.1"> 
  <pfif:person> 
    <home_country>United States</home_country> 
    <home_city>Mountain View</home_city> 
    <home_state>California</home_state> 
    <home_zip>94043</home_zip> 
  </pfif:person> 
</pfif:pfif>

EDXL example - http://67.23.24.128:3000/find_loc/67.23.24.128/edxl
Click here to see it in Action

<EDXLDistribution xmlns="urn:oasis:names:tc:emergency:EDXL:DE:1.0"> 
  <targetArea> 
    <circle>37.4192  -122.057  0</circle> 
    <country>United States</country> 
    <subdivision>Mountain View ,California</subdivision> 
    <locCodeUN>US</locCodeUN> 
  </targetArea> 
</EDXLDistribution>

GeoRSS example - http://67.23.24.128:3000/find_loc/67.23.24.128/georss
Click here to see it in Action

<rss xmlns:georss="http://www.georss.org/georss"> 
  <channel> 
    <title>ip address feed</title> 
    <link>74.125.87.103</link> 
    <description>the location of the ipaddress</description> 
    <language>en-us</language> 
    <georss:point> 
37.4192 -122.057    </georss:point> 
  </channel> 
</rss>