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

Add Polygons to R shiny leaflet map

How do I add polygons from Global Administrative areas, so they are clickable. The simple way describe in the docs that I tried is adm <- getData('GADM', country='UKR', level=1) leaflet() %>% addTiles() %>% addPolygons(data=adm, weight = 3,…
romants
  • 3,660
  • 1
  • 21
  • 33
16
votes
3 answers

Python: how to create a choropleth map out of a shapefile of Canada?

My goal here is to create a choropleth map of Canada in Python. Suppose I have a dictionary with values referring to each Canadian province/territory: myvalues={'Alberta': 1.0, 'British Columbia': 2.0, 'Manitoba': 3.0, 'New Brunswick': 4.0, …
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
15
votes
4 answers

How to generate shapefiles for H3 hexagons in a particular area

I would like to generate shapefiles for H3 hexagons in a specific geographic area. Particularly, I'm interested in the Bay Area with resolutions = 6, 7 and 9. How can I create the shapefiles for the hexagons covering this area? I'm new to shapefiles…
Ying Cao
  • 151
  • 1
  • 4
15
votes
2 answers

Which C++ library for ESRI shapefiles to choose?

Does anyone have an experience in processing (reading) ESRI shapefiles from C++? I have found at least 2 open source libraries: ShapeLib C library and OGR. Which one is better? Does anybody used one of them? How about the experience?
Sergey Borodavkin
  • 285
  • 1
  • 3
  • 7
14
votes
1 answer

Reading shape file with sf::st_read fails to capture encoding UTF8

I want to read a shape file which is encoded in UTF8. It works fine when I read it using rgdal::readOGR but sf::st_read fails to get the correct Encode. Any suggestions on how to solve this? For a reproducible example, the shape file I'm trying to…
rafa.pereira
  • 13,251
  • 6
  • 71
  • 109
14
votes
1 answer

Changing the Projection of Shapefile

I am trying to change or assign the projection of a Germany-Shapefile from NA to +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0, but somehow it doesn't work well. Reproducible Example: Shapefile and other files can be downloaded…
And_R
  • 1,647
  • 3
  • 18
  • 32
14
votes
4 answers

Read shape file with readOGR verses readShapePoly

I have read a shapefile using readShapePoly in the maptools package, but cannot read that same file with readOGR. I am hoping someone may be able to help me read the shapefile with readOGR. I downloaded the file orcounty.shp from here:…
Mark Miller
  • 12,483
  • 23
  • 78
  • 132
13
votes
4 answers

GDAL, ogr2ogr "Cannot find proj.db" Error

I've tried to extract certain country from the world shp file from natural earth. I am currently using windows 10, so I installed python 3.7, gdal to use the ogr2ogr. I typed the below code in the command to extract the south korea ogr2ogr -f…
Yang JongHyun
  • 133
  • 1
  • 1
  • 6
13
votes
1 answer

R How do I merge polygon features in a shapefile with many polygons? (reproducible code example)

How do I merge polygon features in a shapefile with many polygons? rbind and union just combine the rows of the shapefile features, they don't actually merge the polygons themselves. Desired result in example below: How do I get the below shapefile…
Neal Barsch
  • 2,810
  • 2
  • 13
  • 39
13
votes
1 answer

Get feature extent using gdal/ogr

This feels like something that should already have a function to do easily, but I can't find one. What I'm ultimately trying to do: I have a shapefile with 3 features that show bounding boxes; I want to use one of those features to select all the…
Jessica
  • 505
  • 1
  • 3
  • 11
13
votes
1 answer

in R, save a shapefile

I would like to save a shapefile after a manipulation. First, I read my object map<-readOGR("C:/MAPS","33SEE250GC_SIR") After this, I subset my shapefile: test <- fortify(map, region="CD_GEOCODI") test<- subset(test, -43.41
MAOC
  • 625
  • 2
  • 8
  • 26
12
votes
1 answer

Creating shapefiles from points in data frame

After reading a lot of posts and websites I can't find out how to create a polygon shapefile from my lon-lat data table. I would like to create maps like this one. My csv data file contains longitude, latitude and attribute of 1000 points in the…
pacomet
  • 5,011
  • 12
  • 59
  • 111
12
votes
1 answer

Problems converting from shape to topojson

I'm trying to convert a shapefile of mexican municipalities into a topojson and displaying it using d3.js using this tutorial http://bost.ocks.org/mike/map/#converting-data. I've managed to convert it but I can't manage to display it. Any help will…
eclark
  • 819
  • 7
  • 16
11
votes
5 answers

Random error: Attempted to read or write protected memory

We have a C# .Net application using WCF services. And the application is deployed in our production server under a Windows Service Application. One part of the module is responsible for creating shape files ((*.shp, *.dbf) for a smaller area the…
franklins
  • 3,710
  • 6
  • 41
  • 56
11
votes
2 answers

How to Import shape file into MySQL

I need to import the spatial data in shape file into MySQL tables. I am able to import into PostGreSQL. Any pointers for MySQL. I need the data in MySQL table.
PhantomM
  • 825
  • 6
  • 17
  • 34