Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from qgis.core import *
- from qgis.gui import *
- @qgsfunction(args='auto', group='Custom')
- def dump_table(geometry, feature, parent):
- nodes = geometry.asMultiPolygon()[0][0]
- template = """
- <style>table, th, td {{ border: 1px solid black; }}</style>
- <table>
- <tr>
- <th>PlotNo</th>
- <th>No.</th>
- <th>X</th>
- <th>Y</th>
- </tr>
- {}
- </table>
- """
- rows = []
- for count, node in enumerate(nodes):
- row = """<tr>
- <td>{}</td>
- <td>{}</td>
- <td>{}</td>
- <td>{}</td>
- </tr>""".format(feature['PlotNo'], count, node.x(), node.y())
- rows.append(row)
- return template.format("".join(rows))
Add Comment
Please, Sign In to add comment