Main Page

From wiki.coolgeo.org
Revision as of 19:29, 31 December 2015 by Admin (talk | contribs)
Jump to navigation Jump to search

REST Interface Description for Coolgeo.org.

This is about the coolgeo.org website along with the API interface for universal usage. Coolgeo.org offers an easy REST API to to query geo and station data

About Coolgeo.org
Coolgeo know mores than 30.000 Worldwide Stations, the stations are divided into subcodes such as city or airport codes. Each code has its geo data associated (latitude/longitude) and knows also the timezone along with the DST offset.


Search location by a IP address

Search location by a IP address

Sample: http://rest.coolgeo.org/xml.cgi?ip=1.2.3.4&optASN&optTZData&optStation&optAirport
Options:

  • optASN Give ASN data
  • optTZData Give TZ data
  • optStation Give station data
  • optAirport Give airport data



Return example for search ip=1.2.3.4

<Status>
 <Search IPAddress="1.2.3.4" Search="ipdata" optASN="1" optTZData="1" optStation="1" optAirport="1"/>
 <Response>
  <Ip 
   Latitude="47.9130" 
   Longitude="-122.3042" 
   CountryCode="US" 
   CountryName="UNITED STATES" 
   CurrencyCode="USD" 
   CurrencyName="US DOLLAR"
  />
  <Asn 
   Name="Google Inc." 
   Number="AS15169"
  />
  <TZ 
   Code="America/Los_Angeles" 
   Offset="-28800" OffsetRnd="-8" 
   CurrentEpoch="1451556331" 
   CurrentEpochGMT="82" 
   CurrentDate="Thu Dec 31 11:05:31 2015" 
   ShortName="PST" isDST="0"
  />
  <NearestStation 
   Code="PAE" 
   Type="A" 
   Name="Snohomish Cty Arpt" 
   City="Everett" 
   Distance="2"
  />
  <NearestAirport 
   Code="LKE" 
   Type="A" 
   Name="Lake Union Seaplane Base" 
   City="Seattle" 
   Distance="14"
  />
 </Response>
</Status>

Search location by a argument

Search location by a string, this could be any meaning, a city, code or country name to be matched

Sample: http://rest.coolgeo.org/xml.cgi?search=location&value=Juneau

Return example for search=location, value=Juneau

<Status>
 <ResponseArray>
  <Response>
   <Count>1</Count>
   <Code>JNU</Code>
   <Type>A</Type>
   <Name>Juneau Arpt</Name>
   <CityCode>JNU</CityCode>
   <CityName>Juneau</CityName>
   <CountryCode>US</CountryCode>
   <CountryName>UNITED STATES</CountryName>
   <StateCode>AK</StateCode>
   <StateName>ALASKA</StateName>
   <Latitude>+058.3590</Latitude>
   <Longitude>-134.5652</Longitude>
  </Response>
  <Response>
   <Count>2</Count>
   <Code>JNU</Code>
   <Type>C</Type>
   <Name>Juneau</Name>
   <CityCode>JNU</CityCode>
   <CityName>Juneau</CityName>
   <CountryCode>US</CountryCode>
   <CountryName>UNITED STATES</CountryName>
   <StateCode>AK</StateCode>
   <StateName>ALASKA</StateName>
   <Latitude>+058.3000</Latitude>
   <Longitude>-134.4056</Longitude>
  </Response>
  <Response>
   <Count>3</Count>
   <Code>UNC</Code>
   <Type>A</Type>
   <Name>Dodge County Airport</Name>
   <CityCode>UNU</CityCode>
   <CityName>Juneau</CityName>
   <CountryCode>US</CountryCode>
   <CountryName>UNITED STATES</CountryName>
   <StateCode>WI</StateCode>
   <Latitude>+058.3000</Latitude>
   <Longitude>-134.4167</Longitude>
  </Response>
 </ResponseArray>
<Search Mode="location" Value="Juneau" Found="3"/>
</Status>

Search station details by code

Show details by Code and return data such as lat, lon, name details, currency, time and others.

Sample: http://rest.coolgeo.org/xml.cgi?show=location&value=syd&type=c

Return example for show=location, value=syd (Sydney) and type=c (Ciity Code)

<Response 
 Code="SYD" 
 Type="C" 
 Name="Sydney" 
 CityCode="SYD" 
 CityName="Sydney" 
 StateCode="NS" 
 StateName="New South Wales" 
 CountryCode="AU" 
 CountryName="AUSTRALIA" 
 ContinentCode="OC" 
 ContinentName="Oceania" 
 Longitude="+151.2062" 
 Latitude="-033.8705" 
 TZCode="AEDT" 
 TZName="Australia/Sydney" 
 Offset="39600" 
 OffsetRnd="+11" 
 CurrentEpoch="0000000000" 
 CurrentDate="DDD MMM DD HH:MM:SS YYYY" 
 isDST="1" 
 CurrencyCode="AUD" 
 CurrencyName="Australian Dollar"
/>

Search location details by latitude and longitude

Show details by latitude and longitude is about to return data such as the nearest city, airport, localtime and others.

Sample: http://rest.coolgeo.org/xml.cgi?show=geo&latitude=+37.78848&longitude=-122.3750

Return example for show=geo, latitude=+37.7884, longitude=-122.3750

<Status>
 <Response>
  <TZ 
   Code="America/Los_Angeles" 
   Offset="-28800" OffsetRnd="-8" 
   CurrentEpoch="0000000000" 
   CurrentEpochGMT="0000000000" 
   CurrentDate="DDD MMM DD HH:MM:SS YYYY" 
   CurrentDateGMT="DDD MMM DD HH:MM:SS YYYY" 
   ShortName="PST" 
   isDST="0"
  />
  <NearestStation 
   Code="SFO" 
   Type="C" 
   Name="San Francisco" 
   City="San Francisco" 
   Distance="2" 
   CountryCode="US" 
   CountryName="UNITED STATES"
  />
  <NearestAirport 
   Code="OAK" 
   Type="A" 
   Name="Metro Oakland Intl Arpt" 
   City="Oakland" 
   Distance="16" 
   CountryCode="US" 
   CountryName="UNITED STATES"
  />
 </Response>
</Status>

List of Station Codes

IATA Codes are used for station data, please get more information here

  • A = Airport
  • B = Bus Station
  • C = City
  • G = Ground Data
  • H = Heli Port
  • R = Railway Station