question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to import linestring and polygon shapefile

See original GitHub issue

Hi, I tried to use GeoPandas to import linestring and polygon data using Jupyter lab. However, every time I run the code, my kernel died and python quit unexpectedly. It does not even work with the example data.

import geopandas as gpd
path = gpd.datasets.get_path('nybb')
gdf = gpd.read_file(path)

image

The thing is when I loaded point data, there is no problem at all, only line and polygon data.

I tried to import the same line and polygon using fiona and gdal. They all worked very well. There is also no problem when I load the data in using terminal python, QGIS, and R.

I tried to uninstall and then reinstall GeoPandas, anaconda. None of them worked. This is really weird. I cannot think of any reasons why this happens. I have been struggling for two days. Can someone help me?

Python 3.7.4 macOS Catalina version 10.15.1 (19B88)

edited by @martinfleis to include whole affected code

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
martinfleiscommented, Nov 4, 2019

I installed geopandas using pip. The environmental on my laptop is kind of a mess.

I would say that is the actual cause of this. As you have installed geopandas and its dependencies using PIP, you have to make sure yourself that all dependencies (especially those relying on C like Fiona) are compatible. I would recommend trying new environment and installing everything using conda from conda-forge as is outlined in our documentation. Would that be possible?

In this case it is hard to help as we are unable to replicate the issue. I even tried to install everything using pip and I am still unable to reproduce it. Looking into the code, I have no clue what should cause this, especially if points are okay.

0reactions
XiaozheYincommented, Nov 4, 2019

@martinfleis It works! I did what you suggested. Created a new conda environmental in anaconda3 and installed a ipykernel in it. Now everything works like a charm. No problem importing line or polygon data. Thank you so much for your help! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostgreSQL Shapefile import failed - GIS Stack Exchange
Simple solution: from the "SRID" in the PostGIS, Check the EPSG value from QGIS and paste it in the SRID then your problem...
Read more >
Receiving errors when uploading a shapefile to ArcGIS Online ...
Solution or Workaround · The shapefile must contain valid geometries. Currently, self-intersection in polygon shapefiles is not supported. · The ...
Read more >
Why has my Shapefile Import Failed? - Local Insight Help Centre
It's possible there may be blank or ill-formatted data for an area entry. If this is detected, the tool will not import this...
Read more >
Clipping Line shapefiles within the extent of Polygon shape
My question is an extension of Vertical lines in a polygon shapefile. Kindly refer to that question first. What you shall see there...
Read more >
#3641 (Bug in ShapeFile to postgis import Tool) – QGIS
Hi, I opened the dxf with TatukGIS viewer and I saw that it seems to be a mix of polygons and linestring. Can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found