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
2
votes
1 answer

Overlaying Shapefile datapoints on Density Map

I am new to shapefiles and mapping in python so I was hoping to get some help with overlaying data points from a shapefile on a density map. To be honest, I am a beginner with mapping and reading in shapefiles so what I have so far not much. I have…
C.G
  • 87
  • 1
  • 7
2
votes
1 answer

Problems with multipart shapes using PyShp when creating a new Shapefile

I have a shapefile (blockgroups.shp) that I downloaded from: https://github.com/GeospatialPython/pyshp/tree/master/shapefiles I want to create a new Shapefile with only four attributes (bkg_key, pop1990, white and black) using PyShp. I've tried…
Daniel
  • 87
  • 1
  • 7
2
votes
0 answers

Flask uploading shapefiles into postgis

I am trying to upload a shapefile into PostGIS. I am using Flask and have gotten the files from the user (.shp, .shx, .dbf and .prj) and saved them to temporary files before using PYSHP python library to access the shapes collection. r =…
mjb
  • 65
  • 7
2
votes
2 answers

Given latitude/longitude say if the coordinate is within continental US or not

I want to check if a particular latitude/longitude is within continental US or not. I don't want to use Online APIs and I'm using Python. I downloaded this shapefile from shapely.geometry import MultiPoint, Point, Polygon import shapefile sf =…
Ash
  • 3,428
  • 1
  • 34
  • 44
2
votes
1 answer

DBF Table Join without using Arcpy?

I have created a rather large CSV file (63000 rows and around 40 columns) and I want to join it with an ESRI Shapefile. I have used ArcPy but the whole process takes 30! minutes. If I make the join with the original (small) CSV file, join it with…
Kai
  • 299
  • 6
  • 13
1
vote
1 answer

How to import shapefile

I have installed the pyshp package in my command prompt pip install pyshp and it's successful ("Requirement already satisfied"). But I'm having problems importing shapefile into Jupyter Notebook with import shapefile as sh this gives the error:…
speck
  • 31
  • 4
1
vote
0 answers

How to append data to shapefile?

I have a shapefile. and some data there. It's the way I created it: w = shapefile.Writer('shapefiles/test/line_2') w.field('Latitude','C') w.poly(arr) w.record('linestring3') w.close() Now, I want to append data to this shapefile. How it can be…
ivan100096
  • 119
  • 1
  • 5
1
vote
1 answer

reading shp file with pyshp jupyter

import numpy as np import pandas as pd import shapefile as shp import matplotlib.pyplot as plt import seaborn as sns shp_path = 'seoul\seoul.shp' sf = shp.Reader(shp_path) sf.records()[1] and then finally I got this error UnicodeDecodeError:…
1
vote
0 answers

raise exception line 1029, in __init__

i have an error at my generate code, this is my code import shapefile w=shapefile.Writer() w.shapeType w.field("kolom1","C") w.field("kolom2","C") w.record("ngek","satu") w.record("ngok","dua") w.point(1,1) w.point(2,2) w.save("soal1") and i…
1
vote
1 answer

CSV TO SHAPEFILE - Using pyshp

I need a help. I got some CSV files with geographic information and I need to convert it to SHP... I'm trying the following code, but it's not working.. This is my first time working with python.. I'd really appreciate if you could help me. import…
Lucas Fusco
  • 75
  • 1
  • 8
1
vote
1 answer

Given a geographical coordinate in U.S., how to find out if it is in Urban or Rural areas?

Given a geographical coordinate in U.S., how to find out if it is in Urban or Rural areas? I have about 10000 geographical coordinates all in the U.S., and I want to use Python + basemap to find out if a point is urban or rural. I'm not sure which…
Ash
  • 3,428
  • 1
  • 34
  • 44
1
vote
1 answer

importing a shapefile to python with pyshp

I'm trying to import the shapefile "Metropolin_31Jul_0921.shp" to python using the following code: import shapefile stat_area_df = shapefile.Reader("Metropolin_31Jul_0921.shp") but i keep getting this error: File…
1
vote
2 answers

Creating a shapefile of straight segments with pyshp?

Using Python and the pyshp library, I am attempting to create a shapefile from the data below (stored in a list): edge_list = [ [-40.5, -20.666], [-39.849998, -18.700001], [-39.816002, -19.6], [-40.071999, -19.391001], …
maurobio
  • 1,480
  • 4
  • 27
  • 38
1
vote
1 answer

Converting/Serializing dictionaries containing a large list of value pairs into a json file in python

Currently I try to convert data from an ESRI shapefile (.shp) to a Json file using the json package. In this process, I want to convert a dictionairy containing the coordinates of a lot of different points: json.dumps({"Points" : coordinates})…
Jannik
  • 13
  • 2
0
votes
0 answers

Why are my reprojected shapefiles containing only 'Inf' coordinates in PyShp and GeoPandas?

I am trying to reproject a multi-part shapefile which has the projection EPSG:4326 to the same projection as my data raster, which has EPSG:32633. I thought this would be fairly straightforward to do using geopandas, this is the code I use: shpfile…
hannahv
  • 1
  • 1
1
2 3