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.

Filter by
Sorted by
Tagged with
8 votes
4 answers
3k views

b'Recode from ANSI 1252 to UTF-8 failed with the error: "Invalid argument".' geopandas python

I am trying to read in a shapefile into a GeoDataFrame. Normally I just do this and it works: import pandas as pd import geopandas as gpd from shapely.geometry import Point df = gpd.read_file("...
Julien's user avatar
  • 992
8 votes
1 answer
6k views

Split or save a subset of a ESRI Shape SHP file to a new file?

I'm working with shape files in GeoDjango. Right now I'm trying to write a test for code that loads in a shape file and saves it to a database. The shape file currently has a feature count of 64,118....
Eric Palakovich Carr's user avatar
8 votes
2 answers
16k views

How to import a shape file into SQL Server?

In the past I have used shape2sql to import shape files into SQL Server. I tried that route again on a newer Windows 10 box, and nothing seems to happen when trying to use that application. Any ...
Jereme's user avatar
  • 1,445
8 votes
1 answer
14k views

R - stuck with plot() - Colouring shapefile polygons based upon a slot value

I have a shapefile showing remote areas in Australia, obtained from the Australian Bureau of Statistics: http://www.abs.gov.au/AUSSTATS/[email protected]/DetailsPage/1270.0.55.005July%202011?OpenDocument At ...
Michael Henry's user avatar
8 votes
5 answers
5k views

TimeZone by Coordinate [duplicate]

As the title infers I need to find a time zone (or perhaps just the UTC offset) based on a pair of coordinates. I've been searching for different solutions, and there is a couple of web services out ...
Morten's user avatar
  • 1,859
8 votes
2 answers
7k views

Android lib to read or parse shapefile

is there any library that is able to read parse a .shp file, preferably on where I don't need to use NDK. I was trying to use GeoTools but i can't seam to get it to work on Android.
Hugo Alves's user avatar
  • 1,555
8 votes
4 answers
4k views

How can I transform the coordinates of a Shapefile?

I am trying to get neighborhood data into my application, and I'm having problems with the data I am using, which I got from here. This file contains a shapefile that has the neighborhoods of San ...
Larry's user avatar
  • 664
8 votes
1 answer
941 views

Extract routes between stations from a rail network shapefile

Problem: I want to extract a route along the rail network between two stations from a shapefile and only plot this particular route, rather than the entire network. This is what I have so far: I ...
Gwenywar's user avatar
8 votes
1 answer
3k views

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 ...
user2607622's user avatar
7 votes
5 answers
15k views

Import shape file into postgis? [closed]

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's user avatar
  • 157
7 votes
4 answers
11k views

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 ...
lipika sharma's user avatar
7 votes
3 answers
12k views

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 ...
lambshaanxy's user avatar
  • 22.8k
7 votes
3 answers
10k views

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 ...
Steven Lutz's user avatar
7 votes
2 answers
3k views

Shapefile with ObjectiveC

I like to know if there is a Class, in objective-C, that manipulates shapefile (read/write/edit)? I have found a bunch of stuff on kml files but nothing about shp files, but definitely want to avoid ...
shadowing's user avatar
7 votes
4 answers
12k views

can't open shape file with GeoPandas

I don't seem to be able to open the zip3.zip shape file I download from (http://www.vdstech.com/usa-data.aspx) Here is my code: import geopandas as gpd data = gpd.read_file("data/zip3.shp") this ...
Fred R.'s user avatar
  • 567
7 votes
1 answer
4k views

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 ...
David's user avatar
  • 265
7 votes
2 answers
737 views

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 ...
JustinJDavies's user avatar
7 votes
2 answers
12k views

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 ...
anh.hv's user avatar
  • 91
7 votes
1 answer
6k views

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 ...
Claire's user avatar
  • 73
7 votes
2 answers
7k views

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 ...
user2841098's user avatar
6 votes
2 answers
14k views

Count number of points in multipolygon shapefile using Python

I have a polygon shapefile of the U.S. made up of individual states as their attribute values. In addition, I have arrays storing latitude and longitude values of point events that I am also ...
wuffwuff's user avatar
  • 760
6 votes
1 answer
8k views

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" "...
GodinA's user avatar
  • 1,073
6 votes
2 answers
13k views

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 ...
mee's user avatar
  • 688
6 votes
2 answers
3k views

Using Shapefile data to determine neighborhood for a longitude/latitude

I'm trying to determine the neighborhood for a location, based on Zillow's freely published Shapefile data. I don't really know anything about the Shapefile format, and am having some trouble finding ...
Kunal's user avatar
  • 155
6 votes
2 answers
19k views

Easiest way to plot data on country map with python

Could not delete question. Please refer to question: Shade states of a country according to dictionary values with Basemap I want to plot data (number of sick people for a certain year) on each ...
RM-'s user avatar
  • 998
6 votes
2 answers
2k views

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,...
RyanMullins's user avatar
6 votes
2 answers
5k views

Merging a Shapefile and a dataframe

I am working in R with a regular dataframe (df) and a shapefile (map2), the share a common column called CD116FP. df has 103552 lines while map2 has 444 .I am loading the shapefile in the following ...
Weierstraß Ramirez's user avatar
6 votes
2 answers
4k views

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 ...
Paulo Calado's user avatar
6 votes
1 answer
14k views

Geojson to shapefile using Python

I'm trying to convert a geojson file into a shapefile. I'm trying this way (I'm very new to Python so it might be incorrect). import urllib, geojson, gdal url= ' http://ig3is.grid.unep.ch/istsos/wa/...
Gus's user avatar
  • 85
6 votes
2 answers
1k views

How to combine state-level shapefiles from the united states census bureau into a nationwide shape

The census bureau doesn't provide a nationwide shapefile of public use microdata areas (the smallest geography available on the American Community Survey). I tried combining them all with a few ...
Anthony Damico's user avatar
6 votes
1 answer
3k views

Mercator projection world map with Geoserver and Openlayers

I'm trying to render a world map shapefile on my Geoserver with a Mercator projection. I've tried declaring the SRS on Geoserver and defining EPSG projections of 3785 or 900913 in Openlayers with no ...
bjaxbjax's user avatar
  • 1,391
6 votes
1 answer
8k views

Adding custom Feature attributes to ESRI Shapefile with Python

I am seeking a way to take an existing ESRI Shapefile that has a Feature set of 200 countries. Each country Feature has an attribute of "NAME." My objective is to create a Python script that adds an ...
mattdeboard's user avatar
6 votes
1 answer
4k views

ggplot2: Combine shapefiles from two different geodatasets

I am trying to plot some geolocational data pertaining to Great Britain and Ireland in ggplot. Running the following code, I can successfully map some values from this tab-separated file onto the GBR ...
duhaime's user avatar
  • 26.6k
6 votes
3 answers
7k views

How to export WKT from a Shapefile in c#?

I have a Shapefile that contains several thousand polygons. I need to read from this file in C# and output a list of WKT formatted strings. I looked at DotSpatial and the "CatFood" ESRI Shapefile ...
Matt Johnson-Pint's user avatar
6 votes
1 answer
11k views

How to Convert SVG to SHP (Shape File) format? [closed]

I am trying to convert the SVG File to SHP (Shape File format) and then get it imported into GeoServer. Is there any convertor available OR is there any mediating format in which I can get it ...
user1517745's user avatar
6 votes
2 answers
10k views

coordinates conversion with pyproj

I am not experienced in gis coordinates conversion but managed, using this page: http://all-geo.org/volcan01010/2012/11/change-coordinates-with-pyproj/ to convert shapefile coordinates from EPSG:28992 ...
musicformellons's user avatar
6 votes
2 answers
2k views

making a choropleth in R: merging zip code shapefiles from multiple states

Motivated by the post here, Developing Geographic Thematic Maps with R, I was thinking about constructing a choropleth map based on zip codes. I've downloaded the shape files for New Hampshire and ...
andrewj's user avatar
  • 2,995
6 votes
1 answer
2k views

Reading Unzipped Shapefiles stored in AWS S3 from AWS EMR Cluster using PySpark in Jupyter Notebook

I'm completely new to AWS EMR and apache spark. I'm trying to assign GeoID's to residential properties using shapefiles. I'm not able to read the shapefiles from my s3 bucket. Please help me in ...
aditya bhandari's user avatar
6 votes
1 answer
515 views

Python: assign point to roads shapefile

I have some data points from gps data (Lat,Lon) and the relative shapefile of the area I am considering. So: import pandas as pd import shapefile sf = shapefile.Reader('roadshape') df = pd.read_csv('...
emax's user avatar
  • 7,043
6 votes
1 answer
4k views

How to use set clipped path for Basemap polygon

I want to use imshow (for example) to display some data inside the boundaries of a country (for the purposes of example I chose the USA) The simple example below illustrates what I want: import numpy ...
Dipole's user avatar
  • 1,890
6 votes
2 answers
3k views

How to limit the raster processing extent using a spatial mask?

I am trying to limit raster processing in MATLAB to include only areas within a shapefile boundary, similar to how ArcGIS Spatial Analyst functions use a mask. Here is some (reproducible) sample data ...
Borealis's user avatar
  • 8,264
6 votes
3 answers
19k views

Error with function fortify of ggplot2

I am trying to convert a spatial object into a data.frame using the function fortify from the package ggplot2. But I am getting an error. For example, following the exact same code used in Hadley ...
Jose Antonio H. Company's user avatar
6 votes
1 answer
3k views

Using ggplot to plot shapefile and gganimate for animation

Sample data library(raster) library(ggplot2) my.shp <- getData('GADM', country = 'FRA', level = 1) plot(my.shp) If I want to plot this data using ggplot: my.shp_f <- fortify(my.shp, region = ...
89_Simple's user avatar
  • 3,695
6 votes
1 answer
1k views

spatial join on two simple features {sf} with over 1 mil. entries as fast as possible

I hope this is not too trivial but I really can't find an answer and I'm too new to the topic to come up with alternatives myself. So here is the Problem: I have two shapefiles x and y that represent ...
Matthias_Stack's user avatar
6 votes
1 answer
298 views

I want to create a countour map from x, y and z and clip the data with the shapefile using ggplot

I have a data set with Eastings, Northings and Age. I want to plot the age for my data set. The dataset is upload in the following loation: https://www.dropbox.com/s/zmtxluhwuupb9iv/age%20at%202100....
Jd Baba's user avatar
  • 6,058
6 votes
1 answer
475 views

PHP - Generate kml from 'Point' shape

I'm using PHPShapefile library for generating KML and displaying data to the google map but while it comes to 'Point' shape its not working and not generating KML for same. Here is the code snippet ...
Wit Wikky's user avatar
  • 1,542
6 votes
1 answer
2k views

Displaying shape file or and OSM file in android as a map

I want to implement a Indoor Navigation application in android. My first task is to display the map in android. I have created the indoor map in both shape file and OSM file format. • I created the ...
direndd's user avatar
  • 652
6 votes
0 answers
2k views

Write Shapefile to AWS S3 with geopandas in Glue Python Shell

I have read shapefile in a zip format from my S3 bucket successfully through geopandas, but I get error when trying to output the same geodataframe as a shapefile to the same S3 bucket. The code below ...
Yan-Ru 's user avatar
6 votes
1 answer
3k views

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 ...
ecology's user avatar
  • 643
6 votes
2 answers
1k views

How to upload shapefile into Shiny App

I am trying to figure out how, using Shiny App, a user can submit a shapefile via fileInput and then map it on a leaflet basemap. I am stuck on the server.R script and unsure how to handle the user ...
dwiz's user avatar
  • 440

1
2
3 4 5
41