Opened 19 years ago

#1313 new defect

writeFeature() loses decimal values

Reported by: v@… Owned by: sdlime
Priority: high Milestone:
Component: MapScript Version: 4.4
Severity: normal Keywords:
Cc:

Description

One app I'm writing adds features to a map dynamically through mapscript and 
an applet. Then, I save the map in a mapfile to reconstruct previous state 
from it instead of retreiving the data again. 

Some of the features need to be very precise, such as this one:

        300935.6247 6176585.1835
        300935.6277 6176585.1627
        300935.6574 6176585.1657
        300935.6455 6176585.1865
        300935.6247 6176585.1835

Current writeFeature() loses the decimals, so the features disappear from the 
map especially when they're polygons, because they get written as
        
        300935 6.17658e+06
        300935 6.17658e+06
        300935 6.17658e+06
        300935 6.17658e+06
        300935 6.17658e+06

becoming a polygon with only one point!

I think writing the features with decimals can't hurt, and probably will help 
many, just changing line 653 (in 4.4.2) from

     fprintf(stream, "        %g %g\n", shape->line[i].point[j].x, shape->line
[i].point[j].y);

to

     fprintf(stream, "        %.4f %.4f\n", shape->line[i].point[j].x, shape-
>line[i].point[j].y);

The points are already stored as doubles, so I can't see the use of losing the 
stored precision when saving the state to a mapfile.

Change History (0)

Note: See TracTickets for help on using tickets.