Using elements-api, how do i create a geojson structure with Features within a FeatureCollections I am trying to output, from a single request, a geojson structure like so:

    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "type": "MultiLineString",
                "coordinates": [
                    [
                        [-1.102108, 52.671813], 
                        [-1.142189,52.620366]
                    ],
                    [
                        [-1.102108, 52.671813], 
                        [-1.447277, 52.939653]
                    ],
                    [
                        [-1.102108, 52.671813], 
                        [-1.447277, 52.914816]
                    ],
                    [
                        [-1.102108, 52.671813], 
                        [-1.884783, 52.509112]
                    ]
                ]
            }
        },
        {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "type": "MultiPoint",
                "coordinates": [
                    [-1.102108, 52.671813],
                    [-1.142189, 52.620366],
                    [-1.447277, 52.939653],
                    [-1.447277, 52.914816],
                    [-1.884783, 52.509112]
                ]
            }
        }            
    ]


I have the multilinestring part sorted, and i know how to get the data for the multipoint part, bit i cant find a way, from the single elements api endpoint, how to add the multipoint feature onto the end of the returned array / json.

Here is my elements api endpoint :

    'geojson' =&gt; function() {

        function getCoordinates(UserModel $user){
            $return = array();
            foreach ($user-&gt;connections as $connection) {
                $return[] = array(array($user-&gt;longitude,$user-&gt;latitude),array($connection-&gt;longitude,$connection-&gt;latitude));
            }
            return $return;
        }

        return [
            'elementType' =&gt; ElementType::User,
            'paginate' =&gt; false,
            'transformer' =&gt; function(UserModel $user) {
                return [                        
                        "type" =&gt; "Feature",
                        "geometry" =&gt; array("type" =&gt; "MultiLineString", "coordinates" =&gt; getCoordinates($user)),
                        "properties" =&gt; array("name" =&gt; "Test")
                ];
            },
        ];
    },


I know i can probably do this using two requests, but i want to do it in one.
If anyone stumbles onto this, i gave up looking for a solution and created my own plugin, to get you started, someone else with the same problem posted some sample code here that returns json from a db query : With Element API, can I combine two entry types into a JSON object, keyed by type?