pesekon2 / GRASS-GIS-SOS-tools

My Google Summer of Code 2017 project. This is just development part. Intended GRASS GIS modules and final code will be at https://svn.osgeo.org/grass/grass-addons/
GNU General Public License v2.0
3 stars 1 forks source link

v.in.sos duplicate nodes for more than one observed properties #29

Closed lucadelu closed 7 years ago

lucadelu commented 7 years ago

Running

v.in.sos url=http://istsos.geodati.fmach.it/istsos/edenext? output=grida_vector offering=GRIDA event_time='2012-03-14T18:28:01+01:00/2012-03-14T19:33:01+01:00' observed_properties=temperature,air:humidity:relative

I got 16 points but they should be only 8, here you should check if layer is the first so you create geometry point otherwise you have only to add attributes.

You need to use always the same cat value for the same point in different layers

pesekon2 commented 7 years ago

Hmm, the trick with the same cat value doesn't work for me. When I try it, I still get 16 points:

> v.in.sos url=http://istsos.geodati.fmach.it/istsos/edenext? output=grida_vector offering=GRIDA event_time='2012-03-14T18:28:01+01:00/2012-03-14T19:33:01+01:00' observed_properties=temperature,air:humidity:relative            
WARNING: No data base element files found
Building topology for vector map <grida_vector@user1>...
Registering primitives...
8 primitives registered
8 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 0
Number of primitives: 8
Number of points: 8
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
Building topology for vector map <grida_vector@user1>...
Registering primitives...
16 primitives registered
16 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 0
Number of primitives: 16
Number of points: 16
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

But now I don't get even the values in the second layer. See:

> v.db.select grida_vector layer=2
cat|name|t20120314T1835010100|t20120314T1932010100|t20120314T1832010100|t20120314T1930010100|t20120314T1830010100|t20120314T1839010100|t20120314T1833010100|t20120314T1933010100|t20120314T1829010100|t20120314T1929010100|t20120314T1928010100|t20120314T1831010100|t20120314T1931010100

When I try to drop the Point() from writing here, it raises an error (not enough arguments) and stops.

pesekon2 commented 7 years ago

Trying to return to separated geometry and attributes import, I'm stack on the same place as we were before - points are not connected with layers in the attribute table. Even when all the messages seems correct, I have tried to print the informations based on points and I can see that point.attrs == None. It's here.

lucadelu commented 7 years ago

Ok, I don't understand why print(pnt1.attrs) return None, but the output vector seems correct

v.db.select map=grida_vector
cat|name|t20120314T1835010100|t20120314T1932010100|t20120314T1832010100|t20120314T1930010100|t20120314T1830010100|t20120314T1839010100|t20120314T1833010100|t20120314T1933010100|t20120314T1829010100|t20120314T1929010100|t20120314T1928010100|t20120314T1831010100|t20120314T1931010100
1|GRIDA_H1_HIGH|69.652||||||||||||
2|GRIDA_H8_HIGH||69.696|67.317||||||||||
3|GRIDA_A8_HIGH||||66.478|62.538||||||||
4|GRIDA_H1_LOW||||||73.233|||||||
5|GRIDA_H8_LOW|||||||74.255|76.904|||||
6|GRIDA_A1_HIGH|||||||||65.611|68.008|||
7|GRIDA_A1_LOW|||||||||||71.638||
8|GRIDA_A8_LOW||||||||||||64.684|67.122
v.db.select map=grida_vector layer=2
cat|name|t20120314T1835010100|t20120314T1932010100|t20120314T1832010100|t20120314T1930010100|t20120314T1830010100|t20120314T1839010100|t20120314T1833010100|t20120314T1933010100|t20120314T1829010100|t20120314T1929010100|t20120314T1928010100|t20120314T1831010100|t20120314T1931010100
1|GRIDA_H1_HIGH|7.594||||||||||||
2|GRIDA_H8_HIGH||8.101|8.603||||||||||
3|GRIDA_A8_HIGH||||9.063|10.066||||||||
4|GRIDA_H1_LOW||||||7.029|||||||
5|GRIDA_H8_LOW|||||||7.6|7.099|||||
6|GRIDA_A1_HIGH|||||||||9.04|8.539|||
7|GRIDA_A1_LOW|||||||||||8.117||
8|GRIDA_A8_LOW||||||||||||9.092|8.09

for me this it fixed

t.vect.in.sos instead is not fixed yet by the changes done in v.in.sos, see #33

pesekon2 commented 7 years ago

Yes, v.db.select seems correct also to me. But it is a query about the attribute table -> yes, attribute table was created correctly. And because there were 8 points imported, the geometry was also created correctly. The problem comes with their connection. Just try for example this command:

v.to.rast input=grida_vector use=cat output=grida_vector

Max and min values of the output raster are NULL. It's because points are not connected to the attribute table (also if you choose one row in the attribute table gui, the point isn't highlighted in the map window).