Saturday 23 November 2013

Adding a router on Libremap.

To add a router with libremap, it is as simple as :

curl -X POST -d @router.json http://admin:admin@127.0.0.1:5984/mapit/_design/libremap-api/_rewrite/router

@router.json is the document containing the router details.  A sample can be found here,

https://github.com/libremap/libremap-api/blob/master/doc-api-router.md#json-example

_/router , is the api command to add a new router.

If this is successful, the router should be seen on the map. Unfortunately i was not able to see anything on the map. I kept trying for hours no avail. Then i communicated with the author Andre, who advised me to check some procedures and among those was to make sure i follow the browser url communication on developer tools. So this is what i found out :


I noticed that the browser request wasn't getting through.

Finally i actually had hope, because i saw a problem that could be fixed ! So i checked the console view and saw this on the image :


Upon "googling" this error, i found the solution by enabling COR, at couchdb's local.ini file et VOILA !



So that is the view of what a router looks like on the map. After so much relieve, i decided to add a few more which resulted in :



I tried to create links between them, which resulted to no changes on the map. I am probably missing something or the feature hasn't been done yet. Also the right side options functionality of the webui is still in development. 

No comments:

Post a Comment