You are here: Home / Updates / How to use Sinar Mapit instance

How to use Sinar Mapit instance

Brief introductory entry to show how to use Sinar MapIt software instance

Details

MapIt is a system that we use with our version of FixMyStreet to identify the locality of coordinate. MapIt itself is not a map system, but it can provide information/data to build a map. It is a system developed by MySociety but is adopted by us for local use. You can find the source code at https://github.com/mysociety/mapit, we did not change much from upstream, just change the data. Our own instance is hosted at http://mapit.sinarproject.org
It currently has 38 areas, an Area is essentially generic area, this includes country, states, local councils. MapIt also supports query with postcode, But we do not have the geo graphical information for it. 
To use the service, you essentially do a HTTP Get request to the URL of the mapit instance. Below are examples of the types of queries you can do.
To get all Zone

import requests
r = requests.get("http://mapit.sinarproject.org/areas/ZON")
json.loads(r.content)
To get State, City, Country and misc Area uses the same API, but with the following URI instead:

To get detail of a specific area

r = requests.get("http://mapit.sinarproject.org/area/60")
You can get geojson version of an area with. With geojson you can integrate with many other GIS software, by sharing shapes with other data.

r = requests.get("http://mapit.sinarproject.org/area/60.geojson") 
Finding specific administrative body a point belongs to

Instead of find a specific area, you can query using coordinate. for example in coordinate 3.078127,101.587008. You can something like below. Now that it is actually longitude, latitude

r = requests.get("http://mapit.sinarproject.org/point/4326/101.587008,3.078127")
If you want a human friendly page for the quest. Essentially you can just add .html at the end of the URI. 
MapIt can also query by postcodes, but unfortunately we do not have the geographical information for postcodes in Malaysia, therefore we do not support it on our instance. We also did not cover all area in Malaysia due to not enough data received. Also if you have played around with the data, you will noticed that there is some bad data. We will clean it up as we go alone. 
If you folks want to help out with that we welcome you to do so.  You can do this by doing the following: 

  • Share with us shape files, administrative boundaries etc. and also make sure it's legally unencumbered eg. government (public domain), or contributed under permissive BSD like license such as Creative Commons by Attribution (link)
  • If you prefer to share on Github it is fine too. Just email the github link to the address above.

Source:

Story Type: Update

Document Actions

Filed under: , ,