What would you suggest as the most convenient way to update a small (60 points) vector map? E.g. a map's attribute "pollution_level" for a given point-ID (attribute "sitecode") has to be updated, based on some plain text output (columns "sitecode" and "pollution level") of another software?
Many thanks in advance! Ivo
Offenthaler Ivo wrote:
What would you suggest as the most convenient way to update a small (60 points) vector map? E.g. a map's attribute "pollution_level" for a given point-ID (attribute "sitecode") has to be updated, based on some plain text output (columns "sitecode" and "pollution level") of another software?
In a command shell, you might find something like this will do it:
while read sc pl
do
echo "UPDATE <vect_point_map> SET pollution_level=$pl WHERE sitecode=$sc" | db.execute
done < plain_text_file
This assumes that the plain_text_file is just two columns, sitecode and pollution_level. You can loop thru the new values any way that's convenient. The line:
echo "UPDATE .... WHERE ..." | db.execute
is what does the work.
--
Micha
Many thanks in advance! Ivo
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
Hi there,
Sorry to expand a little bit this thread. I have a vector map with 10 thousands of records, and for each record I have a set of about 10 attributes. Now I would like to generate a raster map from one attribute of vector map. But on vector I have CHAR values like: “Low”, “Medium” and “High”, and I would like that my raster map get values 1, 2 and 3, respectivelly.
Any help are welcome.
milton
brazil=toronto
2009/5/18 Micha Silver <micha@arava.co.il>
Offenthaler Ivo wrote:
What would you suggest as the most convenient way to update a small (60 points) vector map? E.g. a map’s attribute “pollution_level” for a given point-ID (attribute “sitecode”) has to be updated, based on some plain text output (columns “sitecode” and “pollution level”) of another software?
In a command shell, you might find something like this will do it:
while read sc pl
do
echo “UPDATE <vect_point_map> SET pollution_level=$pl WHERE sitecode=$sc” | db.execute
done < plain_text_file
This assumes that the plain_text_file is just two columns, sitecode and pollution_level. You can loop thru the new values any way that’s convenient. The line:
echo “UPDATE … WHERE …” | db.execute
is what does the work.
Micha
Many thanks in advance! Ivo
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
On Mon, May 18, 2009 at 4:32 PM, Offenthaler Ivo
<ivo.offenthaler@umweltbundesamt.at> wrote:
based on some plain text output (columns "sitecode" and "pollution level") of another software?
In addition, to what the other said:
You can import Text (i.e. CSV) files easily with db.in.ogr:
http://grass.osgeo.org/grass64/manuals/html64_user/db.in.ogr.html
Special gimmick: Limited type recognition can be done for Integer, Real,
String, Date, Time and DateTime columns - see manual.
Markus
Milton Cezar Ribeiro wrote:
Hi there,
Sorry to expand a little bit this thread. I have a vector map with 10 thousands of records, and for each record I have a set of about 10 attributes. Now I would like to generate a raster map from one attribute of vector map. But on vector I have CHAR values like: “Low”, “Medium” and “High”, and I would like that my raster map get values 1, 2 and 3, respectively.
How about adding 10 new attribute columns of type integer, then give these columns values of 1,2,3… based on the original 10 CHAR columns:
v.db.addcol <vector_map> col=(attr1 integer, attr2 integer, attr3 integer…)
echo "UPDATE <vector_map> SET attr1=1 WHERE charattr1=‘Low’ " | db.execute
echo "UPDATE <vector_map> SET attr1=2 WHERE charattr1=‘Medium’ " | db.execute
…
Then run v.surf.rst (or whatever interpolation you chose) to create your raster surfaces based on the integer attributes.
Micha
Any help are welcome.
milton
brazil=toronto
2009/5/18 Micha Silver <micha@arava.co.il>
Offenthaler Ivo wrote:
What would you suggest as the most convenient way to update a small (60 points) vector map? E.g. a map’s attribute “pollution_level” for a given point-ID (attribute “sitecode”) has to be updated, based on some plain text output (columns “sitecode” and “pollution level”) of another software?
In a command shell, you might find something like this will do it:
while read sc pl
do
echo “UPDATE <vect_point_map> SET pollution_level=$pl WHERE sitecode=$sc” | db.execute
done < plain_text_file
This assumes that the plain_text_file is just two columns, sitecode and pollution_level. You can loop thru the new values any way that’s convenient. The line:
echo “UPDATE … WHERE …” | db.execute
is what does the work.
Micha
Many thanks in advance! Ivo
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
On 18/05/09 18:23, Milton Cezar Ribeiro wrote:
Hi there,
Sorry to expand a little bit this thread. I have a vector map with 10 thousands of records, and for each record I have a set of about 10 attributes. Now I would like to generate a raster map from one attribute of vector map. But on vector I have CHAR values like: "Low", "Medium" and "High", and I would like that my raster map get values 1, 2 and 3, respectivelly.
v.reclass ?
Moritz