a CSV vector table is not correctly opened as a QgsVectorLayer

Issue #643 resolved
Andreas Janz created an issue

In QGIS it is a layer:

Comments (14)

  1. Benjamin Jakimow

    Does the CSV contain vector data at all, or is it a plain table without any geometry information?

  2. Andreas Janz reporter

    If I remember correctly, it’s the CSV you shared via Slack:

    level_1_id,level_1,level_2_id,level_2,colors,BAND_1,BAND_2,BAND_3,BAND_4,BAND_5,BAND_6,BAND_7,BAND_8,BAND_9,BAND_10,BAND_11,BAND_12,BAND_13,BAND_14,BAND_15,BAND_16,BAND_17,BAND_18,BAND_19,BAND_20,BAND_21,BAND_22,BAND_23,BAND_24,BAND_25,BAND_26,BAND_27,BAND_28,BAND_29,BAND_30,BAND_31,BAND_32,BAND_33,BAND_34,BAND_35,BAND_36,BAND_37,BAND_38,BAND_39,BAND_40,BAND_41,BAND_42,BAND_43,BAND_44,BAND_45,BAND_46,BAND_47,BAND_48,BAND_49,BAND_50,BAND_51,BAND_52,BAND_53,BAND_54,BAND_55,BAND_56,BAND_57,BAND_58,BAND_59,BAND_60,BAND_61,BAND_62,BAND_63,BAND_64,BAND_65,BAND_66,BAND_67,BAND_68,BAND_69,BAND_70,BAND_71,BAND_72,BAND_73,BAND_74,BAND_75,BAND_76,BAND_77,BAND_78,BAND_79,BAND_80,BAND_81,BAND_82,BAND_83,BAND_84,BAND_85,BAND_86,BAND_87,BAND_88,BAND_89,BAND_90,BAND_91,BAND_92,BAND_93,BAND_94,BAND_95,BAND_96,BAND_97,BAND_98,BAND_99,BAND_100,BAND_101,BAND_102,BAND_103,BAND_104,BAND_105,BAND_106,BAND_107,BAND_108,BAND_109,BAND_110,BAND_111,BAND_112,BAND_113,BAND_114,BAND_115,BAND_116,BAND_117,BAND_118,BAND_119,BAND_120,BAND_121,BAND_122,BAND_123,BAND_124,BAND_125,BAND_126,BAND_127,BAND_128,BAND_129,BAND_130,BAND_131,BAND_132,BAND_133,BAND_134,BAND_135,BAND_136,BAND_137,BAND_138,BAND_139,BAND_140,BAND_141,BAND_142,BAND_143,BAND_144,BAND_145,BAND_146,BAND_147,BAND_148,BAND_149,BAND_150,BAND_151,BAND_152,BAND_153,BAND_154,BAND_155,BAND_156,BAND_157,BAND_158,BAND_159,BAND_160,BAND_161,BAND_162,BAND_163,BAND_164,BAND_165,BAND_166,BAND_167,BAND_168,BAND_169,BAND_170,BAND_171,BAND_172,BAND_173,BAND_174,BAND_175,BAND_176,BAND_177
    "1",impervious,"1",impervious,#004242,"2124","2128","2149","2155","2181","2199","2237","2265","2299","2304","2282","2287","2324","2319","2339","2352","2379","2375","2396","2411","2431","2441","2455","2460","2503","2536","2540","2567","2563","2602","2591","2603","2591","2606","2610","2615","2640","2643","2664","2647","2649","2622","2646","2661","2625","2649","2628","2612","2623","2606","2617","2639","2654","2622","2643","2683","2658","2687","2693","2728","2720","2721","2735","2741","2726","2757","2746","2760","2773","2746","2789","2744","2712","2847","2750","2811","2832","2834","2843","2850","2867","2887","2889","2867","2886","2863","2851","2834","2902","2736","2829","2831","2855","2809","2788","2784","2819","2872","2927","2962","2997","3014","3036","3008","2980","2962","2917","2949","2976","2982","3004","3033","3026","2988","2991","2980","2945","2878","2773","2629","2570","2561","2525","2424","2302","2283","2312","2356","2324","2405","2400","2314","2602","2561","2564","2547","2509","2518","2505","2500","2414","2387","2303","2249","2232","2245","2262","2267","2250","2277","2272","2235","2238","2204","2111","2006","1910","1817","1791","1720","1628","1571","1512","1497","1497","1486","1481","1409","1449","1371","1420","1375","1451","1405","1446","1258","1377"
    "1",impervious,"1",impervious,#004242,"3403","3414","3436","3433","3464","3507","3513","3569","3578","3616","3625","3574","3619","3626","3625","3635","3617","3662","3679","3671","3668","3662","3693","3699","3736","3774","3781","3804","3818","3841","3829","3854","3845","3834","3845","3846","3886","3873","3892","3877","3876","3851","3831","3807","3794","3804","3772","3743","3709","3705","3696","3732","3771","3669","3736","3705","3725","3740","3738","3727","3725","3738","3731","3732","3759","3738","3727","3755","3741","3732","3755","3688","3619","3671","3639","3741","3826","3838","3873","3888","3910","3917","3911","3910","3906","3886","3867","3813","3888","3569","3598","3583","3752","3691","3653","3652","3692","3785","3865","3971","3978","4018","4030","4002","3951","3871","3836","3714","3754","3781","3820","3842","3838","3858","3815","3800","3691","3588","3407","3129","3019","2994","2949","2799","2603","2533","2612","2706","2715","2763","2743","2643","3150","3145","3128","3078","2985","3007","2996","2929","2761","2697","2615","2532","2527","2515","2551","2575","2550","2545","2511","2495","2462","2299","2199","2037","1889","1872","1729","1673","1555","1549","1511","1418","1389","1404","1444","1404","1337","1382","1363","1337","1314","1276","1330","1336","1288"
    "1",impervious,"1",impervious,#004242,"1172","1189","1195","1202","1209","1211","1235","1245","1266","1277","1279","1266","1292","1271","1296","1284","1284","1307","1318","1319","1333","1347","1339","1335","1351","1389","1373","1373","1390","1391","1379","1385","1383","1377","1386","1381","1386","1385","1389","1386","1385","1385","1375","1375","1381","1386","1393","1370","1388","1384","1384","1377","1410","1375","1386","1394","1398","1380","1395","1395","1391","1380","1382","1386","1397","1406","1399","1399","1415","1410","1409","1418","1368","1411","1403","1439","1468","1492","1495","1500","1521","1530","1526","1533","1535","1514","1529","1514","1538","1424","1454","1439","1547","1542","1561","1559","1561","1608","1632","1632","1676","1679","1684","1682","1659","1671","1641","1790","1802","1830","1828","1849","1852","1868","1864","1876","1883","1864","1877","1873","1881","1879","1888","1898","1879","1861","1858","1856","1819","1817","1784","1672","1863","1920","1904","1911","1910","1881","1905","1932","1899","1870","1850","1861","1814","1835","1806","1753","1707","1668","1654","1641","1639","1689","1700","1670","1713","1661","1639","1656","1622","1632","1614","1590","1555","1522","1483","1421","1372","1439","1374","1424","1346","1323","1295","1379","1312"
    "1",impervious,"1",impervious,#004242,"1812","1803","1797","1834","1835","1852","1884","1893","1939","1941","1934","1916","1938","1941","1948","1951","1967","1993","1997","1996","2017","2022","2026","2040","2050","2079","2074","2099","2104","2128","2122","2129","2118","2108","2115","2117","2116","2098","2109","2107","2106","2080","2093","2076","2052","2066","2044","2031","2019","2002","2006","2001","2007","1949","1987","1966","1962","1932","1976","1945","1927","1923","1921","1900","1932","1936","1949","2001","2024","2053","2119","2109","2101","2197","2198","2300","2390","2432","2477","2512","2561","2597","2608","2635","2671","2660","2674","2684","2730","2520","2608","2646","2809","2797","2803","2838","2877","2892","2951","2975","3009","3039","3045","3019","2992","2957","2904","2996","3019","3051","3065","3075","3066","3064","3068","3107","3091","3040","3037","3033","3037","3032","3005","3018","2994","2988","2976","2951","2910","2875","2828","2700","3055","3053","3072","2999","3026","3013","3048","2995","3051","3030","3044","3009","2978","2967","2995","2984","2933","2942","2937","2933","2955","2921","2949","2913","2919","2890","2892","2912","2824","2893","2847","2849","2836","2776","2761","2643","2623","2586","2581","2624","2569","2406","2534","2406","2549"
    ...
    

  3. Benjamin Jakimow

    Your CSV example does not contain any geometry, so it’s does not represent a Vector Data Source in terms of the EnMAP-Box data source model.

  4. Andreas Janz reporter

    Hi Benjamin,

    • I uploaded the CSV (BTW - you created that file some days ago! 🙂 )
    • the main problem is, that the EnMAP-Box is not behaving like QGIS when dropping the CSV into the QGIS Layers Panel / EnMAP-Box DataSources Panel
    • QGIS handles this CSV as a VectorLayer and the Box should do this as well:

  5. Andreas Janz reporter

    Your CSV example does not contain any geometry

    So what? It’s perfectly valid for a vectors layer to not have geometries. In QGIS this is sometimes called a vector table, like also the icon indicates:

  6. Andreas Janz reporter

    To be more clear: I do not say, that any CSV opened in the EnMAP-Box shoud be opened as a Vector Layer! Only open it as a vector layer, if it is a correctly prepared 2d table. If the content is just a dump of arbitrary stuff, then open it as OtherFiles.

  7. Andreas Janz reporter

    You can use the QgsVectorLayer.isValid() methode to decide if the CSV is a valid layer. If not, open it as OtherFile.

  8. Andreas Janz reporter

    BTW - the FORCE CSV format is also considered as a valid layer by QGIS. When dropping it into QGIS, it is handled like so:

  9. Log in to comment