big integer i/o handling
See original GitHub issueIf I create a GeoDataFrame like this:
import geopandas as gpd
import pandas as pd
from shapely.geometry import Point
d = {'id' : [3694063472, 3694063473],
'geometry' : [Point((-122.278015,37.868995)),
Point((-122.278876,37.868895))]}
gdf = gpd.GeoDataFrame(d)
gdf
Returns:
geometry id
0 POINT (-122.278015 37.868995) 3694063472
1 POINT (-122.278876 37.868895) 3694063473
If I save to csv as a pandas Dataframe and read it back in:
pd.DataFrame(gdf).to_csv('test.csv', index=False)
pd.read_csv('test.csv')
Returns:
geometry id
0 POINT (-122.278015 37.868995) 3694063472
1 POINT (-122.278876 37.868895) 3694063473
Everything’s the same. But if I save to disk as a shapefile:
gdf.to_file('test_shp')
gpd.read_file('test_shp')
Returns:
id geometry
0 2147483647 POINT (-122.278015 37.868995)
1 2147483647 POINT (-122.278876 37.868895)
Writing my GeoDataFrame to disk and reading it back in results in my id field’s values silently being changed to 2147483647, the max value for a 32-bit signed integer. This is in geopandas 0.3.0 with fiona 1.7.11.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
BigInteger (Java Platform SE 7 ) - Oracle Help Center
Class BigInteger. Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java's ...
Read more >BigInteger Class in Java - GeeksforGeeks
BigInteger class is used for the mathematical operation which involves very big integer calculations that are outside the limit of all ...
Read more >Java Scanner nextBigInteger() Method - Javatpoint
This is a Java Scanner class method which is used to scan the next token of the input as a BigInteger in the...
Read more >Big Int in Go : Handling large numbers is easy - Dev Genius
To solve this problem, Go provides the Package “big” which implements arbitrary-precision arithmetic (big numbers). Description. The following numeric types are ...
Read more >how to input a BigInteger type in java - Stack Overflow
Scanner scanner = new Scanner(fileOrOther); try{ BigInteger bigint = scanner.nextBigInteger(); } catch(NumberFormatException ex) { //handle Code here }.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is fixed on fiona master now.
@jorisvandenbossche I’ve got a solution (for Fiona 1.8) coming up. Meanwhile, I suggest this mapping of Python/Numpy types to Fiona/GDAL types: