Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

min / max for lat long values #570

Merged
merged 5 commits into from
Feb 23, 2016
Merged

min / max for lat long values #570

merged 5 commits into from
Feb 23, 2016

Conversation

ShortlyMAB
Copy link
Contributor

Sometimes you may want to set lat/lng parameters for a spesific area.

Ex:
For Istanbul:
'lat' => $faker->latitude(40.958836, 41.136456),
'lng' => $faker->longitude(28.64, 29.98),

Sometimes you may want to set lat/lng parameters for a spesific area. 

Ex: 
For Istanbul:
'lat' => $faker->latitude(40.958836, 41.136456),
'lng' => $faker->longitude(28.64, 29.98),
@ShortlyMAB ShortlyMAB closed this May 4, 2015
@ShortlyMAB ShortlyMAB reopened this May 4, 2015
* @example 77.147489
* @return float Uses signed degrees format (returns a float number between -90 and 90)
* @example '77.147489'
* @param int $min
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a float, not an int, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing that, Phpstorm decided it, not me :)

@fzaninotto
Copy link
Owner

Please also update the README to add an example with the new parameter

{
return static::randomFloat(6, 0, 180) - 90;
return floatval(number_format(mt_rand($min * 1000000, $max * 1000000)/1000000, 6));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the interest of converting a float to string (with number_format) and then back to float (with floatval)

@fzaninotto
Copy link
Owner

Tests fail

@fzaninotto
Copy link
Owner

Also, please see #416 for why you should use randomFloat()

@ikwattro
Copy link
Contributor

@fzaninotto @actuallymab Any update on this PR?. we are really interested in this feature

@ShortlyMAB
Copy link
Contributor Author

don't know.. @fzaninotto ok with this?

* @return float Uses signed degrees format (returns a float number between -90 and 90)
*/
public static function latitude()
public static function latitude($min = -90, $max = 90)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're changing the results of existing calls. Please use 0 and 180 as min and max values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He isn't. Look again.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, you're right.

fzaninotto added a commit that referenced this pull request Feb 23, 2016
min / max for lat long values
@fzaninotto fzaninotto merged commit 0b81c70 into fzaninotto:master Feb 23, 2016
@fzaninotto
Copy link
Owner

Thanks

fzaninotto added a commit that referenced this pull request Feb 23, 2016
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants