Skip to content

Commit

Permalink
Merge pull request #104 from ushahidi/map-tweaks
Browse files Browse the repository at this point in the history
Don't return null points in GeoJSON
  • Loading branch information
rjmackay committed Oct 23, 2013
2 parents 1340df4 + 629780b commit 34eaaee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions application/classes/Controller/Api/Posts/GeoJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ protected function _post_to_feature($post)
// Point
if ($attr->type == 'point')
{
$geometries[] = array(
'type' => 'Point',
'coordinates' => array($post['values'][$geom_key]['lon'], $post['values'][$geom_key]['lat']),
);
// ensure values aren't null - in case of junk in DB
if ($post['values'][$geom_key]['lon'] != NULL
AND $post['values'][$geom_key]['lat'] != NULL)
{
$geometries[] = array(
'type' => 'Point',
'coordinates' => array($post['values'][$geom_key]['lon'], $post['values'][$geom_key]['lat']),
);
}
}
// Geometry
else
Expand Down

0 comments on commit 34eaaee

Please sign in to comment.