I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my application I ran this command through python subprocess and created the raster map showing point density. I displayed this raster map over the polygon area in grass. But when I try to run the command through python using d.out.file command, error is raised.
command5 = "d.mon start=x1"
command6 = "d.mon select=x1"
command7 = "d.mon unlock=x1"
command8 = "r.colors byr"
command9 = "d.rast crimes_"+str(pname)
command10 = "d.vect "+str(pname)+" type=line,boundary"
command11 = "d.out.file output="+str(pname)+" format=png size=800,600"
command12 = "d.mon stop=x1"
saveCommands = [command4,command5,command6,command7]
for sc in saveCommands:
s = subprocess.Popen(sc,shell=True,env=environ)
s.wait()
Error is :
ERROR: Graph_Set: can't open Display
ERROR: Unable to get GIS_LOCK enviroment variable value
Problem selecting x1. Will try once more
ERROR: Unable to get GIS_LOCK enviroment variable value
d.mon select=x1
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
ERROR: Unable to get GIS_LOCK enviroment variable value
All I need is to export the grass vector and raster layer to an image.
command4
is included insaveCommands
but not shown in the example.