TransWikia.com

Getting more precision with GeoPandas?

Geographic Information Systems Asked on April 13, 2021

Geopandas

Reading a shapefile with GeoPandas and printing its total bounds:

dataframe = gpd.read_file('example.shp')
print(dataframe.total_bounds)

Prints: [ 663590.5817 1541419.8307 724630.0589 1595869.4839]

PyQGIS

Doing the same with PyQGIS:

QgsApplication.setPrefixPath("/usr", True)
qgs = QgsApplication([], False)
qgs.initQgis()
layer = QgsVectorLayer('example.shp', 'layer1', 'ogr')
print(layer.extent())

Prints: <QgsRectangle: 663590.58169999998062849 1541419.83070000074803829,
724630.05890000029467046 1595869.48389999940991402>


As you can see doing it with PyQGIS gives you more precision than doing it with GeoPandas.

Is there any way to get the same precision with GeoPandas?

One Answer

Try using pandas (pd) settings: pd.set_option('max_colwidth', value)

look here for more info: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.set_option.html

Answered by Ofir on April 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP