Qgis vector too long ошибка

What is the bug or the crash?

I have a project with a large number of relatively complex layers, mostly PostgreSQL, but also some files and others, along with some tiled base maps. The project worked fine in 3.22.4, but has an uncaught exception in 3.24, 3.24.1, and 3.22.5 which pops up a dialog of «vector too long». This happens just after the project loads, and after dismissing the exception dialog a couple of times (maybe related to the number of layers with issues?), I can pan and zoom and some other things just fine — I haven’t tried anything fancy. However, if I try to exit, even if I discard changes to the project, it pops up again and stops qgis-bin.exe from exiting. The only solution is to kill the task. This doesn’t happen with other projects, even a simplified version of the project with issues. However, I’ve not been able to figure out which layers cause the problem. When I saw the bug in 3.24 I was hoping to find the time to bisect through removing layers, but I haven’t yet, but I wanted to report this now that I see it has not been fixed in 3.24.1 and has turned up in 3.22.5. Maybe that particular exception is obvious to someone, especially happening in the exit code path.

Steps to reproduce the issue

I don’t have a good reproducible test case. I’ll try to install debugging symbols and see if I can catch the exception in a debugger.

Versions

3.24.0, 3.24.1, 3.22.5

Supported QGIS version

  • I’m running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

I have two vector layers:

  • the red one is ‘Landuse’
  • the orange is a vector extent of land below ‘1mAHD’ extracted from a 5 meter DEM.

I want to clip out the ‘Landuse’ under the ‘1mAHD’ layer. They both have fairly complex geometry as you can see. The «Clip» is taking forever so I’m wondering if there’s a Plugin, script or series of steps I could follow to complete this task faster and easier and without getting into doing things manually. i.e. editing all the small holes out!

enter image description here

Taras's user avatar

Taras

27.3k4 gold badges46 silver badges114 bronze badges

asked Jun 3, 2021 at 4:20

JohnF's user avatar

0

The solution was a mix of many comments made on the question. The process used to perform the clip successfully was as follows.
The following processes were performed on the layer as 1 polygon.

Image A
image_a

  • First, I used the «Delete Holes» feature with a threshold setting of 10,000,000. This effectively removed any internal holes in the polygons
  • Second, I used the «Smooth» tool to reduce the number of boundary vertices in the polygon.
  • Third, I used the «Multipart to singleparts» tool (as Q would not let me edit the whole layer as 1 polygon)
  • Fourth, I had to manually edit all the small artifacts from the outsides of the clipping polygons to clean it up (Took a while !….). The resulting Polygon is shown in the second image.

Image B
image_b

  • Once these tasks were performed the «Clip» tool worked.The final output was the clipped landuse under 1mAHD. I was then able to calculate areas of each of the landuses under 1mAHD. Obviously there was a loss in accuracy due to the holes and external polygons being removed, but this was acceptable at the scale I was working with.

Image C
image_c

It seems that when the clipping overlay and underlying layers are highly detailed that the clipping tool does not work. Although it might on a smaller dataset. It would’ve been good to retain the detail and still perform the clip but the result was satisfactory nonetheless, with the steps detailed above.

PolyGeo's user avatar

PolyGeo

64.4k28 gold badges104 silver badges319 bronze badges

answered Jun 10, 2021 at 4:54

JohnF's user avatar

JohnFJohnF

3852 silver badges9 bronze badges

@gerbil-snot

When trying to sign an app directly from Safari or the Files app this error is received:
15BAA0EC-8596-43C0-873D-56D05DC081C8

The app I’m trying to sign is unc0ver, v4.3.1

Device: iPhone Xs Max iOS 13.3

@gerbil-snot

Edit, I fixed this by switching to another Apple ID, after which I received an “unknown error.” I turned off windows active virus scan and it finally signed.

@itsHoshii

Attempted gerbil-snot’s method of fixing this error to no avail. iPhone 6S, iOS 13.3.

Edit: Here’s what I did to get it to work.

  1. Uninstall both Altserver and AltStore. Install newest versions if not updated.
  2. Reinstall both. Sign into Altserver using new credentials. When AltStore is loaded, use the new credentials to sign in there too.
  3. Keep Windows Security open, disable Real Time Protection
  4. Sideload thru Files app or AltStore’s apps page.

In my experience I found that Windows Real Time Protection turned itself back on at some point. Check it frequently if you have the same issue.

@ItsErikSquared

The main issue I got was from Windows Real-Time Protection. It seems that when AltStore sends the IPA to AltServer windows detected it being an exploit. I guess Windows Defender is doing its job for once…

Specifically, I got these:

  • Explot:iPhoneOS/Vortex.B!MTB
  • Exploit:iPhoneOS/Dakkatoni.A
  • Trojan:Script/Wacatac.C!ml

Turning off WRTP and rerunning it made it work right away.

Instructions for turning WRTP off:

  1. Open Windows Security/Defender
  2. Click Virus & threat protection
  3. Under Virus & threat protection settings, click the blue text «Manage Settings»
  4. The first slider should be «Real-time protection». Turn it off.

Edit:
DO NOT FORGET TO TURN IT BACK ON AFTER BEING SIGNED!!!
WRTP IS EXTREMELY IMPORTANT (even though it has flaws) IT WILL STILL HELP YOU STAY SAFE.

@bjmvercelli

I was getting «vector too long» error when trying to sign unc0ver. Solved it by just turning off windows real time protection, nothing else.

@zayn008

I was getting «vector too long» error when trying to sign unc0ver. Solved it by just turning off windows real time protection, nothing else.

This is not a smart fix, you need to find the issue, usually ‘Exploit:iPhoneOS/Vortex.A!MTB’ and allow it, DO NOT turn off windows real time protection, it’s much needed.

@ItsErikSquared

This is not a smart fix, you need to find the issue, usually ‘Exploit:iPhoneOS/Vortex.A!MTB’ and allow it, DO NOT turn off windows real time protection, it’s much needed.

@zayn008 You only need to turn it off TEMPORARILY whilst, you sign it. And even when I whitelisted the ‘Exploit:iPhoneOS/Vortex.A!MTB’, it would still continually block it, being a new file.

Also, @bjmvercelli make sure you turn it back on!!! I should have mentioned that.

@noah978

This is not an issue AltStore can fix since it is an issue caused by Windows. The error message has been updated to better reflect the error. Closing this issue.

Я пытаюсь заполнить двумерный вектор (817 на 577) объектами, называемыми ячейками. Эти ячейки имеют набор значений элементов (поплавки, другие векторы и т.д.). В какой-то момент программа останавливается и выдает ошибку "vector<T> too long". Вот определение класса ячеек и полный цикл:

struct cell
    {
    int x;
    int y;
    int country;
    vector<int> popO;
    vector<int> popS;
    vector<float> Rainfall;
    double Cropland;
    vector<movement> outm;
    vector<movement> inm;
    vector<double> AgeMaleFemale;
    vector<double> AgeMaleFemaleMortality;
    double Fertility;
    };
vector<vector<cell>> cells;
void fillCells(dataserver D)
        {
        cout<<"start filling"<<endl;
        int rows=577;
        int columns=817;
        cell X;
        vector<vector<cell>> output(rows,vector<cell>(columns,X));
        cout<<"start loop"<<endl;
        for (int i=0;i<rows;i++)
            {
            cout<<i<<" ";
            for (int j=0;j<columns;j++)
                {
                int p=-9999;
                cell tmpC;
                tmpC.x=i;
                tmpC.y=j;
                tmpC.country=D.CO[i][j];
                tmpC.popO.resize(3,0);
                tmpC.popO[0]=int(D.PO[0][i][j]);
                tmpC.popO[1]=int(D.PO[1][i][j]);
                tmpC.popO[2]=int(D.PO[2][i][j]);
                tmpC.Rainfall.resize(10,0);
                for (int k=0;k<10;k++)
                    {
                    tmpC.Rainfall[k]=D.R[k][i][j];
                    }
                tmpC.popS.resize(10,0);
                tmpC.Cropland=D.CPC[i][i];
                if (tmpC.country!=-9999)
                    {
                    tmpC.Fertility=D.F[tmpC.country];
                    tmpC.AgeMaleFemale.resize(18,0);
                    tmpC.AgeMaleFemale=D.AMF[tmpC.country];
                    tmpC.AgeMaleFemaleMortality.resize(18,0);
                    tmpC.AgeMaleFemaleMortality=D.M[tmpC.country];
                    }
                output[i][j]=tmpC;
                }
            }
        cells=output;
        }

Несколько раз я обнаружил, что sizeof (cell) раз число ячеек в векторе предполагается меньше, чем vector :: max_size()

sizeof (ячейка) составляет 144 → 144 * 817 * 577 = 67882896

max_size — 268345455

Разве не должно быть достаточно места для всех ячеек, или я чего-то не хватает? Заранее спасибо!

Дополнительная информация:

Запуск на Windows 7 64bit, компиляция с Visual Studio 2010, 32 бит

Информация о max_size действительно появилась здесь: stl «vector <T> too long»

I am working on ownership data at a US county level. I have one shapefile per county that contains thousands of tax parcels. I need to dissolve the polygons representing parcels owned by the same individual.

When the shapefile is not clean, the «Dissolve» tool in QGIS doesn’t seem to work, it freezes. I have to fix the geometry validity issues first using the «Check Geometry Validity» tool. However, I have sometimes hundreds of errors. It takes a lot of time to fix them manually. Is there any other strategies that could save me some time?

I am using QGIS 2.4.0.

Taras's user avatar

Taras

27.3k4 gold badges46 silver badges114 bronze badges

asked Sep 3, 2014 at 22:53

Bap's user avatar

0

Try running a subtle buffer on the polygons. A setting of -0.001 if your CRS is UTM would seem worth a try. VECTOR|BUFFER

answered Sep 4, 2014 at 5:25

BillW's user avatar

BillWBillW

5102 silver badges9 bronze badges

1

When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose the bpol function there.

Maybe even more important it is to set the advanced parameters for snap tolerance and min area.
Depending on the layer, I usually choose 0.1 to 2 meters for snapping and e.g. 10 sqm for the minimum area.

The snapping e.g. aligns boundaries which are meant to be shared borders but have tiny offsets, the minimum area eliminates tiny slivers from intersections etc.

Together with the bpol, this normally resolves all errors without too much changing the topology.

answered Dec 9, 2014 at 11:13

Bernd V.'s user avatar

Bernd V.Bernd V.

3,15724 silver badges45 bronze badges

You can use ST_MakeValid directly in QGIS adding lwgeom plugin that add lwgeom provider to processing toolbox => you can apply MakeValid directly on your loaded layer without converting in postigs/spatialite.
Postgis/spatialite use the same liblwgeom to do ST_MakeValid

you have to install liblwgeom and configure processing provider to point to it

lwgeom provider can be found as experimental:
https://plugins.qgis.org/plugins/processinglwgeomprovider/

answered Sep 4, 2014 at 8:46

Luigi Pirelli's user avatar

2

answered Sep 4, 2014 at 4:37

user30184's user avatar

user30184user30184

56.9k4 gold badges53 silver badges100 bronze badges

0

Though I know this question is for QGIS 2, anyone here looking for an answer for QGIS 3:

Processing —> Toolbox —> Vector Geometry —> Fix Geometries

Just for context, I needed to do this after I received the following error:

Feature (820) has invalid geometry. Please fix the geometry or change the Processing setting to the "Ignore invalid input features" option.

answered Feb 21, 2020 at 19:48

Kristen G.'s user avatar

Kristen G.Kristen G.

1,06010 silver badges28 bronze badges

I just ran in to a similar problem in qgis. I had a poly began projecting incorrectly. I used the Grass fuction v.clean in the Processing toolbox as Bernd suggested. Although bpol did not work, it seems to be fixed with the break function.

answered Jan 8, 2015 at 19:57

user44727's user avatar

There is a standalone utility to fix this kind of problems, and I find it to be very reliable. It is called Shapechk by Andrew Williamson.

It can be downloaded from this link:
https://gis.stackexchange.com/a/7824/93912

answered Jan 22, 2020 at 0:29

jberrio's user avatar

jberriojberrio

7086 silver badges21 bronze badges

I am working on ownership data at a US county level. I have one shapefile per county that contains thousands of tax parcels. I need to dissolve the polygons representing parcels owned by the same individual.

When the shapefile is not clean, the «Dissolve» tool in QGIS doesn’t seem to work, it freezes. I have to fix the geometry validity issues first using the «Check Geometry Validity» tool. However, I have sometimes hundreds of errors. It takes a lot of time to fix them manually. Is there any other strategies that could save me some time?

I am using QGIS 2.4.0.

Taras's user avatar

Taras

27.3k4 gold badges46 silver badges114 bronze badges

asked Sep 3, 2014 at 22:53

Bap's user avatar

0

Try running a subtle buffer on the polygons. A setting of -0.001 if your CRS is UTM would seem worth a try. VECTOR|BUFFER

answered Sep 4, 2014 at 5:25

BillW's user avatar

BillWBillW

5102 silver badges9 bronze badges

1

When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose the bpol function there.

Maybe even more important it is to set the advanced parameters for snap tolerance and min area.
Depending on the layer, I usually choose 0.1 to 2 meters for snapping and e.g. 10 sqm for the minimum area.

The snapping e.g. aligns boundaries which are meant to be shared borders but have tiny offsets, the minimum area eliminates tiny slivers from intersections etc.

Together with the bpol, this normally resolves all errors without too much changing the topology.

answered Dec 9, 2014 at 11:13

Bernd V.'s user avatar

Bernd V.Bernd V.

3,15724 silver badges45 bronze badges

You can use ST_MakeValid directly in QGIS adding lwgeom plugin that add lwgeom provider to processing toolbox => you can apply MakeValid directly on your loaded layer without converting in postigs/spatialite.
Postgis/spatialite use the same liblwgeom to do ST_MakeValid

you have to install liblwgeom and configure processing provider to point to it

lwgeom provider can be found as experimental:
https://plugins.qgis.org/plugins/processinglwgeomprovider/

answered Sep 4, 2014 at 8:46

Luigi Pirelli's user avatar

2

answered Sep 4, 2014 at 4:37

user30184's user avatar

user30184user30184

56.9k4 gold badges53 silver badges100 bronze badges

0

Though I know this question is for QGIS 2, anyone here looking for an answer for QGIS 3:

Processing —> Toolbox —> Vector Geometry —> Fix Geometries

Just for context, I needed to do this after I received the following error:

Feature (820) has invalid geometry. Please fix the geometry or change the Processing setting to the "Ignore invalid input features" option.

answered Feb 21, 2020 at 19:48

Kristen G.'s user avatar

Kristen G.Kristen G.

1,06010 silver badges28 bronze badges

I just ran in to a similar problem in qgis. I had a poly began projecting incorrectly. I used the Grass fuction v.clean in the Processing toolbox as Bernd suggested. Although bpol did not work, it seems to be fixed with the break function.

answered Jan 8, 2015 at 19:57

user44727's user avatar

There is a standalone utility to fix this kind of problems, and I find it to be very reliable. It is called Shapechk by Andrew Williamson.

It can be downloaded from this link:
https://gis.stackexchange.com/a/7824/93912

answered Jan 22, 2020 at 0:29

jberrio's user avatar

jberriojberrio

7086 silver badges21 bronze badges

Типовые ошибки в QGIS, или когда что-то не работает

  1. Не используйте кириллицу. Нигде — ни в именах файлов, ни в папках. Если в имени пользователя Windows/MacOS есть кириллица, то работайте, например, в какой-нибудь папке на диске C, D и тп. При использовании различных функций в QGIS файлы или папки на кириллице создают проблемы в дальнейшем. Если у вас имя пользователя на кириллице:
    1. Вариант 1 http://gis-lab.info/forum/viewtopic.php?t=12380 и расширенная статья
    2. Вариант 2 https://answers.microsoft.com/ru-ru/windows/forum/windows_7-performance/%D0%BA%D0%B0%D0%BA/0ed802de-d597-44c6-8dcf-d6002ffce86d?auth=1
  2. Не стоит использовать пробелы в имени файла
  3. Для векторных данных необходимо не забывать отключать редактирование! 
  4. После того, как мы выбрали какие-либо объекты и выполнили нужные нам действия, обязательно снимаем выборку. 
  5. При подрезке растра или других операциях системы координат растра и другого слоя (растрового или векторного) должны быть идентичными!
  6. При работе с растрами имеет смысл сохранить их в спроецированную систему координат
  7. Если атрибуты в shp-файле отображаются «кракозябрами», значит, надо поменять кодировку слоя. Правый клик по слою — Свойства слоя — Общие — Кодировка. UTF-8 или win-1251 обычно срабатывают. Также возможно отключить игнорирование кодировки (только для shp-файлов)

  8. Не работайте в проектах, которые получены с сайта https://data.nextgis.com/ru/ Старые версии проектов приводят к ошибкам — например, теряются слои. Создавайте новый проект с нуля!
  9. Если все сплюснутое, значит, у вас скорее всего для проекта выставлена система координат WGS 84 EPSG 4326. Как ее менять, см. Руководство по подбору спроецированной системы координат https://youtu.be/QUf8F9D7ZS4
  10. WGS 84/Pseudo Mercator (3857) не подходит для экспорта в CAD и вывода в pdf, если вы архитектор! Все размеры объектов могут быть больше в несколько раз. См. подробнее Импорт/экспорт в CAD и тему про системы координат.
  11. У слоя (набора данных) обычно уже есть система координат, ее выставлять/менять не надо — слой “сам знает, куда вставать”. Выставляется лишь система координат проекта. Есть редкие исключения, когда в shp-наборе потерян файл prj с указанием СК, или QGIS не может что-то распознать — тогда QGIS сам предложит указать СК именно для слоя.
  12. Векторные данные в формате shp обычно состоят из набора 5-6 файлов с тем же именем, но другими расширениями (dbf, prj, shx и тп). Очень часто вы отправляете мне только файлы с расширением .shp. Надо отправлять весь набор/ Также часто отправляют QGIS-проект (файл .qgs) без самих данных
  13. Файлы geojson хранят геометрию разного типа, и это приводит к проблемам в расчетах. Например, если файл содержит и точки, и полигоны, то при вычислении площади полигона QGIS даст нулевой результат
  14. Храните файлы геоданных и сам проект QGIS рядом, называйте их осмысленно
  • Первое, с чего обычно начинается рассказ о геоинформационных системах – это описание поверхности Земли и способы определения местоположения …

  • Не используйте кириллицу. Нигде — ни в именах файлов, ни в папках. Если в имени пользователя Windows/MacOS есть кириллица, то работайте, на…

  • Какие бывают форматы геоданных?  Принципиально можно выделить векторные и растровые форматы геоданных. В своей работе архитектор чаще бу…

i read in other answers that theres no limit imposed by c++ compiler maximum size of std::vector. i am trying to use vector for one purpose, and in need to have 10^19 items.

typedef struct{
  unsigned long price, weight;
}product;


//inside main
unsigned long long n = 930033404565174954;
vector<product> psorted(n);

the program breaks on the last statement. if i try resize(n) instead of initializing with n then also program breaks with message :

vector<T> too long
std::length_error at memory location

i need to sort the data accourding to price after putting in vector. what should i do ?

Community's user avatar

  • Не работайте в проектах, которые получены с сайта https://data.nextgis.com/ru/ Старые версии проектов приводят к ошибкам — например, теряются слои. Создавайте новый проект с нуля!
  • Если все сплюснутое, значит, у вас скорее всего для проекта выставлена система координат WGS 84 EPSG 4326. Как ее менять, см. Руководство по подбору спроецированной системы координат https://youtu.be/QUf8F9D7ZS4
  • WGS 84/Pseudo Mercator (3857) не подходит для экспорта в CAD и вывода в pdf, если вы архитектор! Все размеры объектов могут быть больше в несколько раз. См. подробнее Импорт/экспорт в CAD и тему про системы координат.
  • У слоя (набора данных) обычно уже есть система координат, ее выставлять/менять не надо — слой “сам знает, куда вставать”. Выставляется лишь система координат проекта. Есть редкие исключения, когда в shp-наборе потерян файл prj с указанием СК, или QGIS не может что-то распознать — тогда QGIS сам предложит указать СК именно для слоя.
  • Векторные данные в формате shp обычно состоят из набора 5-6 файлов с тем же именем, но другими расширениями (dbf, prj, shx и тп). Очень часто вы отправляете мне только файлы с расширением .shp. Надо отправлять весь набор/ Также часто отправляют QGIS-проект (файл .qgs) без самих данных
  • Файлы geojson хранят геометрию разного типа, и это приводит к проблемам в расчетах. Например, если файл содержит и точки, и полигоны, то при вычислении площади полигона QGIS даст нулевой результат
  • Храните файлы геоданных и сам проект QGIS рядом, называйте их осмысленно
    • Первое, с чего обычно начинается рассказ о геоинформационных системах – это описание поверхности Земли и способы определения местоположения …

    • Не используйте кириллицу. Нигде — ни в именах файлов, ни в папках. Если в имени пользователя Windows/MacOS есть кириллица, то работайте, на…

    • Какие бывают форматы геоданных?  Принципиально можно выделить векторные и растровые форматы геоданных. В своей работе архитектор чаще бу…

    i read in other answers that theres no limit imposed by c++ compiler maximum size of std::vector. i am trying to use vector for one purpose, and in need to have 10^19 items.

    typedef struct{
      unsigned long price, weight;
    }product;
    
    
    //inside main
    unsigned long long n = 930033404565174954;
    vector<product> psorted(n);
    

    the program breaks on the last statement. if i try resize(n) instead of initializing with n then also program breaks with message :

    vector<T> too long
    std::length_error at memory location
    

    i need to sort the data accourding to price after putting in vector. what should i do ?

    Community's user avatar

    asked Jan 21, 2012 at 18:15

    Pheonix's user avatar

    13

    std::vector does have limits on how much stuff it can carry. You can query this with std::vector::max_size, which returns the maximum size you can use.

    10^19 items.

    Do you have 10^19 * sizeof(product) memory? I’m guessing that you don’t have ~138 Exabytes of RAM. Plus, you’d have to be compiling in 64-bit mode to even consider allocating that much. The compiler isn’t breaking; your execution is breaking for trying to allocate too much stuff.

    answered Jan 21, 2012 at 18:19

    Nicol Bolas's user avatar

    Nicol BolasNicol Bolas

    435k63 gold badges750 silver badges956 bronze badges

    7

    Others have already told you what the problem is. One possible solution is to use the STXXL library, which is an implementation of STL that’s designed for huge, out-of-memory datasets.

    However, 10^19 8-byte items is 80 million TB. I’m not sure anyone has a disk that large…

    Also, assuming a generous disk bandwidth of 300MB/s, this would take 8000 years to write!

    answered Jan 21, 2012 at 18:22

    Oliver Charlesworth's user avatar

    Get the Reddit app

    Scan this QR code to download the app now

    Or check it out in the app stores

    What is the bug or the crash?

    I have a project with a large number of relatively complex layers, mostly PostgreSQL, but also some files and others, along with some tiled base maps. The project worked fine in 3.22.4, but has an uncaught exception in 3.24, 3.24.1, and 3.22.5 which pops up a dialog of «vector too long». This happens just after the project loads, and after dismissing the exception dialog a couple of times (maybe related to the number of layers with issues?), I can pan and zoom and some other things just fine — I haven’t tried anything fancy. However, if I try to exit, even if I discard changes to the project, it pops up again and stops qgis-bin.exe from exiting. The only solution is to kill the task. This doesn’t happen with other projects, even a simplified version of the project with issues. However, I’ve not been able to figure out which layers cause the problem. When I saw the bug in 3.24 I was hoping to find the time to bisect through removing layers, but I haven’t yet, but I wanted to report this now that I see it has not been fixed in 3.24.1 and has turned up in 3.22.5. Maybe that particular exception is obvious to someone, especially happening in the exit code path.

    Steps to reproduce the issue

    I don’t have a good reproducible test case. I’ll try to install debugging symbols and see if I can catch the exception in a debugger.

    Versions

    3.24.0, 3.24.1, 3.22.5

    Supported QGIS version

    • I’m running a supported QGIS version according to the roadmap.

    New profile

    • I tried with a new QGIS profile

    Additional context

    No response

    Я пытаюсь заполнить двумерный вектор (817 на 577) объектами, называемыми ячейками. Эти ячейки имеют набор значений элементов (поплавки, другие векторы и т.д.). В какой-то момент программа останавливается и выдает ошибку "vector<T> too long". Вот определение класса ячеек и полный цикл:

    struct cell
        {
        int x;
        int y;
        int country;
        vector<int> popO;
        vector<int> popS;
        vector<float> Rainfall;
        double Cropland;
        vector<movement> outm;
        vector<movement> inm;
        vector<double> AgeMaleFemale;
        vector<double> AgeMaleFemaleMortality;
        double Fertility;
        };
    vector<vector<cell>> cells;
    void fillCells(dataserver D)
            {
            cout<<"start filling"<<endl;
            int rows=577;
            int columns=817;
            cell X;
            vector<vector<cell>> output(rows,vector<cell>(columns,X));
            cout<<"start loop"<<endl;
            for (int i=0;i<rows;i++)
                {
                cout<<i<<" ";
                for (int j=0;j<columns;j++)
                    {
                    int p=-9999;
                    cell tmpC;
                    tmpC.x=i;
                    tmpC.y=j;
                    tmpC.country=D.CO[i][j];
                    tmpC.popO.resize(3,0);
                    tmpC.popO[0]=int(D.PO[0][i][j]);
                    tmpC.popO[1]=int(D.PO[1][i][j]);
                    tmpC.popO[2]=int(D.PO[2][i][j]);
                    tmpC.Rainfall.resize(10,0);
                    for (int k=0;k<10;k++)
                        {
                        tmpC.Rainfall[k]=D.R[k][i][j];
                        }
                    tmpC.popS.resize(10,0);
                    tmpC.Cropland=D.CPC[i][i];
                    if (tmpC.country!=-9999)
                        {
                        tmpC.Fertility=D.F[tmpC.country];
                        tmpC.AgeMaleFemale.resize(18,0);
                        tmpC.AgeMaleFemale=D.AMF[tmpC.country];
                        tmpC.AgeMaleFemaleMortality.resize(18,0);
                        tmpC.AgeMaleFemaleMortality=D.M[tmpC.country];
                        }
                    output[i][j]=tmpC;
                    }
                }
            cells=output;
            }
    

    Несколько раз я обнаружил, что sizeof (cell) раз число ячеек в векторе предполагается меньше, чем vector :: max_size()

    sizeof (ячейка) составляет 144 → 144 * 817 * 577 = 67882896

    max_size — 268345455

    Разве не должно быть достаточно места для всех ячеек, или я чего-то не хватает? Заранее спасибо!

    Дополнительная информация:

    Запуск на Windows 7 64bit, компиляция с Visual Studio 2010, 32 бит

    Информация о max_size действительно появилась здесь: stl «vector <T> too long»

    I’m attempting to import a schematic layout however in the DWG/DXF import menu, I get the «vector too long» error message for ~1400 entities. It’s my first time importing a DWG file, so I’m unsure how to proceed.

    asked Nov 4, 2020 at 22:31

    McGrawson's user avatar

    3

    Понравилась статья? Поделить с друзьями:
  • Qbittorrent ошибка при загрузке торрента
  • Qbittorrent ошибка ввода вывода отказано в доступе
  • Qbittorrent выдает ошибку при скачивании
  • Qashqai сброс ошибки подушки безопасности nissan
  • Python условие если ошибка то