Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes with data layers #58527

Open
1 of 2 tasks
josecarlosbcn opened this issue Aug 29, 2024 · 1 comment
Open
1 of 2 tasks

Application crashes with data layers #58527

josecarlosbcn opened this issue Aug 29, 2024 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Feedback Waiting on the submitter for answers PyQGIS Related to the PyQGIS API

Comments

@josecarlosbcn
Copy link

josecarlosbcn commented Aug 29, 2024

What is the bug or the crash?

I'm totally newbie with QGis.

I want to draw in a layer several polygons. To do this, I load the data in the layer from a csv file. This csv file has a total amount of 65.000 rows and a weight of 109MB. The load of information in the layer works fine.

The problem is when I try to get this information and process it.

the 65,000 records in the csv file but when I read the information the application crashes.

Steps to reproduce the issue

If I try to process the total amount in a batch processing.

`
layer = iface.activeLayer()
features = layer.getFeatures()

batch_size = 5000
batch = []

def process_batch(batch):
for feat in batch:
id_pts = feat["id_"]
pts_perim = feat["points"]
print(id_pts)
#print(pts_perim)
print("Batch processing succesfully!!!")

for i, feat in enumerate(features):
batch.append(feat)
print(f"Feature {i} added to the list")
if i % batch_size == 0:
process_batch(batch)
batch = []
`

The process usually to crash in this line of code for i, feat in enumerate(features):

And it's not possible to advance because the application crashes. ¡¡¡In other computer happens the same!!!

However, If I try to get access to the information loading this infromation over a dataframe, I can run through the entire dataframe and print the value of the variable id_ on the screen.!!!

Here is my code:

`
import pandas as pd
pd.options.display.max_columns = None

df = pd.read_csv('F:\Proyectos\QGis\cent_cont_P8_xd3_id.csv')

df["points"] = df["points"].astype("string")
#df["coords"] = df.points.split(";")

df["coords"] = 0
for index, row in df.iterrows():
df["coords"][index] = df["points"][index]
df["coords"][index] = df["points"][index].split(";")
df["coords"][index] = [tuple(map(float, cadena.strip('()').split(','))) for cadena in df["coords"][index]]

batch_size = 5000
batch = []

for index, row in df.iterrows():
print(row["id_"])
print("Proceso finalizado!!!")

`
This code works for me from time to time. Because the same code with the same data sometimes works fine and another the application crashes. But in another computer the application crashes always!!! How is that possible? This other computer has installed the version 3.23 of QGis.

I am desperate, because I have learned how to create a polygon on the layer, but now I need to create a polygon based on each of the registers of the csv file, around 65.000 polygons.

Versions

<style type="text/css"> p, li { white-space: pre-wrap; } </style>
Versión de QGIS 3.34.10-Prizren Revisión del código de QGIS 113de9e
Versión Qt 5.15.13
Versión de Python 3.12.5
Versión de GDAL/OGR 3.9.2
Versión de PROJ 9.4.0
Versión del registro de base de datos EPSG v11.004 (2024-02-24)
Versión de GEOS 3.12.2-CAPI-1.18.2
Versión de SQLite 3.45.1
Versión de PDAL 2.6.3
Versión del cliente de PostgreSQL 16.2
Versión de SpatiaLite 5.1.0
Versión de QWT 6.2.0
Versión de QScintilla2 2.14.1
Versión del SO Windows 10 Version 2009
       
Complementos activos de Python
db_manager 0.1.20
grassprovider 2.12.99
MetaSearch 0.3.6
processing 2.12.99
Versión de QGIS 3.34.10-Prizren Revisión del código de QGIS [113de9e](https://github.com/qgis/QGIS/commit/113de9e1) Versión Qt 5.15.13 Versión de Python 3.12.5 Versión de GDAL/OGR 3.9.2 Versión de PROJ 9.4.0 Versión del registro de base de datos EPSG v11.004 (2024-02-24) Versión de GEOS 3.12.2-CAPI-1.18.2 Versión de SQLite 3.45.1 Versión de PDAL 2.6.3 Versión del cliente de PostgreSQL 16.2 Versión de SpatiaLite 5.1.0 Versión de QWT 6.2.0 Versión de QScintilla2 2.14.1 Versión del SO Windows 10 Version 2009

Complementos activos de Python
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99

Supported QGIS version

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

New profile

Additional context

No response

@josecarlosbcn josecarlosbcn added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Aug 29, 2024
@agiudiceandrea agiudiceandrea added Crash/Data Corruption PyQGIS Related to the PyQGIS API labels Aug 31, 2024
@nyalldawson
Copy link
Collaborator

More information is required here. Please provide the full script and sample data which demonstrates the crash.

@nyalldawson nyalldawson added the Feedback Waiting on the submitter for answers label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Feedback Waiting on the submitter for answers PyQGIS Related to the PyQGIS API
Projects
None yet
Development

No branches or pull requests

3 participants