Create field collection item in drupal 7
I found the problem, it was related to the workflow of content publishing (specific to my site ). Field collection item is created after a user with required permissions approve the content.

The code in question works and could be helpful for anyone else trying to create a field collection item containing a geofield.