On 08/02/16 16:48, Tyler Smith wrote:
On Sun, Feb 7, 2016, at 05:17 PM, Markus Neteler wrote:
On Fri, Feb 5, 2016 at 8:08 PM, Tyler Smith <[email protected]> wrote:

How can I plot geographic grids as smooth curves with ps.map?

What about using v.mkgrid and then reprojection it using vertex
densification as provided by v.proj?


Thanks Markus,

That sounds reasonable. However, based on your and Alex's comments, I
did some digging into ps.map. It appears the resolution of grid lines is
hardcoded to use 10 vertices across the length of each grid line, via:

   #define SEGS 10

in do_geogrid.c. I changed this to 100 and recompiled, and now I have
nice smooth grids. This suggests that perhaps a permanent fix would be
to replace the SEGS macro with an additional argument to the geogrid
command in the ps.map instruction set. That way users could tune the
value to suit the map they are preparing. Alternatively, some more
sophisticated calculation could be used to determine the number of
segments. Or it could just be set to a sufficiently high number.

I can look into one or more of these options if it sounds generally
useful; I don't yet understand how the ps.map arguments are parsed, but
it looks to be within my capabilities to make the change.


Try attached diff as a starting point. Certainly needs some more clean-up and inclusion in the documentation in ps.map.html.

Moritz
Index: ps/ps.map/do_geogrid.c
===================================================================
--- ps/ps.map/do_geogrid.c	(révision 67702)
+++ ps/ps.map/do_geogrid.c	(copie de travail)
@@ -20,7 +20,7 @@
 #define CENTER 2
 
 /* number of segments in curved geographic lines */
-#define SEGS 10
+#define SEGS PS.segments
 
 static void init_proj(struct pj_info *, struct pj_info *);
 static void get_ll_bounds(double *, double *, double *, double *);
Index: ps/ps.map/getgrid.c
===================================================================
--- ps/ps.map/getgrid.c	(révision 67702)
+++ ps/ps.map/getgrid.c	(copie de travail)
@@ -225,6 +225,12 @@
 	    PS.geogrid_font = G_store(data);
 	    continue;
 	}
+
+	if (KEY("segments")) {
+	    PS.segments = atoi(data);
+	    continue;
+	}
+
 	if (KEY("width")) {
 	    PS.geogrid_width = -1.;
 	    ch = ' ';
Index: ps/ps.map/ps_info.h
===================================================================
--- ps/ps.map/ps_info.h	(révision 67702)
+++ ps/ps.map/ps_info.h	(copie de travail)
@@ -36,6 +36,7 @@
     char celltitle[100];
     int level;
     int grey;
+    int segments;
     int mask_needed;
     int do_header;
     int do_raster;
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to