Skip to content

Commit

Permalink
v.out.vtk: Output double data type instead of float (OSGeo#2562)
Browse files Browse the repository at this point in the history
Geometric information in the VTK Polydata dataset output of the v.out.vtk function are now saved as datatype double instead of float which is more suitable considering the amount of digits in geographic coordinates.

The 'POINTS n dataType' line now uses double dataType (float, double, int and more is allowed).

Fixes OSGeo#864.

Actual code change written by Brad ReDacted.

Co-authored-by: Brad ReDacted <brad.redacted@outlook.com>
  • Loading branch information
2 people authored and ninsbl committed Feb 17, 2023
1 parent 92a0288 commit 907faf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions vector/v.out.vtk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ int main(int argc, char *argv[])
dp_opt->key = "precision";
dp_opt->type = TYPE_INTEGER;
dp_opt->required = NO;
dp_opt->description =
_("Number of significant digits (floating point only)");
dp_opt->description = _("Number of significant digits");

scale = G_define_option();
scale->key = "zscale";
Expand Down Expand Up @@ -151,8 +150,8 @@ int main(int argc, char *argv[])
if (dp_opt->answer) {
if (sscanf(dp_opt->answer, "%d", &dp) != 1)
G_fatal_error(_("Failed to interpret 'dp' parameter as an integer"));
if (dp > 8 || dp < 0)
G_fatal_error(_("dp has to be from 0 to 8"));
if (dp > 16 || dp < 0)
G_fatal_error(_("dp has to be from 0 to 16"));
}
else {
dp = 8; /*This value is taken from the lib settings in G_feature_easting */
Expand Down
2 changes: 1 addition & 1 deletion vector/v.out.vtk/writeVTK.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int write_vtk_points(FILE * ascii, struct Map_info *Map, VTKInfo * info,

/************************************************/

fprintf(ascii, "POINTS %i float\n", info->maxnumpoints);
fprintf(ascii, "POINTS %i double\n", info->maxnumpoints);

/*For every available vector type */
for (k = 0; k < typenum; k++) {
Expand Down

0 comments on commit 907faf9

Please sign in to comment.