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. 

Libremap Installation Ubuntu 13.04

Libremap comes with 2 main components for installation which are :


  1. Libremap-webui
  2. Libremap-api
The directives of installing libremap are pretty clear on those repositories.

So from my experience, these are all the steps, i took to make sure everything was running.

After installing couchdb and geocouch, I created a database from couchdb (also created an admin account) and named it "mapit" for example. When installing libremap-api i got to this section below :

Copy couch.json.example to couch.json and configure your CouchDB server there.

I did per the instruction and since i had to change the contents of the couch.json file, this is what i included for the "dev" section.



"dev": {

      "database": "http://localhost:5984/mapit",

      "user": "admin",
      "pass": "admin"
    }

The url is where your couchdb database is located and the passwords beneath. 


So after the setup of libremap-api, i moved to the libremap-webui phase where i followed the instructions as stated in the link provided. At step 3,

  1. Copy config.json.example to config.json and configure your LibreMap API URL there. If you don't have your own LibreMap API you can use an existing one, for example http://libremap.net/api.
Since i wanted to have my own libremap instance and use my own API url, what i did was to add my own api url inside the config.json file which is :

http://localhost:5984/mapit/_design/libremap-api/_rewrite/

Note : The url can be made shorter with vhost.

After that being done with other minor changes in the config.json file, i proceeded to also create the couch.json file which i added the database url as i did before with the libremap-api couch.json file. (I mention only the file changing steps, other steps such as "grunt push --couch dev" should not be skipped)

Et voila ! Thats all, i did and the next thing was to run using grunt. Which then gave me a url to access the webui (in my case 0.0.0.0:9000) 




Installation of Apache CouchDb 1.4 and GeoCouch 1.3 on Ubuntu 13.04

There are so many ways of installing Apache CouchDB in any linux distribution. The way in which you make this installation strongly impacts the possibility of you having a successful Geocouch installation. The methods that failed were :

1. Using the a package installer like apt-get.
This will give you a working couchdb installation but, in other to install geocouch you will need the sources and even if you plan to install using the package manager, then download the source and install geocouch, it won't work (atleast not for me).

2. The second approach was to use build-couchdb. This approach didn't get me to successfully install apache couchdb alongside geocouch.

3. Since geocouch 1.3x was specifically made for apache couchdb 1.3, this was my first try. To use apache couchdb 1.3 for geocouch 1.3x which it wasn't successful.

So to wrap things up, those where the methods, that kept me stuck for a long time. After further reading of blogs with the help of the "mighty google" ! I found 2 blogs that eased my pain. So to successfully install apache couchdb from source alongside geocouch, use :

1.  This link for apache couchdb installation"
https://www.digitalocean.com/community/articles/how-to-install-couchdb-from-source-on-an-ubuntu-13-04-x64-vps
Note that you will need apache couchdb 1.4, or anyother version that is compatible with the version of geocouch you plan to use. In my case, Apache Couchdb 1.4 & Geocouch 1.3.x.

2.  This link to install geocouch.
http://www.blmak.com/blog/?p=414



NB: INSTALL THE DEPENDENCIES PROVIDED ON ALL SITES LISTED.