Questions tagged [pyshp]

Pyshp is a Python module for manipulating Shapefiles, which are widely used in Geographic Information Systems.

Pyshp is a Python module for manipulating Shapefiles, which are widely used in Geographic Information Systems.

See https://pypi.python.org/pypi/pyshp

33 questions
0
votes
0 answers

pyshp error reading past 24.212.714 geometries

In a python (v. 3.10.6) script, trying to read a large shapefile (.shp 825.4 Mb, .dbf 7.8 Gb, .shx 235.8 Mb) with 29 million geometries: import shapefile n_rec = 0 shp = shapefile.Reader(file_in) for rec in…
Luca Guida
  • 186
  • 10
0
votes
0 answers

import pyshpgeocode ModuleNotFoundError

I'm struggling to run pyshpgeocode. This Python package is for reverse geocoding of data points to shapefile regions. My final goal is to be able to fetch NUTS-2 code from latitude and longitude contained in a dataframe lat | lon 54.3077 | 12.7 …
fredooms
  • 123
  • 8
0
votes
1 answer

Dictionary has newline after a given number of characters

I use the pyshp library to retrieve the coordinates of a shape. sf = shapefile.Reader(r"{}".format(boundary_file)) shapes = sf.shapes() fields = sf.fields records = sf.records() for record in records: if record['NAME'] in cities_list: …
Paul Nicoara
  • 107
  • 6
0
votes
1 answer

pyshp generate random points in shapefile

I want to generate 1000 random points within a specific ZIP Code Tabulation Area shapefile using pyshp. My code is: import shapefile zctashape = shapefile.Reader('C:/mypath/tl_2019_us_zcta510.shp') shapefile_len =…
Ralph Asher
  • 192
  • 9
0
votes
0 answers

How to write or save a shapefile geometry to float32 datatype?

I am currently working on the data structure of shapefile using python and geopandas, shapely, and pyshp. To minimize the total size of a shapefile, the geometry column's datatype should be float32. I've tried many times to convert flaot64 to…
lyman song
  • 21
  • 3
0
votes
1 answer

How do you reproject a shapefile?

I'm trying to change the projection of my shapefile from "epsg:26741" to "epsg:4326" using python code. I have looked up how to do this online and found some code, but when I run the code, it throws an error message. This gets thrown specifically in…
Ice
  • 1
0
votes
1 answer

How to fix "TypeError: Object of type 'bytes' is not JSON serializable" using pyShp in python3

I'm currently using pyShp to convert a shapefile into a geojson file. I saw a lot of people using the same script as me but i trully don't know why it's not working on my computer. I have the same error again and again but i don't understand where…
0
votes
0 answers

Divide the Shapefile into multiple parts using PyShp

Trying to divide the Shapefile into multiple parts based on the size. If the filesize of the Shapefile's zip file is more than 10 MB will divide it into chunks. Earlier we used Geopandas for this task and it was working fine but was consuming more…
Venkatesh_CTA
  • 120
  • 10
0
votes
0 answers

changing the edge color in shapefiles

working with shape files. I am able to produce a map, but how do I get rid of the edge colors. they are currently black code…
Franco Pettigrosso
  • 4,056
  • 2
  • 20
  • 32
0
votes
1 answer

Problems deleting records from a Shapefile using Editor() class in pyShp

I'm using pyShp to add three polygons in a new shapefile. I added the geometry and the records (attributes). So far no problem. Later, I wanted to use the Editor() class to delete one of the three polygons. If I try to delete the last one 'P3', it…
Daniel
  • 87
  • 1
  • 7
0
votes
2 answers

Remove a record from shapefile with python

I have an ESRI shapefile .shp (with all associated files like .shx, .dbf and many more) which I want to edit - I need to remove the first record and save the file. For this purpose I installed pyshp and tried to parse and edit the shapefile. This is…
cezar
  • 11,616
  • 6
  • 48
  • 84
0
votes
0 answers

Working with shapefiles in Python

I am currently working on the problem of generating roads from Openstreetmap files. I use these Osm files to create a shapefile from all different road types with different roadway numbers, widths and so on. Later on, I would also like to use…
freddykrueger
  • 309
  • 4
  • 17
0
votes
0 answers

How to find out if coordinate is within shape (.shp file) in python (maybe through pyshp package)?

I'm trying to map coordinate data to a municipality. Reverse geocoders aren't as accurate as I need them to be, so I found a .shp that maps all the municipalities. I'm not familiar with .shp files, and was hoping someone familiar with it could help…
0
votes
0 answers

creating a shape file with pyshp

I have a question and hope someone can help me. I am trying to create a Shape File with Python3. This also works, but if I want to display the file in qgis 2.18.0, I can not zoom into the layer. The shapefile I have created with pyshp. The…
dom
  • 1
0
votes
1 answer

Python filtering with "if" does not filter anything?

I have a list containing lists in two dimensions, so for example records[a][b] would be one value in it. There are some criteria that should filter it. I used a combination of "for" and "if" to do so and it worked. Then some additional criteria had…
Homerun_
  • 13
  • 5