The following link is a sample API request that finds the single-location businesses near a location in Portland, Oregon (specified as latitude 45.478 and longitude -122.697). Simply click this link to try it. The Firefox browser displays the JSON-formatted response in rows and columns of information.
https://www.newsherenow.com/cgi-bin/web_api.cgi?key=tryit&lat=45.478&lon=-122.697
For an example with a different location, here is a location in London.
Details about the input values and output values are explained in the tables below.
Here are some clarifications:
This web API is completely free to use, which means there is no cost. This status might change because the News Here Now system is available to be acquired, and the acquiring organization might choose to charge for access.
Input value |
Description |
---|---|
key |
A web key, which serves as both an access ID and a password. A sample public key is revealed in the links above. You can use it to try this web API service. This sample public key is likely to change if a DOS (denial of service) attack occurs, or if this key becomes heavily used by one user. For an unchanging key, please contact the News Here Now website administrator. The News Here Now system is available for acquisition, so access to this web API is likely to change when the News Here Now system is acquired. |
lat |
The latitude. See lon for details. |
lon |
The longitude. The latitude and longitude are supplied as input values to specify where to find the nearest intersection. The supplied latitude or longitude can be a positive or negative decimal value. The decimal point is not required if an integer number of degrees is being specified. The supplied latitude and longitude does not need to be a user's exact location. For example it could be determined when a user clicks on a map image. And the numbers can be rounded to increase privacy. You are responsible for any privacy invasion that can occur from revealing an exact location. The server does not use this location for any purpose other than finding the nearest intersection. |
Output value |
Description |
---|---|
msg |
A message in response to the request. The value is success if the API request is successful. Other messages indicate an error. Possible errors include: intersection_not_found, no_businesses_found, unrecognized_request, and time_limit_exceeded |
street_name_1 |
The name of one of the streets that intersect at the found intersection. |
street_name_2 |
The name of the other (second) street that intersects at the found intersection. |
lat |
The latitude of the nearest intersection. The distances to the businesses are based on the intersection latitude and longitude, not the supplied latitude and longitude. This “snapping” to the nearest intersection and using the intersection location to calculate distances slightly increases privacy. Specifically it decreases the ability of a criminal or military to target a user at an exact location. |
lon |
The longitude of the intersection. See the description of the output lat value for details. |
businesses |
The name of the array that holds the data for the businesses that were found. Indexing of the array is specified by the JSON format, so index numbers start at zero. |
bizname |
The name of the business. |
biztype |
The type of business. The values include restaurant, cafe, bakery, deli, tea_shop, biergarten, bookstore, and hardware. If all the types are located nearby, the listed businesses include at least one of each type. |
km_times_100 |
The approximate distance between the business and the specified intersection. Using the nearest intersection as the center point prevents spyware from calculating the supplied latitude and longitude, which in some cases can be the user's actual location. The units are kilometers times 100, which means a value of 250 is 2.5 kilometers. |
website |
The domain name of the website of the business, if it is specified in the Open Street Map data. If the Open Street Map data specifies a domain name that is shared by other businesses, that shared domain name disqualifies the business as a single-location business. This convention makes it easy to block chain businesses, which typically share the same domain name for multiple locations. If the website specified in Open Street Map data is a Facebook page, Twitter account, or TikTok account, those “websites” are not used because those webpages use domain names (such as facebook.com, twitter.com, and tiktok.com) that are shared by many businesses. |
tagline |
An optional tagline supplied by the business. This tagline can change at any time, such as to announce a restaurant's daily soup, a special price, or the time when fresh croussants come out of a bakery's oven. This tagline is supplied to News Here Now. It is not in the Open Street Map data, which seldom changes. |
lat9 |
The latitude of a business expressed in a special “nines complement” format. This format is used for faster processing of latitudes and longitudes. This format is always a positive integer, without any minus sign, and without a decimal point. To convert a lat9 integer back into a signed decimal number, if the first digit is 1 then remove the 1 and insert a decimal point to the left of the right-most eight digits, or else if the first digit is 0 then add a minus sign and convert each digit to its "nines complement" value. The "nines complement" conversion changes each 9 to 0, each 8 to 1, each 7 to 2, etc. down to each 2 to 7, each 1 to 8, and each 0 to 9. Using this convention causes the numbers to have smooth transitions at the equator (latitude 10000000000) and zero meridian (longitude 10000000000). Specifically the next point in the negative direction is 09999999999. Note that these conversions are text-based so they do not involve converting to or from software-based "integers". |
lon9 |
The longitude of a business expressed in the special “nines complement” format described above. |