Commit b516e83c authored by Jean-Benoist Leger's avatar Jean-Benoist Leger

negative (lon,lat) bug

int perl, int=floor only for positive numbers
parent cbb00510
......@@ -2,6 +2,22 @@
DROP FUNCTION IF EXISTS get_height(FLOAT,FLOAT);
CREATE OR REPLACE FUNCTION get_height(FLOAT,FLOAT) RETURNS FLOAT AS $$
sub floor
{
my ($value) = @_;
if($value>0)
{
return(int($value));
}
if(int($value)==$value)
{
return($value);
}
return(int($value)-1);
}
sub get_grid
{
my ($lon_s,$lat_s) = @_;
......@@ -49,8 +65,8 @@ CREATE OR REPLACE FUNCTION get_height(FLOAT,FLOAT) RETURNS FLOAT AS $$
my ($lon,$lat) = @_;
my $lon_s_0 = int($lon*1200)*3;
my $lat_s_0 = int($lat*1200)*3;
my $lon_s_0 = floor($lon*1200)*3;
my $lat_s_0 = floor($lat*1200)*3;
my $lon_s_1 = $lon_s_0 + 3;
my $lat_s_1 = $lat_s_0 + 3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment