Migrating from Bzr to Git (Single branch)

We migrated the ChaloBEST Repository from bzr to git. While migration is not a rocket science any more and there are a lot of blogs and threads about this. This post is a simple step as how to and also as self note.

Step 1. Branch out your bzr repo.

<code> $ bzr branch "url to your bzr repo"</code>

Step 2.cd into your new branch and do the following

<code> $ git init </code>
<code> $ git remote add origin "url to git report" </code>
<code> $ bzr fast-export `something`|git fast-import</code>

Step 3. In case your original git repo is not empty, please do a

<code> $ git pull </code>

Step 4.  Now do a

<code>$ git reset --hard  HEAD</code>

Step 5. Now commit the changes using

<code> $git commit -m "some message"</code>

Step 6.  Push the changes

<code> $git push </code>

Here are some links that helps out with migrating both branches and master.

API parsing with Backbone.js

The next part of the self note series, this time I have to parse JSON using backbone.js.
So in order to parse an API that returns result in JSON you can do the following(not necessarily the best way but it works for me)

(function($) {
var API_BASE = 'your url here';

var parser = Backbone.Model.extend({});

var apiColl = Backbone.Collection.extend({
model: parser,
url: 'form your url here'

});
var apiView = Backbone.View.extend({
el: $('#collection'),
initialize: function() {
_.bindAll(this, "render");
this.collection.bind("all", this.count);

},
render: function() {
$(this.el).html(this.counter = this.collection.length);
return this;

}
}),
events = new apiColl(),
eventView = new apiView({

collection: events

});
events.fetch({
success: function() {
console.log(events.length);
}
});
})(jQuery);

and yes, my ultimate target will be to parse the API and integrate with some open maps.

Even though Backbone’s code is pretty well explained, the main help if stuck comes from stack overflow. So really appreciate the help that I got.

Ouch! My Bad

JavaScript is powerful and Backbone.js is a nice small utility that makes it even more powerful. I was playing with Backbone and Open layers thrown over a Django system.
However there is something weird that I faced and took a good amount of my time to figure out the problem.
This blog post is kind of self note so that I notice this the first place when I face such problem again.

What was I trying to do : Write a small backbone code to display Open layers(OSM) Map.
How was I trying to do :

(function($) {
var Map = Backbone.Model.extend({});

var MapView = Backbone.View.extend({

initialize: function() {
_.bindAll(this, 'initMap');
this.initMap();
},

initMap: function() {
// Initialize Basic Openlayers;
var center = new OpenLayers.LonLat(8110203.9998955, 2170000.4068373);
map = new OpenLayers.Map(this.el, {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
var layers = [];
layers[0] = new OpenLayers.Layer.OSM(); //some more layer will go here
map.addLayers(layers);
map.setCenter(center, 12);

}
});
var map_view = new MapView({ el: $("#mapCol") });
})(jQuery);

The problem faced here was I am trying to access the DOM element even before it is ready.
Result : A webpage which shows the HTML elements, shows some access to Openlayers but no map.

Solution : I modified my code to this

(function($) {
var Map = Backbone.Model.extend({});

var MapView = Backbone.View.extend({
el: '#mapCol',

initialize: function() {
_.bindAll(this, 'initMap');
this.initMap();

},

initMap: function() {
// Initialize Basic Openlayers;
var center = new OpenLayers.LonLat(8110203.9998955, 2170000.4068373);
//alert("you are here");
map = new OpenLayers.Map(this.el, {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});

var layers = [];
layers[0] = new OpenLayers.Layer.OSM(); //some more layer will go here
//$(this.el).html(map);
map.addLayers(layers);
map.setCenter(center, 12);

}
});
$(function() {
var map_view = new MapView();

});
})(jQuery);

Here mapCol is the div element where I want my Openlayers map to be displayed. For more details on Backbone and el, there is a beautiful blog post here.

P.S : There may be certain errors in the codes above. please feel free to correct me anytime.

Post Ranathambore et.al.

My last post was on my first wildlife trip to Ranathambhore. Well it was an amazing trip, I did so many things that I never imagined to have done before.

Nevertheless I got hooked to wildlife photography, even leaving the photography part aside it is pretty amazing to watch wildlife at their best(in the wild).

I came back from Ranathambhore on 4th of April but I was so hooked to the whole thing going around me,I joined the same group again on a trip to Corbett national park(16th to 21st April 2011).

What I felt, the way I reacted been there remains treasure in my memory and there is no way I can explain that in a blog post. for that you have to be in Corbett.

Took some snaps which goes here :

My current action item is to create my own gear consisting 550D, Sigma 150 – 500 OS and a telephoto mic.

P.S : I manage to get GPS traces of about 700KM (in the jungle plus some rail track) in these two trips. Hope these goes to OSM soon.e

GSOC 2011/OpenStreetMap/Projects

Like every year this years mentoring organizations for Google Summer of Code 2011 has been announced and OpenStreetMap is in this years list as well.

Now as a lot of cheap phones has the capability to click pictures in high resolution,make GPS traces,shoot videos and have a internet connection via WIFI/GPRS or mobile broadband connection. I would really love to see a mobile based OSM mapping application that can utilize this facility and able to do photo tag/Video tag with GPS traces,upload to OSM/Flickr/Youtube, create and edit basic maps.

The idea by Zhijie Shen is here. So in case if you are interested in developing such an application do get in touch with the OSM community.

Apart from this you can find a lot of interesting project ideas here.

Student application for GSOC 2011 starts from March 29th.

Mapping party@ Durgapur and neighboring places (16th and 17th Oct 2009)

There has been a discussion between Indranil Das Gupta and us regarding the problem we face due to lack of GPS devices and some more mapping parties in Durgapur area.

On 16th and 17th we decided  to map  Durgapur and neighboring places. Primarily Kushal wanted to map his village and we decided to help him to map his village Ukhra and also map Durgapur . IOTA resource center at WBSU(Barasat) extended us a  helping hand by lending us three Garmin Etrex Vista H. So with the new gps’s in our hand we now had a total of 5 GPS.

On 16-OCT-2009 :We went to Ukhra on 16th to map the village.Me,Arindam,Kushal and another guy from that village joined the party. Since we had two bikes and the village was small.We completed all major roads and even some narrowest living streets within  an hour.

Here is how Ukhra looks like now as compared a complete blank previously.

On 17th Oct 2009 : A resource person from WBSU was suppose to come during the event but he didn’t make it though .So We started around 1 Pm. I was a little late but Arindam,Harsh,Sonu,Ratnadeep and Bama started.

start

start2

Ratnadeep and Bama became the local team.They mapped Fuljhore (where they live) along with neighboring areas.While the rest of the team went on cycling covering edges of Bidhanagar area.

way1

way2

I met them in Muchipara and on my way I mapped some of the important point of interest.

IMG_0728 2

I had the etrex H GPS devices, so distributed them and we split into individual teams.

IMG_0730 2

I had a Moped while rest were in cycles.I tried and mapped some far away place like PCBL,Durgapur Bazaar etc. Arindam and rest took charge of mapping the area with details. Sonu knew the place very well and helped us a lot with that.My GPS clocked 34.4 KM after more than an hour of mapping. Our meeting point was BCET gate.

IMG_0736 2

We met and decided to head over for some food as day long traveling was taking toll on us. We accumulated the total distance covered which was something around 100KM’s. Bama requested us to take a GPS to map his city in Bankura so we lent one of ours. So some good  amount of data was accumulated  during the session. Since it was a festival day we decided not to do a editing session and it was dark already. Me and Arindam took care of the edits which will keeping pouring  during the weekends.

Here’s some of what has been done.

Durgapur before edits :

map

And here is durgapur after basic edits of 17102009 data

map(4)

Here are some pics of Edit in progress.

josm_edit_in_prog

Another Edit in Progress screenshot:

eip

There will be a follow up post soon as edits are done.