Questions tagged [shapefile]

A vector data storage format for storing the location, shape, and attributes of geographic features. Often referred to as 'an ESRI shapefile', as ESRI developed it.

Filter by
Sorted by
Tagged with
22
votes
3answers
20k views

Selecting feature types when using ogr2ogr to convert to shapefile?

Shapefiles can only have one geometry type, but many other formats (kml, geojson) can have multiple types. When converting to shapefiles, is it possible to to tell ogr2ogr to create multiple ...
18
votes
2answers
23k views

Convert a spatial polygon object to data frame using R

My goal is to modify an existing shapefile by merging certain polygons. After importing the shapefile and using the UnionSpatialPolygons command, I get the polygon outline that I want. However, this ...
13
votes
4answers
642 views

Are long lines in shapefiles to be considered geodesics or straight lines in the 2D latlong space?

Is there a definition on how lines connect vertices in the shapefile format? In the simplest case, imagine a line with only 2 points, from 40,-118 to 40,-112 - that's somewhere random in the US - ...
12
votes
3answers
25k views

Extract Raster from Raster using Polygon shapefile in R

I am new to R and using the raster package. I have a problem extracting polygons from an existing raster file. If I use extract(raster, poly_shape) function on the raster it always creates a list ...
11
votes
3answers
7k views

Divide a complex shapefile into a grid

I have a decently detailed shapefile with polygon/multipolygon features (the file is about 500mb). It's actually a shapefile of the entire world, with the features representing coastlines. I need to ...
17
votes
9answers
7k views

how to overlay shapefile and raster?

I have a shapefile with polygons. And I have a global raster file. I want to overlay the shapefile's polygons onto the raster grid and calculate the mean raster value for each polygon. How can I do ...
17
votes
3answers
14k views

How to create a GeoJSON that works with D3?

I'm simply trying to convert a .shp file to a geoJSON format using: ogr2ogr -f geoJSON output.json input.shp After executing the command nothing seems to be wrong. Here's an excerpt from the output....
15
votes
1answer
26k views

Converting a polygon into a raster using R

I'm trying to convert a shapefile into a raster within R. My approach is to read in the raster as follows: library(rgdal) # Loads SP package by default demo <- readOGR('F:/data/', 'shapefile') # ...
13
votes
4answers
6k views

What is the best way to programmatically convert between WKT and Proj4 string?

Some shapefiles have a .prj file associated with it, and the .prj file contains the projection info of the shapefile in the format of WKT. Sometimes I need to convert WKT to proj4 string, and ...
13
votes
5answers
577 views

What in-depth spatial database systems tutorials exist? [closed]

Is there a good tutorial that explains in depth the internals of a GIS and a spatial database system such as PostGIS with examples and without any background assumption? I'm specifically looking for ...
11
votes
3answers
2k views

Which data format typically displays fastest in ArcMap?

My organization is working on an application running on ArcGIS Engine. Previous versions of the application used primarily Shapefiles for displaying roads, parcels, buildings, etc. Since I was ...
11
votes
7answers
9k views

Creating shapefile from current dataframe extents in layout view of ArcMap?

Where is the ArcGIS 10 tool for creating a shapefile from current dataframe extents in layout view? Have looked around and the closet thing i can find is Toolbox's Grid/Strip Map Index tools under ...
6
votes
1answer
5k views

Merging shapefiles with attributes using PyQGIS?

I have some shapefiles. They are all the same kind of shape and all have the same attributes. If I wanted to merge them manually the "Vector/Data management tools/merge shapefiles to one" works fine. ...
18
votes
4answers
70k views

Opening and extracting data from Shapefiles?

We are in need of US highway data. We found it for Florida at the state GIS website. We downloaded the data for Florida highway intersections from here (this is a zip file). How do we use these ...
14
votes
3answers
2k views

How can I represent distance using the dashes or markers of a vector line?

I am a very basic user and dont know the lingo to get to the gist of my question so some background might help. Ive volunteered to create a pre-incident planning system for my rural fire department. ...
12
votes
2answers
12k views

writeOGR with a spatialpolygon simplified by gSimplify

I'm using gSimplify (rgeos package) to simplify the geometries of a shapefile. The funcion works good, but now I can't write the output in a new shapefile. I tried some ways: writeOGR(simplyshape, ...
11
votes
7answers
26k views

QGIS exporting attributes in a KML file

Here is what I am doing: Create a layer by uploading a shapefile into QGIS Select attributes of that file Export selected attributes with the "save only selected features" check box when I save the ...
10
votes
4answers
35k views

Reading shapefile using C#? [closed]

I am new to ArcGIS and trying a few things.. I'm trying to read shapefile (which is supplied as an input) using C# and I want to generate a PDF file which contains underlying metadata information (...
9
votes
1answer
20k views

How to import using shp2pgsql?

I want to import shapefile into PostGIS. There is one database postgres in it but no table added yet. I am using this command: shp2pgsql -I -s 4326 districts.shp districts | psql -d postgres -U ...
8
votes
3answers
15k views

Join CSV file to shapefile

I wanted to join a CSV file to a shapefile. When I identified a field to facilitate the join, e.g., map <- spChFIDs(map, as.character(map$ID)) it returned Error in spChFIDs(SP, x) : lengths ...
21
votes
4answers
33k views

Free tool to convert ArcGIS layer package (*.lpk) to shapefile (*.shp)?

I have received a *.lpk file from Esri's ArcGIS platform that I would like to convert to a shapefile. How can I do this, using only free software?
13
votes
4answers
5k views

How to reproject spatial data using free libraries?

How can I use free libraries to transform spatial data? For example, I want to change the projection of a Shapefile within the code of my C# web application. How do I do that?
12
votes
2answers
10k views

How to split non-contiguous feature in QGIS?

I have a shapefile with a feature that is non-contiguous. I want to split the areas on the left from the area on the right. However, QGIS's Split Features tool requires you to draw a line over the ...
10
votes
2answers
778 views

What's the batched Refactor Fields tool “field mapping” syntax in QGIS?

In QGIS, there is this nice tool "Refactor Fields" in the Processing Toolbox : Using it on a single layer is fairly straightforward. However, when you plan on using it in a batch mode, one can see ...
10
votes
6answers
8k views

How to add a projection to a Shapefile using open-source tools?

I have been given some shapefiles WITHOUT a projection. So I need to add the projection in order to display it on google map. I found the projection information I need at http://spatialreference.org/...
10
votes
1answer
1k views

Identify shape of the polygons: elongation, roundness, etc

I am generalizing geological map. In the initial step I am dealing with small polygons which should be either deleted, enlarged, aggregated and etc. Before applying operations mentioned above I ...
10
votes
5answers
882 views

Database versus Files for Solo Developer

I'm just getting started in GIS and am interested in using it to create maps of mountain biking trails in my area and nearby. I've been learning QGIS and have made enough progress to generate a decent ...
8
votes
3answers
38k views

How to export a dataset with “SpatialPolygonsDataFrame” as a shapefile

How to export spatial datasets in R, such as tornados dataset in GISTools package, as a shapefile with the exact same spatial reference and the exact values? library(GISTools) data(tornados) ...
7
votes
1answer
6k views

Is there a QGIS bezier curve tool?

I'm a recent convert to QGIS but have been confused about the lack of support for drawing curved shapefiles, especially when Arc has almost too many. A lot of the work that our consultancy do is based ...
7
votes
4answers
7k views

Seeking tool to convert GTFS (General Transit Feed Specification) to SHP / KML? [closed]

I need to convert GTFS (General Transit Feed Specification https://developers.google.com/transit/gtfs/reference), data into some GIS data format like ESRI Shapefile or KML or something else. Do you ...
6
votes
1answer
4k views

Programmatically populating shapefile field with polygon areas in OGR?

I'm trying to programmatically populate a shp field with polygon areas: import sys import ogr ds = ogr.Open( 'tttttttttt.shp', update = 1 ) if ds is None: print "Open failed./n" sys.exit( 1 ...
15
votes
5answers
3k views

Does Re-Projecting ShapeFile only update content of *.prj file?

If I wish to change the projection of some shapefiles from .. let's say NAD83 (4269) to WGS84 (4326) ... and by using some 3rd party app .... does this mean the .prj file is only updated .. and not ...
12
votes
2answers
21k views

How to convert a shapefile to WKT?

I'm trying to convert a shapefile into the simple Well Known Text (WKT) format in the example below (from http://en.wikipedia.org/wiki/Well-known_text). MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), (...
10
votes
2answers
7k views

Point (of a linestring) within Polygon using ogr and Python

I'm currently working on a project in which I need to build a topological network out of the geometry features I find in shapefiles. So far using Ben Reilly's open source project I've managed to ...
9
votes
6answers
2k views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
6
votes
1answer
768 views

overlay county shapefiles for 2 different years

I have county-level shapefile for South Caroline in 1880 and one for 1940. I would like to overlay these two files so that they do the union and indicate the percentage of the land in 1880 that went ...
5
votes
3answers
16k views

Creating Polygon Shapefile from list of X,Y coordinates using Python?

I have a list of X,Y coordinates from a csv file, that represent a polygon. I´m trying to create a Polygon-Shapefile from this list. I´ve been trying around and found a possbility to write the list to ...
5
votes
1answer
864 views

Polygonizing a raster yields lots of little squares?

I have a pdf with the area of a county that I want to separate into multiple shapefiles (polygons) based on color. As shown in the first picture there are 4 colors so I would need to separate based ...
5
votes
2answers
6k views

Can QGIS automatically load an SLD with a Shapefile?

I have SLD's/lyr files with my shp/gdb files. They all have the same name except for the extension. Is it possible for me to force qgis to load the sld with the shp so that I don't need to manually go ...
4
votes
1answer
2k views

Write out a WKT file from a loaded shapefile

We are looking to load and display a shapefile, simple polygons, then write out a WKT string of that shapefile and have the user save it somewhere. Does anyone have some code snippets of that very ...
4
votes
1answer
5k views

Upload shapefile using GeoServer REST API and C#

I'd like to upload shapefiles using GeoServer REST API and C#. So far, I can create workspaces using the REST API and C#. From GeoServer documentation (specific to cURL), the difference between ...
4
votes
4answers
7k views

Updating Attributes using Pyshp

Is it possible to update an attribute field in a shapefile using pyshp ? I went through their documentation and all they show is how to create new attribute rather than editing or updating an already ...
3
votes
1answer
936 views

remove land area from marine region polygons

In my pursuit to merge multiple polygons for the purpose of calculating the surface area of marine species distributions, using shapefiles from Marineregions, I am now trying to remove potential land ...
3
votes
0answers
8k views

Generating shapefile in DotSpatial? [closed]

I have a .csv file of coordinates such as the following: -90.19, 38.62, St Louis -122.42, 37.82, San Francisco -74.04, 40.68, New York I want to create a shapefile using DotSpatial that has these ...
2
votes
2answers
5k views

Merging attribute and geometric features in QGIS?

I have polygons shapefile in which some of the polygons have same attributes as seen below:- In QGIS, how do I merge the polygons having the same attributes into one polygon? In other words, am ...
9
votes
2answers
6k views

How to convert GDB data to shapefiles without ArcGIS?

We've got some data (supposedly it's a simple collection of points--or at least that is all we need to extract) from a 3rd party in a GDB folder (I don't know how to tell what version) but we don't ...
8
votes
1answer
2k views

Add layer to existing geopackage not working in QGIS?

My organisation uses mainly ArcGIS and we have a need to share data with contractors. I recently introduced QGIS (because one of our application uses WKT to import geospatial data and QGIS makes the ...
7
votes
2answers
2k views

Control the colors of a shapefile

I have a Shapefile with road data. Sometimes the roads are blue, sometimes they are green. I didn't used to mind, but now I'm tiling everything so I need to control the colors. I'm loading it with ...
7
votes
1answer
19k views

Copy single feature into another feature class

I do a lot of editing, in this case areas. Sometimes I add an area to one shapefile, only to realise a bit later that it should have been in another. Is there an easy way of copying only that ...
6
votes
1answer
11k views

Why is my .prj file not being read by QGIS?

First off, I am new to GIS. I am using qgis (1.8.0), and have been given a shapefile containing .shp, .prj, .shx, .dbf, however qgis will not load the .prj file stating an invalid data source. ...