Split toGeoJSON into 2 functions

Splits toGeoJSON into 1 function to build the array, another to encode.

This means you can get the array to push into another GeoJSON array
before encoding, and avoid decoding just to re-encode.