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
4 votes
2 answers
3k views

Creating random polygons within a set shapefiles boundary in R

I have a shapefile which is the national boundary line of Chile. If possible, I would like to randomly generate e.g. 1000 polygons within this area. I'm wondering what the best way would be to go ...
JPD's user avatar
  • 2,601
4 votes
1 answer
2k views

Add new column attribute to the shapefile and save it to database using Geotools Java

I am transforming a shapefile by adding a new column attributes. Since this task is performed using Java, the only option I know for now is using Geotools. I have 2 main concerns: 1. I am not able to ...
GeoFresher's user avatar
4 votes
1 answer
2k views

Intersection keeping non-intersecting polygons in sf - R

I'm looking to intersect 2 spatial layers, keeping all the non-intersecting features as well. My first layer is the SA2 from NSW, Australia, which look like enter image description here My second ...
Maximiliano Micheli's user avatar
4 votes
1 answer
5k views

How to place a shapefile on top of raster file in one plot, and then save the plot in a Jpeg file format

I am posting this question after three days searching the net but no success. Hope can get the answer here. Please do NOT delete the post as I did not find an answer for it here also. Thanks. I have ...
Canada2015's user avatar
4 votes
1 answer
3k views

Plot shapefile city borders on top of cartopy map

I'm trying to plot the outline of Bay Area city/town borders on top of a cartopy terrain map using a shapefile obtained here and following this example. For some reason, the borders don't show up, ...
Michael Boles's user avatar
4 votes
2 answers
3k views

how to import spatial data to mysql 8 (Mysql WorkBench 8.0)

I have been trying to load spatial data to mysql 8 db and seems like it is not working. the import data section basically does not move from 0% but the tables are created with null values on every ...
Travalour's user avatar
4 votes
1 answer
7k views

How to filter a shape file before plotting it in R

Just to try to filter a shape file to ease plotting I have a shape file downloaded from UK gov: http://geoportal.statistics.gov.uk/datasets/7ff28788e1e640de8150fb8f35703f6e_1/data?geometry=-76.678%...
Dennis Ng's user avatar
  • 371
4 votes
1 answer
6k views

How to change an attribute in Shapefile with a certain value with QGIS / Python

I want to use the Python Console in QGIS to change all attributes in a Shapefile with a certain value. I have a field named "ANB" and I want to change the value "2" in for example "3". I know how to ...
Robert BK's user avatar
4 votes
2 answers
7k views

Write Pandas Dataframe to DBF File?

I'm working with shapefiles, which have the attribute data stored in a DBF file. I need to manipulate the attributes using Pandas, and write the new DBF data back to disk. Unfortunately Pandas ...
Steve Maughan's user avatar
4 votes
1 answer
1k views

Listing Attribute values of Shape file ogrinfo/ogr2ogr

How do I list the values of an attribute in a shape file. ogrinfo -so -al build/SLA11aAust.shp shows the attributes. Which command to list values of STATE_CODE: : Layer name: SLA11aAust ...
Dawid's user avatar
  • 165
4 votes
1 answer
1k views

Testing point with in/out of a vector shapefile

Here is my question. 1. Intro a shapefile in polygon type represent the study area http://i8.tietuku.com/08fdccbb7e11c0a9.png some point located in the whole rectangle map http://i8.tietuku.com/...
Han Zhengzu's user avatar
  • 3,762
4 votes
4 answers
6k views

Opening SHP file in RStudio

I've a package of five files with all French administrative limits (available here). All these five files LIMITE_DEPARTEMENT.SHP/DBF/AVL/PRJ/SHX are in a the folder /home/jonathan/R. I use this code :...
jonathan's user avatar
  • 149
4 votes
1 answer
4k views

How can I plot shapefile loaded through fastshp in ggplot2?

I stumbled upon fastshp library and according to description (and my quick cursory tests) it really does offer improvements in time of reading large shapefiles compared to three other methods. I'm ...
radek's user avatar
  • 7,310
4 votes
1 answer
161 views

Getting "No SCHEMA dataset name was specified" while running FME script

While running the FME script I am encountering the following error message : No SCHEMA dataset name was specified (couldn't find a value for SCHEMA_2_DATASET' or SCHEMA_DATASET') I have upgraded to ...
Mritunjay's user avatar
4 votes
2 answers
256 views

Generating random locations along the outer border of a .shp polygon using R

I am able to generate random points within the polygons using the package sp, however I am interested in generating points along the outline of the polygon. For example, if I have a shapefile of a ...
mchen's user avatar
  • 61
4 votes
1 answer
5k views

Read a shapefile with character encoding

Is there a way to read a shape file with a specific character encoding? I'm trying to read in a Canadian shapefile that has special (French) characters in some of the names. I can convert them ...
Brandon Bertelsen's user avatar
4 votes
1 answer
3k views

Shade states of a country according to dictionary values with Basemap

I want to plot the map of Mexico and shade the states accordingly to a the values of a dictionary. I used the following code suggested in previous question (Easiest way to plot data on country map ...
RM-'s user avatar
  • 998
4 votes
1 answer
3k views

How to draw a line on a shapefile using Geotools

I have a shapefile that is opened and looks as such: Now I am attempting to draw a line from two points I click on that map; however the code they give for the QuickStart.java example is ...
Timothy Frisch's user avatar
4 votes
1 answer
824 views

Weird memory problems with ggplot maps

I'm trying to make some maps of the British Isles and have come across a very strange memory problem. My workflow is taking advantage of ggplot's layers to add new detail onto a base map. The base ...
jkeirstead's user avatar
  • 2,931
4 votes
1 answer
807 views

Importing non-English shapefiles

I'm trying to import a shape-file like this: fn <- "Proj1" my_shp <- readShapeSpatial(fn) On a windows-computer (32-bit) it works ok, but when I do the same from a Ubuntu-machine (64-bit, ...
Chris's user avatar
  • 2,256
4 votes
1 answer
4k views

specifying specific breaks in legend using ggplot2

library(raster) library(dplyr) library(ggplot2) get.shapefile.df <- function(shp.in, df.in, region.var){ require(sf) require(sp) require(plyr) require(ggplot2) shp.in@data$id <- rownames(...
89_Simple's user avatar
  • 3,695
4 votes
1 answer
239 views

Dissolving hexmap polygon shape files

I am trying to produce an outline for a hexagonal cartogram by dissolving the inner polygons via the unionSpatialPolygons or aggregate functions. I am getting stray hexs that do not dissolve... a ...
guyabel's user avatar
  • 8,174
4 votes
1 answer
229 views

Merging spanish shapefile with dataframe

I am having problems merging a Spanish provinces' shapefile with a particular dataframe. After merging them, somehow the shapes get linked to the false provinces (f.e. Barcelona returns the shape of ...
GGaudio04's user avatar
4 votes
2 answers
4k views

flatten/dissolve/merge entire shapefile

I've been using ogr2ogr to do most of what I need with shapefiles (including dissolving them). However, I find that for big ones, it takes a REALLY long time. Here's an example of what I'm doing: ...
stewart715's user avatar
  • 5,607
4 votes
2 answers
1k views

shapefile to neural network in R

I need to convert a shapefile (ESRI) of roads type SpatialLinesDataFrame in a neural network in R. I do not know how to remove nodes or vertices of the shape. Determine the length of each edge ...
Paul Dassori Artigas's user avatar
4 votes
2 answers
2k views

Displaying vector files in QT using GDAL/OGR

I am writing an application to load vector maps/shape files using gdal/ogr and display them onto a gui designed using Qt. I am new to dealing with vector files, I am not able to decide how to render ...
akshay202's user avatar
  • 596
4 votes
1 answer
6k views

readOGR(), "cannot open file" error

Let me begin by saying that I have exhaustively looked at the other threads that have dealt with readOGR errors, and have made several attempts to implement them for my own benefit. The issue I have ...
MLU0907's user avatar
  • 43
4 votes
1 answer
1k views

Shapefile to 2D grid as sparse matrix

I'm getting well and truly lost in all the bolt-on libraries for doing geospatial calculations with NumPy. What is the most straightforward way to take a shapefile (whose extent is the entire Earth), ...
zwol's user avatar
  • 138k
4 votes
1 answer
433 views

Shapefiles under 1000 features but ArcGIS Online not accepting it?

I have a couple of zipped shapefiles with around 100-150 features. I am trying to add them on ArcGIS Online (which accepts under 1000 features per shapefile) but it is unable to do so, indicating to ...
Toronto23's user avatar
  • 327
4 votes
2 answers
3k views

Extract polygons from shapefile using Geotools

I have a shape file (Sample.shp) along with two other files (Sample.shx and Sample.dbf), which has geometry (polygons) defined for 15 pincodes of Bombay. I am able to view the .shp file using the ...
Manisha's user avatar
  • 55
4 votes
6 answers
13k views

Error when opening shapefile

I am trying to open a shapefile in R, but I am getting the following error message: Error in getinfo.shape(filen) : Error opening SHP file I have checked other responses and most problems seem to ...
user3281487's user avatar
4 votes
1 answer
334 views

Is there a performance rationale for mixing a binary file's endianness?

I'm writing a parser for the most common geographic data storage type, a collection of files called a "shapefile". This is my first project where I've had to think about endianness. It turns out ...
canisrufus's user avatar
4 votes
1 answer
660 views

Error in st_normalize.sfc(x, c(x_range[1], y_range[1], x_range[2], y_range[2])) : domain must have a positive range

Background: I am using ggplot2 geom_point to map animal location points by week. As a basemap, I am using a shapefile from my computer. Here is an example of my data: datexample <- data.frame( ...
cgxytf's user avatar
  • 431
4 votes
0 answers
719 views

concave polygon into convex polygons using r

I am trying to split a concave polygon into convex polygons using r. I am trying to figure out how to successfully accomplish this for one polygon with the hopes of implementing this on a large ...
sea83's user avatar
  • 81
4 votes
0 answers
1k views

Use custom map in Apache Superset Dashboard

Superset dashboards currently supports standard country maps (geojson) with ISO Codes. What would be the best way to import a custom map (like a forest map or an ocean map for example...) in order ...
Jean Valet's user avatar
4 votes
1 answer
202 views

NetLogo GIS: dealing with large shapefile

I'm developing a NetLogo model using the GIS extension to import a road network shapefile. The model works fine when I work on a small area of about 5x5 km. However I would like to allow potential ...
kevin morelle's user avatar
4 votes
0 answers
529 views

Calling Large Shapefiles into R, 2 GB polygon layer, rgdal

I'm attempting to open a shapefile in R using rgdal. my code is simply: shp <- readOGR("D:/Documents/EPA/Groundwater_Wells/R Work", "us_blocks_2010") The error message I receive is: Error: C ...
Andrew Murray's user avatar
4 votes
1 answer
802 views

Outline polygon border that has been removed due to NA's

I want to plot a shape file using ggplot2 in R. More specifically, I want to plot % white living in each block for several major cities. So far, I've worked with New Haven. The problem is that some ...
user1869937's user avatar
3 votes
1 answer
2k views

Global Raster of geographic distances

Im wondering if someone has built a raster of the continents of the world where each cell equals the distance of that cell cell to the nearest shore. This map would highlight the land areas that are ...
I Del Toro's user avatar
3 votes
2 answers
20k views

Displaying a Shapefile

I have a shapefile that I want to display. I tried using matplotlib to display it, but I get this: However, when I tried to display using an online website I get this; How can I get the second image?...
Ace's user avatar
  • 155
3 votes
1 answer
2k views

write a 2d shape file with NetTopologySuite

I created a routine that writes correctly shape files, but I have a problem: the shape is a 3d, but I need to write a 2d shape file. How can I do this? thanks
Luca Morelli's user avatar
  • 2,530
3 votes
1 answer
5k views

plot one polygon from a spatial polygon data frame

I'm a bit new to R and so this mights seem an easy command for you. I have a shapefile loaded in R with several polygons in it, and I just would like to plot the first polygon. I tried several ...
Jude's user avatar
  • 183
3 votes
1 answer
4k views

gSimplify not simplifying shapefile in R

I'm unable to simplify a shapefile in R Shapefile from here: https://geoportal.statistics.gov.uk/Docs/Boundaries/Local_authority_district_(GB)_2014_Boundaries_(Generalised_Clipped).zip library(tmap) ...
pluke's user avatar
  • 4,082
3 votes
3 answers
4k views

Implementing a brute force algorithm for detecting a self-intersecting polygon

I initially implemented the Hoey-Shamos algorithm, however it is too complex for future maintainability (I have no say in this), and it wasn't reporting correctly, so an optimized brute force ...
Evan Parsons's user avatar
  • 1,169
3 votes
2 answers
5k views

How does a SHX-file work?

If you have geographic data stored in ESRI shapes, you have at least three files: one ending with .shp containing the vector-data, one ending with .dbf containing attributes and a file ending with ....
Mnementh's user avatar
  • 51k
3 votes
1 answer
1k views

R: Calculating the Distance Between Two Geographical Points

I am interested in learning how to work with Road Network Files in R. For example, I would be interested in finding out the driving distance between the following two (Canadian) addresses: CN Tower: ...
stats_noob's user avatar
  • 5,471
3 votes
2 answers
12k views

Combining shapefiles in Python / GeoPandas

I have three polygon shapefiles which overlap each other. Let's call them: file_one.shp (polygon Name is 1) file_two.shp (polygon Name is 2) file_three.shp (polygon Name is 3) I want to combine them ...
TheRealJimShady's user avatar
3 votes
2 answers
2k views

Add a relief (GEOtiff, .tif) to a ggplot of the swiss country borders ((polygon) shapefile, .shp)

I plotted the area of Switzerland (polygon shapefile) and added points (swiss weather stations) via coordinates. # Boundaries with data-points plotted library(rgdal) library(readxl) library(sp) ...
T. Grüter's user avatar
3 votes
1 answer
3k views

PostgreSQL/PostGIS: shp2pgsql INSERT instead of Creating a new table

Hi I am very new to PostgreSQL/PostGIS and just learned how to convert Shapefiles into SQL file and import it to PostGIS using the shp2pgsql by following this tutorial. What I noticed is that whenever ...
Mark A.'s user avatar
  • 243
3 votes
2 answers
6k views

Shapefile to Topojson conversion

I am trying to convert the Ghana admin1 shapefile that can be found here. My end goal is to obtain a TopoJSON as described in this question. I have used this command on a Linux machine: ogr2ogr -f ...
GPierre's user avatar
  • 903

1 2 3
4
5
41