daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Sep 14th, 2017 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Nombre de rang
  2. nbr = QgsExpression( "ID LIKE '%-1'" )
  3. itnbr = layer.getFeatures( QgsFeatureRequest( nbr ) )
  4. litnbr = list(itnbr)
  5.  
  6. print 'nombre de rang : ' + str(len(litnbr))
  7.  
  8. #Nombre de pied dans le rang
  9. for i in range(len(litnbr)):
  10.     rang = str(i+1)
  11.     print 'rang : '+ rang
  12.     itp = layer.getFeatures(QgsFeatureRequest().setFilterExpression("ID LIKE '{0}-%'".format(rang[i])))
  13.     litp = list(itp)
  14.     print 'nombre de pieds dans le rang ' + rang + ' : ' + str(len(litp))
  15.    
  16. nombre de rang : 60
  17. rang : 1
  18. nombre de pieds dans le rang 1 : 6
  19. rang : 2
  20.  
  21. exec((script), ns)
  22.           File "<string>", line 34, in <module>
  23.         IndexError: string index out of range
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top