Hi all,
public function enqueueStatus($status) {
$tweet_object = json_decode($status);
var_dump($tweet_object);
}
After successful run of code, when get $status in above function. How to check that $status came against from which location?
Simply I want to get location value with $status
like
this $status came against "-122.75, 36.8, -121.75, 37.8"
$stream->setLocations(array(
array(-122.75, 36.8, -121.75, 37.8), // San Francisco
array(-74, 40, -73, 41), // New York
));See on github https://github.com/fennb/phirehose/pull/1#issuecomment-16572459
--
---
You received this message because you are subscribed to the Google Groups "Phirehose Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phirehose-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
$stream->setLocations(array(
array(-178.214203, 18.536892, -48.466812,71.406647), // United States
array(-8.164723, 49.955269, 1.7425, 60.6311) // United Kingdom
)); public function enqueueStatus($status) {
$tweet_object = json_decode($status);
$bounding_box = $tweet_object->boundingbox;
$tweet = $tweet_object->tweet;
}<?php$lat = '62.94900';$lng = '-149.34100';$bounding_boxes = array(array('-8.164723, 49.955269, 1.7425, 60.6311','UK'),array('-178.214203, 18.536892, -48.466812, 71.406647','US'));function check_lat_lng_in_boundingBox( $bounding_boxes, $lat, $lng ) {$result = '';foreach ($bounding_boxes as $bounding_box) {$bB = $bounding_box[0];$bBArea = $bounding_box[1];$bB_parts = explode(',', $bB);//extract long bounding parts$west_long = $bB_parts[0];$east_long = $bB_parts[2];$cmp_long = ($west_long > $east_long) ? 'to':'from';$exists = array();//check longitude exists or not in long bounding partsif ($cmp_long == 'to') {if ( $lng > $east_long && $lng < $west_long ) {$exists['long'] = 'yes';}else {$exists['long'] = 'no';}}else {if ( $lng > $west_long && $lng < $east_long ) {$exists['long'] = 'yes';}else {$exists['long'] = 'no';}}//extract lat bounding parts$north_lat = $bB_parts[1];$south_lat = $bB_parts[3];$cmp_long = ($north_lat > $south_lat) ? 'to':'from';//check latitude exists or not in lat bounding partsif ($cmp_long == 'to') {if ( $lat > $south_lat && $lat < $north_lat ) {$exists['lat'] = 'yes';}else {$exists['lat'] = 'no';}}else {if ( $lat > $north_lat && $lat < $south_lat ) {$exists['lat'] = 'yes';}else {$exists['lat'] = 'no';}}if ( $exists['long'] == 'yes' && $exists['lat'] == 'yes' ) {$result = $bounding_box;break;}else {continue;}}//end foreachif ($result == '') {return 'out of range';}else {return $result;}}var_dump(check_lat_lng_in_boundingBox( $bounding_boxes, $lat, $lng ));//result/*array (size=2) 0 => string '-178.214203, 18.536892, -48.466812, 71.406647' (length=45) 1 => string 'US' (length=2)*/