Guest User

Untitled

a guest
Nov 14th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. from qgis.core import *
  2. from qgis.gui import *
  3.  
  4. @qgsfunction(args='auto', group='Custom')
  5. def dump_table(geometry, feature, parent):
  6. nodes = geometry.asMultiPolygon()[0][0]
  7. template = """
  8. <style>table, th, td {{ border: 1px solid black; }}</style>
  9. <table>
  10. <tr>
  11. <th>PlotNo</th>
  12. <th>No.</th>
  13. <th>X</th>
  14. <th>Y</th>
  15. </tr>
  16. {}
  17. </table>
  18. """
  19. rows = []
  20. for count, node in enumerate(nodes):
  21. row = """<tr>
  22. <td>{}</td>
  23. <td>{}</td>
  24. <td>{}</td>
  25. <td>{}</td>
  26. </tr>""".format(feature['PlotNo'], count, node.x(), node.y())
  27. rows.append(row)
  28. return template.format("".join(rows))
Add Comment
Please, Sign In to add comment