MSCX.tech - Location Scoring API
  • HOME
  • ABOUT
  • API
  • FAQ
  • CONTACT

Our APIs

Parameter Value
lat valid latitude
lon valid longitude
radius radius of comparison area around center
ordered_amenities
PUBLIC_TRANSPORT
SUPERMARKET
PARK
RESTAURANT
PUB
GYM
SCHOOL
BANK
HOSPITAL
SHOP_CONVENIENCE
CINEMA
AIRPORT
CAFE
DOCTOR
SPORTS_CENTER
ATM

Example URL for GET Request :
http://mscx.tech/api/score?radius=7&lat=52.35346&lon=4.90676&ordered_amenities=PUBLIC_TRANSPORT-RESTAURANT

Response :
39.41

Please note that changing the order of amenities in the ordered_amenities argument will change the score.

POST Request body :
A Json file containing the following information :
Variable Value
ordered_amenities list of amenities to be used for scoring
places list of locations to score, with (id,lat,lon)
radius the radius of the area used for relative scoring

Example Json in POST request body
 
{
  "ordered_amenities":["PUBLIC_TRANSPORT","RESTAURANT"],
  "places":[{"id":"0","lat":51.43263223681922,"lon":-0.005466099989483109},
            {"id":"1","lat":51.58025778428974,"lon":-0.11300525589330457},
            {"id":"2","lat":51.6166425360316,"lon":-0.27514267031036654}],
  "radius":25.0
} 

URL for POST Request :
http://mscx.tech/api/score_bulk

An example request in python is given below :

import requests

headers = {'Content-Type':'application/json'}

rest_url = "http://mscx.tech/api/score_bulk"

data = """{
  "ordered_amenities":["PUBLIC_TRANSPORT","RESTAURANT"],
  "places":[{"id":"0","lat":51.43263223681922,"lon":-0.005466099989483109},
            {"id":"1","lat":51.58025778428974,"lon":-0.11300525589330457},
            {"id":"2","lat":51.6166425360316,"lon":-0.27514267031036654}],
  "radius":25.0
}"""

r = requests.post(rest_url,data=data,headers=headers)

                                        
Response :
A Json file containing the following information :
Variable Value
placesWithScore list of input places and their score (score,id,lat,lon)

The result of the POST request is given below:

  {
    "placesWithScore":[{"score":26.0,"id":"0","lat":51.43263223681922,"lon":-0.005466099989483109},
                        {"score":29.25,"id":"1","lat":51.58025778428974,"lon":-0.11300525589330457},
                        {"score":16.07,"id":"2","lat":51.6166425360316,"lon":-0.27514267031036654}]
  }

Please note that changing the order of amenities in the ordered_amenities argument will change the peaks returned.