vendredi 2 octobre 2015

Lumen/Laravel raw postgis query

I want to make little service with json output in Lumen.

When I run raw postgis query

$parcells = DB::table('parcells')
    ->select(DB::raw('ST_AsGeoJSON(wkb_geometry)::json as geometry, nr' ))
    ->where('nr', '=', $id)
    ->orderBy('id', 'asc')
    ->get();

json_encode($parcells) 

I get array of objects with geometry attribute which contain string (its need to be parsed to be valid json object).

Is there way to get those values as json object?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire