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
6 votes
0 answers
1k views

MySQL Geometry Limit (Maximum Length of Polygon String)

Is there a limitation of how many Points a Polygon may have? I use shp2mysql-php (http://sourceforge.net/projects/shp2mysql-php/) to import SHP Shape Data of countries. It works fine, but all my ...
Benjamin Fuchs's user avatar
5 votes
1 answer
7k views

Create a grid inside a shapefile

I am trying to crate a grid inside a shapefile, something like this. However, I am unable to generate such grid. I was wondering if anyone has an idea on how to accomplish this. Here is my code - ...
Perro's user avatar
  • 358
5 votes
3 answers
9k views

Creating a shape file from a bounding box coordinates list

There is already few existing questions about this topic, but I unfortunately did not find something that could fix my problem. I have a point Lat, Long coordinate i.e. Lat= 10 and Long = 10. I want ...
steve's user avatar
  • 521
5 votes
2 answers
17k views

How to convert csv to shp in R

I have been trying for the past couple of days to convert a csv to shapefile. I know I can easily do in QGIS or Arc but would like to add this process into my existing R code. So i can read in the ...
Harmzy15's user avatar
  • 497
5 votes
4 answers
3k views

Where can I find old R packages in .zip format ?

Where can I find old R packages in .zip format ? At CRAN for example : http://cran.r-project.org/src/contrib/Archive/shapefiles there are only sources of .tar.gz files, I have to install old ...
Qbik's user avatar
  • 6,015
5 votes
3 answers
7k views

ogr2ogr Or arcpy for csv to shapefile?

Can ogr2ogr or arcpy do a direct csv to shapefile conversion? I'm trying to automate some processes with a small script and was hoping I can do it easily with ogr2ogr or arcpy which I'm new to. Any ...
Steven Lutz's user avatar
5 votes
2 answers
10k views

ESRI's shapefile to Matlab

I am looking for a function to read/write points, lines and polygons from ESRI's shapefile format (as used in Arcview) for use in Matlab
Elpezmuerto's user avatar
  • 5,501
5 votes
5 answers
13k views

How can I convert an excel spreadsheet (.xls) to a shapefile programmatically?

I have an excel spreadsheet I want to convert to an ESRI shapefile programmatically. It contains X and Y coordinates in two columns, as well as a variety of attribute data in other columns. The ...
fmark's user avatar
  • 57.9k
5 votes
1 answer
16k views

How to subset a shapefile

The data set of shapefile "Property1A" is: df # suburb area asst # 0 Te Aro 14.541780 R076 # 1 Te Aro 7.655428 R076 # 2 Te Aro 3189.976134 <NA> # 3 Te Aro 242....
Bingbing Liu's user avatar
5 votes
2 answers
4k views

How do I split/divide polyline shapefiles into equally-length-smaller segments?

I have a polyline shapefile, which represents part of an urban road network. My shapefile contains several line/street segments (in my case 58). By using R-cran, I would like to further divide the ...
MGV's user avatar
  • 71
5 votes
6 answers
8k views

How can I get Proj4 details from the shapefile's .prj file?

I am using mapdotnet services for our gis application to load the shapefiles, and this mapdotnet service wants the proj4 details. I'm getting them from spatialreference.org, but for this projection ...
Tushar Maru's user avatar
  • 3,397
5 votes
2 answers
3k views

Overlaying shapefiles or raster over interactive maps

I'm using R, and I want to overlay some raster data (e.g. a temperature map from a model) over an interactive map which allows panning and zooming. Ideally, I'd like to overlay over Google Maps or ...
AF7's user avatar
  • 3,192
5 votes
2 answers
5k views

Plotting elements from shapefiles in R

stackoverflow community, I have two shapefiles of the municipalities of Japan. I'm using R to create separate plots for each of the municipalities. I can make this work with one shapefile, but the ...
spatiallyConfused's user avatar
5 votes
1 answer
4k views

How can I eliminate some areas by attribute from a shapefile in R and create a new shapefile?

I have been at this for a while now and have had some success, however when it comes to rewriting the file, I have had none. The shapefile I am working with is a polygon shapefile of metro and ...
Dan Johnson's user avatar
5 votes
2 answers
4k views

Finding 1st order neighbors using shapefile polygons

I am looking a efficient way to find the 1st order neighbors of a given polygon. My data are in shapefile format. My first idea was to calculate the x and y coordinates of the polygons' centroids in ...
Gianni Spear's user avatar
  • 7,446
5 votes
1 answer
7k views

Filling shapefile polygons with a color in matplotlib

I am searching way to fill polygons of a shapefile based on a value. So far from basemap tutorial (http://basemaptutorial.readthedocs.io/en/latest/shapefile.html) i 've found how to fill the polygons ...
Ignatios Chatzidiamantis's user avatar
5 votes
1 answer
5k views

Plotting a shapefile on a raster layer in R

I want to plot a raster layer with points from a shapefile on top. I have checked previous answers on this, but i still have a problem. I can plot the point shapefile and the raster layer separately ...
dtanon's user avatar
  • 303
5 votes
3 answers
3k views

How to use python to lookup information at specific latitude/longitude in a ESRI shapefile?

I have a ESRI shapefile (from here: http://pubs.usgs.gov/ds/425/). I looking to use python to lookup information from the shape file (surficial material in this case) at a given latitude/longitude. ...
arkottke's user avatar
  • 567
5 votes
1 answer
10k views

Merging Two SpatialPolygonsDataFrame Objects

Using the shapefile available here I am trying two merge the polygons of Sudan and South Sudan, so that I get the borders of Sudan in 2010. My code to make the shapefile available in R is library(...
Martin Schmelzer's user avatar
5 votes
5 answers
755 views

What projections in r will fatten a city map?

I'm trying to make some city maps, and I'd like to distort them a bit so that the densest parts (manhattan in this case) appear to be a little wider on the final map. I'm having a hard time finding ...
Anthony Damico's user avatar
5 votes
2 answers
7k views

Opening shapefiles in R using rgdal always better than using maptools?

I found two basic ways to open shapefiles in R - using rgdal and maptools: # 1 require(maptools) shape_maptools <- readShapeLines("file.shp") # 2 require(rgdal) shape_rgdal <- readOGR(...
Tomas's user avatar
  • 58.5k
5 votes
2 answers
3k views

Plotting shapefiles on top of Google map tiles [closed]

I have some shapefiles I want to plot over Google Maps tiles. What's the most efficient way to do this? One path might be to use the pkg RgoogleMaps, however, it is still unclear to me how to do this. ...
pslice's user avatar
  • 503
5 votes
1 answer
3k views

Geodjango: how to load .shp file and convert to geojson with the right CRS?

I have multiple shapefiles (.shp) with their auxiliary files that I want to display on a Leaflet map. The shapefiles use different coordinate reference systems (CRS) and I struggle to grasp the most ...
user avatar
5 votes
2 answers
3k views

How to find centroids of multi-polygons using sf library

I have a shapefile of multipolygons and I want to find the centroid of each multipolygon, but instead I am getting the centroid of the whole shapefile. I converted my csv file into a shapefile (see ...
Alan20's user avatar
  • 281
5 votes
3 answers
3k views

How to set ylim and xlim in plot raster in R

I'm making a raster data ploting in R, when I adjust to the area I'm working on, R displays the ylim that doesn't want to be cut off. I tried: # set lon lat ylim=c(-4,2) xlim=c(118,126) plot(...
ExHunter's user avatar
  • 307
5 votes
1 answer
1k views

Overlaying ggmap , geom_polygon(shape file) on ggplot2

I have a shape file, and I want to post it on top of a google map with ggplot, but posting via geom_polygon(ggplot2) shows lines that do not make sense my code: ######## the shape file ftp://geoftp....
João Machado's user avatar
5 votes
1 answer
6k views

Python Scripts to ingest a shapefile into a PostgreSQL/PostGIS database utilizing shp2pgsql.exe on windows

I have a PostgreSQL database hosted on a Windows 2008 Server RT Virtual Machine (Yes I know it should be hosted on a Linux VM but this is what my organization has dictated it be on. Sigh...) Our GIS ...
AlienAnarchist's user avatar
5 votes
1 answer
2k views

Should be easy: distance along a line in R?

I have a Shapefile of railroads in Mozambique, and have generated 100 random points along the railroad using the code below. My question is pretty simple, but I can't find an answer: how do you ...
Cornelius's user avatar
5 votes
2 answers
684 views

GeoJson features coordinates are in meters not in [lng, lat]. How to display in google map?

Eg: [360590, 555610] - [lng, lat] in meters from google map api - GeoJson data { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "...
Shivam's user avatar
  • 161
5 votes
1 answer
530 views

Colour shapefile using multiple attributes

library(raster) admin <- getData('GADM', country='FRA', level=2) set.seed(123) id <- data.frame(ID_2 = admin@data$ID_2, day1 = sample(1:20,96,replace = T), ...
89_Simple's user avatar
  • 3,695
5 votes
2 answers
6k views

How to index geojson file in elasticsearch?

I am trying to store spatial data in the form of geojson,csv files and shape files into elasticsearch USING PYTHON.I am new to elasticsearch and even after following the documentation i am not able to ...
intern's user avatar
  • 61
5 votes
1 answer
4k views

Reading DWG files in R?

Is there any way to open a DWG file in R and save it as an ESRI shapefile? I don't know any package available yet. Thanks in advance.
Hector's user avatar
  • 61
5 votes
3 answers
1k views

2008 TIGER/Line® Shapefiles from Census.gov -> Google Maps

How do I take shapefiles and extract lat/lng coords so I can plot polygons on Google Maps? http://www2.census.gov/cgi-bin/shapefiles/national-files I asked this question here: http://groups.google....
Philip Brocoum's user avatar
5 votes
1 answer
6k views

linewidth based on shapefile attribute for geopandas, python

I would like to plot a shapefile using geopandas. I would like to have the thickness of the lines in accordance with an attribute in the shapefile. I am using the following command for that: shp_sub....
ShGh's user avatar
  • 67
5 votes
1 answer
12k views

Plotting Thematic Maps in R Using Shapefiles and Data Files from DIfferent Sources

Given a shapefile, how do I shape and use a data file in order to be able to plot thematic maps using identifiers that correspond to shape regions in the shapefile? #Download English Government ...
psychemedia's user avatar
  • 5,820
5 votes
1 answer
3k views

How to pick up the information for the nearest associated polygon to points using R?

I'm figuring out how to do a Intersection (Spatial Join) between point and polygons from shapefiles. My idea is to get the closest points and those points that match completely inside the polygons. In ...
José Bustos's user avatar
5 votes
2 answers
2k views

Specifying desired crs format of Geopandas object

I use geopandas's to_file() method to read a shapefile into a geopandas object. The shapefile has a valid .prj file with a ESRI WKT style projection information: PROJCS["...
Marjan Moderc's user avatar
4 votes
1 answer
7k views

Map Lat/Lon Points to a Shape File in R

I am trying to identify the zip code for each set of lat/lon coordinate using a shapefile. Lat Lon data is extracted from: https://data.cityofchicago.org/Public-Safety/Crimes-2017/d62x-nvdr (Crimes_-...
IsisDorus's user avatar
4 votes
2 answers
4k views

Calculate the length of shared boundaries between multiple polygons

I have a shapefile and I want to know for each polygon what other polygons touch it. To that end I have this code: require("rgdal") require("rgeos") download.file("https://www.dropbox.com/s/...
Chris's user avatar
  • 1,217
4 votes
2 answers
11k views

Intersections of 3D polygons in python

Are there any open source tools or libraries (ideally in python) that are available for performing lots of intersections with 3D geometry read from an ESRI shapefile? Most of the tests will be simple ...
Andrew Walker's user avatar
4 votes
1 answer
9k views

Generate grid of latitude-longitude coordinates that fall within polygon

I'm trying to plot data onto a map. I would like to generate data for specific points on the map (e.g. transit times to one or more prespecified location) for a specific city. I found data for New ...
lstbl's user avatar
  • 537
4 votes
4 answers
10k views

OpenLayer + OpenStreetMap + Custom ShapeFile

I started in the mapping. I would like to view a map of France with a layer on top that would be personalized. I already have the custom layer with shapefile format. I do not know at all if I have to ...
Bob's user avatar
  • 1,051
4 votes
1 answer
6k views

Python: find a method to calculate the "inner centroid" (X,Y) of a polygon

I have a polygon (converted in a Shapely object). My goal is calculate the "inner centroid" (also known as "point on surface")(return x,y values) and the "centroid" (return x,y values) following the ...
Gianni Spear's user avatar
  • 7,446
4 votes
1 answer
1k views

How to make continuous legend in ggplot2?

I have little query regarding the legend in ggplot2. How can I make legend in a continuous level from the attached code. In this code the legend is in discrete form I want to make it in continuous ...
user_3264's user avatar
  • 107
4 votes
1 answer
19k views

Converting shapefile to raster

I'm having an issue rasterizing a shapefile to produce points on a 0.5*0.5 grid. The shapefile represents classifications of risk level (Low-0, Medium-100, High-1000, Very High-1500) of global coral ...
RMFish's user avatar
  • 43
4 votes
1 answer
6k views

Unable to open datasource `' with the following drivers

I am trying to ensure I have geodjango properly installed so I can follow this tutorial. I have used Brew as my installer for Geodjango prequisites: postgresql, postgis, gdal, libgeoip. My gdal ...
deadant88's user avatar
  • 960
4 votes
2 answers
5k views

How to download the county boundaries of China in OpenStreetMap?

Is there a way to download the shp format file about eh county boundaries of China in OpenStreetMap?
Ben's user avatar
  • 675
4 votes
2 answers
6k views

Creating Shape Files from SQL Server using Ogr2ogr

I am trying to run the following code in a command window. The code executes, but it gives me no values in the .SHP files. The table has GeographyCollections and Polygons stored in a Field of type ...
Tor Storli's user avatar
4 votes
3 answers
2k views

difficulty plotting layer from shapefile in rstudio

I'm trying to load and plot a layer from a simple shapefile. It is state boundaries in the US. I can load it fine: > library("sp","rgdal") > shape = readOGR("/home/username/data/share/mapnik/...
nomadicME's user avatar
  • 1,399
4 votes
3 answers
9k views

plot shapefile in python

I have a couple shape files that I want to plot some scatterplot data on top of that. Does anyone have a way to load a shape file then plot it? I've followed a couple of tutorials, but have not ...
user1253952's user avatar
  • 1,587

1 2
3
4 5
41