Hi Soeren,

I've tried v.mapcalc from Thomas' GSoC and I think it should go at least to
Addons. Does one of you want to commit it or should I do that? Some, rather
trivial, changes are need to make it work (attached), I can apply them
later if you want.

I also suggest removing the v.mapcalc which is now in addons. Perhaps the
functionality is different but since it was not finished, there is no
functionality which can be used. Unless somebody will work on it soon, I
don't see a reason to keep it there. (Alternatively, it can be renamed.)

Best,
Vaclav


On Tue, Oct 13, 2015 at 3:15 AM, Sören Gebbert <[email protected]
> wrote:

> Hi,
> the GSoC implementation of v.mapcalc is still available:
>
> https://code.google.com/p/grass-gis-temporal-algebra/source/browse/#svn%2Ftrunk%2Fv.mapcalc
>
> However, the approach in the GSoC v.mapcalc is very different from the
> v.mapcalc addon from 2002.
> The algebraic expressions are applied to whole vector maps, rather
> than single points, list of points, lines or polygons.
>
> Best regards
> Soeren
>
>
> 2015-10-13 3:53 GMT+02:00 Vaclav Petras <[email protected]>:
> >
> > On Mon, Oct 12, 2015 at 6:24 AM, Glynn Clements <
> [email protected]>
> > wrote:
> >>
> >> Markus Neteler wrote:
> >>
> >> > <[email protected]> wrote:
> >> > ...
> >> > > Sorry for the late follow up. The add-on installs now. When trying
> to
> >> > > run
> >> > > it, however, nothing happens.
> >> >
> >> > It does not have a parser (yet?), so I suppose it reads from stdin.
> >>
> >> Yes.
> >>
> >> But it doesn't have any code to read or write GRASS vectors, either.
> >> v.mapcalc appears to be a work-in-progress which hasn't actually made
> >> noticeable progress since it was added.
> >
> > Then I suggest to remove it from the Makefile parent directory and also
> > disable it in the addons build scripts if there is something more needed
> > than r66406 [1] which is blacklisting it somehow already. It does not
> > fulfill what user would expect (at least some functionality). Those who
> want
> > to continue development will get it through svn.
> >
> > I'm not sure happened [2] with the v.mapcalc implemented as a test case
> in
> > GSoC [3] and if the functionality can be still used. But this seems like
> a
> > good alternative to the code in addons.
> >
> > Vaclav
> >
> > [1] https://trac.osgeo.org/grass/changeset/66406
> > [2] https://lists.osgeo.org/pipermail/grass-dev/2013-October/065908.html
> > [3]
> >
> https://grasswiki.osgeo.org/wiki/GRASS_GSoC_2013_Temporal_GIS_Algebra_for_raster_and_vector_data_in_GRASS#v.mapcalc
> >
> > _______________________________________________
> > grass-dev mailing list
> > [email protected]
> > http://lists.osgeo.org/mailman/listinfo/grass-dev
>
Index: v.mapcalc.html
===================================================================
--- v.mapcalc.html	(revision 80)
+++ v.mapcalc.html	(working copy)
@@ -71,17 +71,17 @@
 This example needed specific region setting. It should work in UTM and LL test locations. <br>
 First set the regions extent and create two vector maps with one random points, respectively:
 <div class="code"><pre>
-g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+g.region s=0 n=30 w=0 e=50 b=0 t=50 res=10 res3=10 -p3
 
-v.random --o -z output=point_1 n=1 seed=1 
+v.random --o -z output=point_1 n=1 seed=1
+v.random --o -z output=point_2 n=1 seed=2
 v.info point_1
-v.random --o -z output=point_2 n=1 seed=2 
 v.info point_2
 </pre></div>
 
 Then the vector algebra is used to create buffers around those points, cut out a subset and apply different boolean operation on the subsets in one statement:
 <div class="code"><pre>
-v.mapcalc --o expr="buff_and = (buff_p(point_1, 30.0) ~ buff_p(point_1, 20.0)) & \
+v.mapcalc --o expr="buff_and = (buff_p(point_1, 30.0) ~ buff_p(point_1, 20.0)) &amp; \
                     (buff_p(point_2, 35) ~ buff_p(point_2, 25))"
 v.mapcalc --o expr="buff_or  = (buff_p(point_1, 30.0) ~ buff_p(point_1, 20.0)) | \
                     (buff_p(point_2, 35) ~ buff_p(point_2, 25))"
Index: v.mapcalc.py
===================================================================
--- v.mapcalc.py	(revision 80)
+++ v.mapcalc.py	(working copy)
@@ -210,21 +210,22 @@
         if self.debug:
             print "g.rename vector=%s,%s"%(t[3],t[1])
 
-	if self.run:
-	    m = mod.Module("g.rename", vect=(t[3],t[1]), overwrite=grass.overwrite, 
-	                   run_ = False)
-	    self.cmdlist.add_cmd(m)
+        if self.run:
+            m = mod.Module("g.rename", vector=(t[3],t[1]), overwrite=grass.overwrite, 
+                           run_ = False)
+            self.cmdlist.add_cmd(m)
         self.remove_intermediate_vector_maps()
 
     def remove_intermediate_vector_maps(self):
         if self.debug:
             for name in self.names:
-                print "g.remove vect=%s"%(name)
+                print "g.remove type=vector name=%s -f"%(name)
         if self.run:
-	    for name in self.names:
-	        m = mod.Module("g.remove", vect=name, run_ = False)
-	        self.cmdlist.add_cmd(m)
-		    
+            for name in self.names:
+                m = mod.Module("g.remove", type='vector', name=name,
+                               flags='f', run_=False)
+                self.cmdlist.add_cmd(m)
+                    
     def p_bool_and_operation(self, t):
         """
         expression : name AND name
@@ -253,20 +254,20 @@
         name = self.generate_vector_map_name()
         
         # Assign ids to expressions, names and operators.
-	firstid = 1
-	secondid = 3
-	operatorid = 2
-	    
-	# Define operation commands. 
+        firstid = 1
+        secondid = 3
+        operatorid = 2
+            
+        # Define operation commands. 
         if t[operatorid] == "&":
             if self.debug:
                 print "v.overlay operator=and ainput=%s binput=%s output=%s"\
                       %(t[firstid], t[secondid], name)
 
-	    if self.run:
-		m = mod.Module("v.overlay", operator="and", ainput=t[firstid], \
-		               binput=t[secondid], output=name, run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.overlay", operator="and", ainput=t[firstid], \
+                               binput=t[secondid], output=name, run_ = False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
             
         elif t[operatorid] == "|":
@@ -274,10 +275,10 @@
                 print "v.overlay operator=or ainput=%s binput=%s output=%s"\
                        %(t[firstid], t[secondid], name)
 
-	    if self.run:
-		m = mod.Module("v.overlay", operator="or", ainput=t[firstid], \
-		               binput=t[secondid], output=name, run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.overlay", operator="or", ainput=t[firstid], \
+                               binput=t[secondid], output=name, run_ = False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
             
         elif t[operatorid] == "^":
@@ -285,10 +286,10 @@
                 print "v.overlay operator=xor ainput=%s binput=%s output=%s"\
                       %(t[firstid], t[secondid], name)
 
-	    if self.run:
-		m = mod.Module("v.overlay", operator="xor", ainput=t[firstid], \
-		               binput=t[secondid], output=name, run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.overlay", operator="xor", ainput=t[firstid], \
+                               binput=t[secondid], output=name, run_ = False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
             
         elif t[operatorid] == "~":
@@ -296,21 +297,21 @@
                 print "v.overlay operator=not ainput=%s binput=%s output=%s"\
                       %(t[firstid], t[secondid], name)
 
-	    if self.run:
-		m = mod.Module("v.overlay", operator="not", ainput=t[firstid], \
-		               binput=t[secondid], output=name, run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.overlay", operator="not", ainput=t[firstid], \
+                               binput=t[secondid], output=name, run_ = False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
             
         elif t[operatorid] == "+":
-	    patchinput = t[firstid] + ',' + t[secondid]
+            patchinput = t[firstid] + ',' + t[secondid]
             if self.debug:
                 print "v.patch input=%s output=%s"\
                       %(patchinput, name)
 
-	    if self.run:
-		m = mod.Module("v.patch", input=patchinput, output=name, run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.patch", input=patchinput, output=name, run_ = False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
         
     def p_buffer_operation(self,t):
@@ -322,19 +323,19 @@
         name = self.generate_vector_map_name()
 
         # Assign ids to expressions, names and operators.
-	mapid = 3
-	operatorid = 5
-	    
+        mapid = 3
+        operatorid = 5
+            
         if t[1] == "buff_p":
             if self.debug:
                 print "v.buffer input=%s type=point distance=%g output=%s"\
                       %(t[mapid], t[operatorid], name)
   
-	    if self.run:
-		m = mod.Module("v.buffer", type="point", input=t[mapid], \
-		               distance=float(t[operatorid]), output=name, \
-		               run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.buffer", type="point", input=t[mapid], \
+                               distance=float(t[operatorid]), output=name, \
+                               run_=False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
         elif t[1] == "buff_l":
             if self.debug:
@@ -341,11 +342,11 @@
                 print "v.buffer input=%s type=line distance=%g output=%s"\
                        %(t[mapid], t[operatorid], name)
 
-	    if self.run:
-		m = mod.Module("v.buffer", type="line", input=t[mapid], \
-		               distance=float(t[operatorid]), output=name, \
-		               run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.buffer", type="line", input=t[mapid], \
+                               distance=float(t[operatorid]), output=name, \
+                               run_=False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
         elif t[1] == "buff_a":
             if self.debug:
@@ -352,13 +353,13 @@
                 print "v.buffer input=%s type=area distance=%g output=%s"\
                       %(t[mapid], t[operatorid], name)
 
-	    if self.run:
-		m = mod.Module("v.buffer", type="area", input=t[mapid], \
-		               distance=float(t[operatorid]), output=name, \
-		               run_ = False)
-		self.cmdlist.add_cmd(m)
+            if self.run:
+                m = mod.Module("v.buffer", type="area", input=t[mapid], \
+                               distance=float(t[operatorid]), output=name, \
+                               run_=False)
+                self.cmdlist.add_cmd(m)
             t[0] = name
-	    
+            
     def p_paren_expr(self, t):
         """ expression : LPAREN expression RPAREN"""
         t[0] = t[2]
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to