Hamish:
> > In doing that I noticed that the "-e" flag doesn't seem to be connected to
> > any code. Anyone know what it is supposed to do? (added in cvs
> > vector/v.in.ogr/main.c rev 1.29)
Markus:
> It should do the same as r.in.gdal:
>   -e   Extend location extents based on new dataset
> 
> To modify the DEFAULT_WIND file according to the map extent.

see attached patch. (untested)


question- earlier in the v.in.ogr code as part of the projection-override check
there is a comment:
/* G_get_window seems to be unreliable if the location has been changed */
G__get_window ( &loc_wind, "", "DEFAULT_WIND", "PERMANENT");


should we worry about that for the extend flag?


Hamish


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
? OBJ.i686-pc-linux-gnu
? v.in.ogr.tmp.html
? vio_extendflag.diff
? vio_region.diff
Index: main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/vector/v.in.ogr/main.c,v
retrieving revision 1.86
diff -u -r1.86 main.c
--- main.c	5 Nov 2007 07:14:15 -0000	1.86
+++ main.c	6 Nov 2007 00:47:55 -0000
@@ -31,6 +31,11 @@
 #include "ogr_api.h"
 #include "global.h"
 
+#ifndef MAX
+#  define MIN(a,b)      ((a<b) ? a : b)
+#  define MAX(a,b)      ((a>b) ? a : b)
+#endif
+
 int geom(OGRGeometryH hGeom, struct Map_info *Map, int field, int cat, double min_area, int type, int mk_centr );
 int centroid(OGRGeometryH hGeom, CENTR *Centr, SPATIAL_INDEX *Sindex, int field, int cat, double min_area, int type);
 
@@ -993,6 +998,30 @@
     */
 
     Vect_close ( &Map );
+
+
+/* -------------------------------------------------------------------- */
+/*      Extend current window based on dataset.                         */
+/* -------------------------------------------------------------------- */
+    if( extend_flag->answer )
+    {
+	G_get_default_window( &loc_wind );
+
+	loc_wind.north = MAX(loc_wind.north,cellhd.north);
+	loc_wind.south = MIN(loc_wind.south,cellhd.south);
+	loc_wind.west  = MIN(loc_wind.west, cellhd.west);
+	loc_wind.east  = MAX(loc_wind.east, cellhd.east);
+
+	loc_wind.rows = (int) ceil((loc_wind.north - loc_wind.south) 
+					/ loc_wind.ns_res);
+	loc_wind.south = loc_wind.north - loc_wind.rows * loc_wind.ns_res;
+
+	loc_wind.cols = (int) ceil((loc_wind.east - loc_wind.west) 
+					/ loc_wind.ew_res);
+	loc_wind.east = loc_wind.west + loc_wind.cols * loc_wind.ew_res;
+
+	G__put_window(&loc_wind, "../PERMANENT", "DEFAULT_WIND");
+    }
 
     if (with_z && !z_flag->answer )
 	G_warning (_("Input data contains 3D features. Created vector is 2D only, "
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Reply via email to