Subject: | negative latitude and longitude are buggy |
° mandriva linux 2010.1 spring 64 bits
°Linux amfou 2.6.33.6 #1 SMP PREEMPT Tue Jul 6 09:58:46 CEST 2010 x86_64
x86_64 x86_64 GNU/Linux
°perl 5.10.1 (64 bits)
° Ov2 0.91
Bug description :
Latitude and longitude can be negative values, but they are get/set via
pack/unpack
with V (unsigned 32 bit value) instead l (signed 32 bit value).
I have changed all 'V' in pack/unpack by 'l' and it now works.
BEFORE :
type: 2; longitude: 42940.483520; latitude: 38.463510; description:
Campimeco *** - Sesimbra
type: 2; longitude: 42940.497720; latitude: 38.468080; description:
Fetais - Sesimbra
type: 2; longitude: 42940.556160; latitude: 38.435800; description:
Forte do Cavalo ** - Sesimbra
type: 2; longitude: 42940.576710; latitude: 38.490610; description:
Valbom *** - Sesimbra
type: 2; longitude: 42940.585510; latitude: 38.471910; description: Ma��
* - Sesimbra
type: 2; longitude: 42940.669970; latitude: 38.494740; description:
Picheleiros * - Setubal
AFTER :
type: 2; longitude: -9.189440; latitude: 38.463510; description:
Campimeco *** - Sesimbra
type: 2; longitude: -9.175240; latitude: 38.468080; description: Fetais
- Sesimbra
type: 2; longitude: -9.116800; latitude: 38.435800; description: Forte
do Cavalo ** - Sesimbra
type: 2; longitude: -9.096250; latitude: 38.490610; description: Valbom
*** - Sesimbra
type: 2; longitude: -9.087450; latitude: 38.471910; description: Ma�� *
- Sesimbra
type: 2; longitude: -8.769460; latitude: 38.204330; description: Praia
de Gal� *** - Melides
type: 2; longitude: -8.515830; latitude: 38.380280; description:
Municipal ** - Alcacer do Sol (16/01-14/12)
type: 2; longitude: -8.103700; latitude: 38.183820; description:
Mark�dia - Odivelas
type: 2; longitude: -9.165430; latitude: 38.514270; description:
Hort�nsias ** - Sesimba
type: 2; longitude: -9.164720; latitude: 38.509170; description: O
Repouso - Sesimba
type: 2; longitude: -9.163270; latitude: 38.515070; description: Lagoa
** - Sesimba
type: 2; longitude: -9.071670; latitude: 38.550560; description: Parque
Verde *** - Quinta do Conde --WiFi--
type: 2; longitude: -9.002990; latitude: 38.494740; description:
Picheleiros * - Setubal
Thanks for your work, it will permits me to filter numerous ov2 files.
Alexandre
Subject: | Ov2.diff |
173c173
< $data = pack "CVVVVV", $type, $size, $longitude, $latitude,
---
> $data = pack "Clllll", $type, $size, $longitude, $latitude,
177c177
< $data = pack "CVVV", $type, 13 + lenght $description, $latitude,
---
> $data = pack "Clll", $type, 13 + lenght $description, $latitude,
182,183c182,183
< $data = $data . substr( pack( "V", $longitude ), 1 );
< $data = $data . substr( pack( "V", $latitude ), 1 );
---
> $data = $data . substr( pack( "l", $longitude ), 1 );
> $data = $data . substr( pack( "l", $latitude ), 1 );
187,188c187,188
< $data = $data . substr( pack( "V", $longitude ), 1 );
< $data = $data . substr( pack( "V", $latitude ), 1 );
---
> $data = $data . substr( pack( "l", $longitude ), 1 );
> $data = $data . substr( pack( "l", $latitude ), 1 );
193,194c193,194
< $data = $data . substr( pack( "V", $longitude ), 1 );
< $data = $data . substr( pack( "V", $latitude ), 1 );
---
> $data = $data . substr( pack( "l", $longitude ), 1 );
> $data = $data . substr( pack( "l", $latitude ), 1 );
207,208c207,208
< $data = $data . substr( pack( "V", $longitude ), 1 );
< $data = $data . substr( pack( "V", $latitude ), 1 );
---
> $data = $data . substr( pack( "l", $longitude ), 1 );
> $data = $data . substr( pack( "l", $latitude ), 1 );
245c245
< unpack "VVVVV", $buff;
---
> unpack "lllll", $buff;
259c259
< my $size = unpack "V", $buff;
---
> my $size = unpack "l", $buff;
263c263
< my ( $longitude, $latitude ) = unpack "VV", $buff;
---
> my ( $longitude, $latitude ) = unpack "ll", $buff;
284c284
< my ( $longitude, $latitude ) = unpack "VV", $tmp;
---
> my ( $longitude, $latitude ) = unpack "ll", $tmp;
300c300
< my ( $longitude, $latitude ) = unpack "VV", $buff;
---
> my ( $longitude, $latitude ) = unpack "ll", $buff;
320c320
< my ( $longitude, $latitude ) = unpack "VV", $buff;
---
> my ( $longitude, $latitude ) = unpack "ll", $buff;
352c352
< my ( $longitude, $latitude ) = unpack "VV", $buff;
---
> my ( $longitude, $latitude ) = unpack "ll", $buff;
457c457
< $data = pack( "CVVVVV", 1, $size, $longitude, $latitude, $longitude2, $latitude2 ) if $atleastone;
---
> $data = pack( "Clllll", 1, $size, $longitude, $latitude, $longitude2, $latitude2 ) if $atleastone;