Questions tagged [shapefile]

The Esri shapefile or simply a shapefile is a popular geospatial vector data format for geographic information systems (GIS) software. Questions about shapefiles are best asked on the GIS Stack Exchange.

For questions about shapefiles it is recommended that you research/ask at the GIS Stack Exchange.

Excerpt from Wikipedia:

The Esri Shapefile or simply a shapefile is a popular geospatial vector data format for geographic information systems software. It is developed and regulated by Esri as a (mostly) open specification for data interoperability among Esri and other software products.

Shapefiles spatially describe geometries: points, polylines, and polygons. Each item may also have attributes that describe the items.

A "shapefile" is actually a set of several files. Three individual files are mandatory to store the core data that comprises a shapefile: .shp, .shx, .dbf

1985 questions
7
votes
5 answers

Import shape file into postgis?

I can find multiple tutorials that show how to import shapefiles to postgis via pgAdmin-3. But pgAdmin-3 is no longer supported. How to do this with pgAdmin-4?
Henrik K
  • 157
  • 1
  • 1
  • 6
7
votes
1 answer

Plotting shp file in leaflet, works in ggplot

I'm stumped getting my dataframe to plot in leaflet. I have one shapefile and one csv that I merged together. The resulting dataframe has several columns, including long, lat, and "percent". I am able to plot this using ggplot with the following…
Claire
  • 73
  • 1
  • 4
7
votes
1 answer

Mask area outside of imported shapefile (basemap/matplotlib)

I'm plotting data on a basemap of the eastern seaboard of the U. S. and Canada through Matplotlib. In addition to the base layer (a filled contour plot), I overlayed a shapefile of this focus region atop the data using Matplotlib's readshapefile…
user2607622
  • 113
  • 1
  • 4
7
votes
3 answers

How to get shapefile geometry type in PyQGIS?

I'm writing a script that is dependent on knowing the geometry type of the loaded shapefile. but I've looked in the pyqgis cookbook and API and can't figure out how to call it. infact, I have trouble interpreting the API, so any light shed on that…
Steven Lutz
  • 467
  • 1
  • 6
  • 16
7
votes
2 answers

Convert table of coordinate to shape file using R

I have a dataset of point coordinate in UTM zone 48. x y 615028.3 2261614 615016.3 2261635 614994.4 2261652 The CSV file here. I would like to load the CSV and create shapefile using R. My code…
anh.hv
  • 91
  • 1
  • 1
  • 4
7
votes
2 answers

Algorithm (and tools) to create a weighted-cartogram from a shapefile?

What algorithm can I use to produce a weighted-cartogram such as the one below: ? I can generate a shapefile plot using code from R, .NET libraries and also using PostGIS. However I can't find the search terms to use to find an implementation of…
JustinJDavies
  • 2,663
  • 4
  • 30
  • 52
7
votes
2 answers

Python: how to create a point shape-file from a text file

I'm writing a python code to read the points in a polygon shape-file and save them in a point shape file. So first I made a text file and stored the points' (x,y) in that .txt file. then I tried to make a point shape-file from the text file but it…
user2841098
  • 313
  • 5
  • 12
7
votes
1 answer

How do you combine a map with complex display of points in ggplot2?

I'm trying to plot points from study sites with a background map of Africa. I can create the two independently, but I am having a hard time overlaying them on top of eachother. The map of Africa I am using is an Esri shapefile from maplibrary.org. …
David
  • 265
  • 4
  • 13
7
votes
3 answers

Automatically fixing ring self-intersections in shp2pgsql

We're importing a whole bunch of ArcGIS shapefiles into PostGIS, converted on the fly with shp2pgsql. Problem is, if the shapefiles have any ring self-intersections, the import chokes: NOTICE: Ring Self-intersection at or near point -80.1338…
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
6
votes
1 answer

Plotting polygon shapefiles and geom_points with ggplot2

I've been struggling with this plot and would appreciate any help. I am trying to plot a polygon over my geom_points. This is what I've done so far: > names(OT1)# my dataset [1] "EID" "latitude" "longitude" "month" "year" "CPUE" …
GodinA
  • 1,053
  • 3
  • 17
  • 27
6
votes
2 answers

Convert multipolygon geometry into list

How can I please convert a multipolygon geometry into a list? I tried this: mycoords=geom.exterior.coords mycoordslist = list(mycoords) But I get the error: AttributeError: 'MultiPolygon' object has no attribute 'exterior'
mee
  • 688
  • 8
  • 18
6
votes
4 answers

How to convert shapefile/geojson to hexagons using uber h3 in python?

I want to create hexagons on my geographic map and want to preserve the digital boundary specified by the shapefile/geojson as well. How do I do it using uber's h3 python library? I'm new to shapefiles or any other geographic data structures. I'm…
lipika sharma
  • 61
  • 1
  • 3
6
votes
2 answers

UnicodeDecodeError 'utf-8' codec can't decode - using python shapefile reader

I'm trying to read a shapefile r = shapefile.Reader(filepath, encoding = "utf-8") but when I try to get a value from the .records() object like: r.records()[0] it returns to me the following error: UnicodeDecodeError: 'utf-8' codec can't decode…
Paulo Calado
  • 195
  • 1
  • 3
  • 7
6
votes
2 answers

How to convert a sample dataset from the R package "spatstat" into a shapefile

I have written a kernel density estimator in Java that takes input in the form of ESRI shapefiles and outputs a GeoTIFF image of the estimated surface. To test this module I need an example shapefile, and for whatever reason I have been told to…
RyanMullins
  • 315
  • 1
  • 3
  • 15
6
votes
1 answer

rasterFromXYZ() Error in rasterFromXYZ() : x cell sizes are not regular

I am trying to plot points from a df (xyz/latlonvalue) as raster over a geom_sf shapefile. I tried the answers from another post but none of them helped. The data structure is below. First I try raster::rasterFromXYZ(df) then the code from the…
ecology
  • 606
  • 3
  • 9
  • 29