<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 23, 2014 at 6:20 PM, Arighna <span dir="ltr"><<a href="mailto:roy.arighna@gmail.com" target="_blank">roy.arighna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am fetching points from URL in a python script as a dictionary and creating json file from it. Then loading points in GRASS map from the file. <u></u><u></u></p><p class="MsoNormal">Can we load points in a vector map directly from python scripts; as we have a python shell in GRASS.</p></div></div></blockquote><div><br></div><div>You would use v.in.ascii, if you have them in a file in csv format like x,y,attr1,attr2,... and you can choose separator:</div><div><br></div><div>import grass.script.core as gcore</div><div><br></div><div>gcore.run_command('v.in.ascii', input='path/to/file', output='mymap', x=1, y=2, separator=',')</div><div><br></div><div>or if you have them as string:</div><div><br></div><div>gcore.write_command('v.in.ascii', input='-', stdin=points_string, output='mymap', x=1, y=2, separator)<br></div><div><br></div><div>there are other parameters, you can also upload attributes this way by specifying columns, more in the manual page:</div><div><br></div><div><a href="http://grass.osgeo.org/grass71/manuals/v.in.ascii.html">http://grass.osgeo.org/grass71/manuals/v.in.ascii.html</a><br></div><div><br></div><div>I am not sure if you run the Python script from GRASS (that's the usual, simple case), if not there is a way to run it outside of GRASS session but it's more complicated, see </div><div><a href="http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly">http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly</a><br></div><div><br></div><div>Anna</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"> <span class=""><font color="#888888"><u></u><u></u></font></span></p><span class=""><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Arighna<u></u><u></u></p></font></span></div></div><br>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br></div></div>