Geographic Information Systems Asked by jean pierre huart on January 8, 2021
Here is what I’m trying to do, but the text remain printed in one line. What is wrong?
from grass_session import Session
from grass.script import run_command
with Session(gisdb="path to mygisdb", location="myL72",
create_opts="EPSG:31370") as sess:
cptxt = "- first line n"
cptxt += "- second line n"
run_command('d.text',
text=cptxt,
color='grey',
rotation=0,
linespacing=1.8,
at=[2, 45],
align='ll',
size=2.5
)
But the result is - first line - second line
.
Any idea?
I've found another way to do it, but I don't find it very elegant. d.text
accepts a string or a file. In this second case it works as expected.
cptxt = "- first line n"
cptxt += "- second line n"
myfile = 'input_text.txt'
with open(myfile, "w") as ftxt:
ftxt.write(cptxt)
run_command('d.text',
input=myfile
)
I'm still looking if using a string directly is anyway possible.
Answered by jean pierre huart on January 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP