Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

95
votes
24answers
111k views

Converting between KML and shapefile (SHP) format?

My users are sending me point data that were digitized using Google Earth. How can I convert their KML to a shapefile?
91
votes
15answers
46k views

Identifying Coordinate System of Shapefile when Unknown?

I have a Shapefile but its coordinate system is Unknown, and there is no *.prj file. How can I identify it now?
68
votes
3answers
136k views

Calculating polygon areas in QGIS?

How do I calculate areas of an area shapefile in square meters or in acres (ha)? I didn't find that functionality in the vector tools.
67
votes
7answers
3k views

Are there any attempts to replace the shapefile? [closed]

Recently I've been spending a lot of time converting perfectly good field names like "Percent of citizens age 25 and over with a bachelor's degree or higher" into things like "edbchogtr" to meet the ...
56
votes
6answers
128k views

How to open a shapefile in R?

I need to open a shapefile from ArcMap in R to use it for further geostatistical analysis. I've converted it into ASCII text file, but in R it is recognized as data.frame. Coordinates function doesn't ...
54
votes
3answers
55k views

Renaming attributes/fields in shapefile attribute table using QGIS?

I would like to rename some fields in my attribute table: Like rename XRF_N3in something else. It seems quite a easy issue but I don't find any information about how can I do that... I've QGIS 1.8 in ...
49
votes
4answers
50k views

Which character encoding is used by the DBF file in shapefiles?

Which character-encoding is used by the dbf-file in shapefiles? It seems it is handled different, based on the program and the local encoding-settings of the machine. Which encoding is 'right' - ...
43
votes
7answers
37k views

Choosing File Geodatabase (*.gdb), Personal Geodatabase (*.mdb) or shapefile format?

Previously, I have used geodatabases as an easy way to keep all files together rather than having dozens of shapefiles all over the place, and it is easier when finally exporting all the relevant data ...
40
votes
3answers
34k views

How can I get a shapefile from a postgis query?

My data is in a PostGIS database. I would like to generate a shapefile from a query. How can I do that?
39
votes
3answers
22k views

Is it possible to look at the contents of Shapefile using Python without an ArcMap license?

I wondered if it is possible to look at the contents of a shapefile using Python without having and ArcMap license. The situation is that you can create shapefiles from many different applications, ...
39
votes
5answers
28k views

Bypassing 10 character limit of field name in shapefiles?

I'm exporting geometry with attached text attributes from oracle database to esri shapefile format (.shp) with Java and Geotools library. Attribute columns in our database have names with more than ...
37
votes
15answers
98k views

Converting MapInfo TAB and/or MIF to SHP using free tools or ArcGIS for Desktop core product?

How do I convert MapInfo TAB and/or MIF files to SHP using only free tools or ArcGIS itself? I've not had much luck trying to do this in the past and I don't want to have to shell out for the ArcGIS ...
37
votes
10answers
30k views

Open Source Tool capable of reading Esri File Geodatabase (.gdb)?

I have an ESRI File Geodatabase (.gdb) file that I would like to convert to shapefile (or any other non-proprietary format). Are there any Open Source tools to do so?
35
votes
3answers
23k views

Simple thematic mapping of shapefile using Python?

I wish to visualize geographical data in Python, without using ArcGIS/ArcPy, and make a map. On the internet I found how to make a thematic map using Python: Here is some code that I tried: ...
35
votes
5answers
7k views

Advantages of using spatialite over shapefile? [closed]

I found spatialite more useful than shapefiles as it does not have the limitations of shapefile and it is also portable. Many people here use shapefiles to exchange data and even the experts do not ...
34
votes
4answers
18k views

Is there an automatic function in QGIS to package all files in a project for transferability?

In my project, I use a lot of geodata from different directories. Now I want to give the QGIS project to a colleague (eg on a CD). Is it possible to copy the shapes from different directories ...
33
votes
10answers
56k views

Adding Attribute data to shapefile?

I can display a shapefile in openlayers but I need to add some attribute data. I can open the dbf file in excel but there is no save as option in excel to the updated file as a dbf. What is the ...
32
votes
4answers
9k views

Bulk load multiple shapefiles into PostGIS

I've got over a hundred data layers in shapefile format that I want to upload into a PostGIS database. They are all in the same projection, but represent different data layers so they do not have the ...
32
votes
6answers
2k views

“Oddities” in the Shapefile technical specification

I've been writing a shapefile parsing library, and have encountered a couple of design decisions in the specification that I don't immediately understand. I'm hoping there's a wizened old ESRI ...
32
votes
5answers
33k views

Converting .shp into .gpx using QGIS?

I would like to convert .shp into .gpx. Using GIS, I open my shapefile and I tried to "save as" gpx but it gives an OGR error: creation of field ObjectId failed (OGR error: Field of name '...
31
votes
12answers
47k views

Converting shapefiles to text (ASCII) files? [duplicate]

How can I convert a shapefile (GIS) to text, or, how can I extract the information in a shapefile?
30
votes
3answers
17k views

How to easily edit attribute data using Regular Expressions?

I am writing a tutorial for MSc students that uses QGIS. One of the tasks requires the attribute data to be modified (see pdf draft of tutorial here if interested ). The question is how to get them ...
28
votes
3answers
33k views

How to encode shapefiles from LATIN1 to UTF-8?

Is there a way to encode shapefiles from LATIN1 to UTF-8?
28
votes
2answers
5k views

Using OGR and Shapely more efficiently? [closed]

I'm looking for some suggestions about how to make my python code more efficient. Normally efficiency doesn't matter for me but I am now working with a text file of US locations with over 1.5 million ...
27
votes
2answers
42k views

Adding shapefiles to PostGIS database

I was able to create a Postgresql database and then I executed, createlang plpgsql geospecies psql -d geospecies -f postgis.sql psql -d geospecies -f spatial_ref_sys.sql So now can I directly import ...
27
votes
4answers
50k views

Splitting shapefile into separate files for each feature using QGIS/GDAL/SAGA?

I have a polyline shapefile with about 20 kinds of roads. I would like to know how can I create automatically a vector file for each one. I am aware of how to do it using ArcGIS for Desktop - see ...
27
votes
5answers
27k views

How to convert image of map into vector format?

What is the best way of converting a gif of a map into a vector format, such as a shapefile? The only relevant parts that I am interested in are the outline of the island so I realize some manual ...
27
votes
6answers
11k views

How can I update ogr2ogr to include the PostgreSQL driver?

I'm trying to use ogr2ogr to upload a shapefile to a remote PostGres installation. When I ran this command: celenius:~ celenius$ ogr2ogr -f PostgreSQL PG:"host=255.34.00.00 user=postgres dbname=mydb ...
25
votes
8answers
18k views

Using ogr2ogr to convert all shapefiles in directory?

I have a directory with several shapefiles. How can convert all these shapefiles to MapInfo with ogr2ogr? I know how I can convert one file. And I can make a batch script writing a line for each ...
25
votes
9answers
17k views

How can I convert an excel file with x, y columns to a shapefile?

How can I convert an excel file with x, y columns to a point shapefile? There are some somewhat optional requirements in addition to the correct creation of a shapefile: Column types (as per Excel's ...
25
votes
4answers
9k views

How do you determine a shapefile's charset?

Is there a way to determine the charset used for a given shapefile?
24
votes
4answers
29k views

What is the difference between Coverage, Shapefiles and Geodatabases in ArcGIS?

I was wondering about the difference in spatial data storage methodology used by Coverages, Shapefiles and Geodatabases in ArcGIS. Coverage was the initial format, followed by Shape Files and now ...
23
votes
4answers
30k views

How to write Shapely geometries to shapefiles?

Can someone demonstrate a simple way to write geometry data-structures from shapely into shapefiles? I am particularly interested in polygons with holes and linestrings. It would also be beneficial to ...
23
votes
5answers
21k views

How to add attribute field to existing Shapefile via Python without ArcGIS?

I have a Python script that adds an attribute field to a Shapefile if doesn't exist. This is easy to do with ArcGIS (graphically or via Python), but I'm looking for something that doesn't depend on ...
23
votes
1answer
18k views

Merging adjacent polygons in shapefile that has been split at tile boundaries?

I'm currently using building data from the Ordnance Survey Vectormap District and I've noticed that a lot of building polygons are split in 2 because of the way the OS split up the shapefile. This is ...
22
votes
2answers
12k views

Using R to calculate the area of multiple polygons on a map that intersect with another overlaid polygon

I have a shapefile downloaded from the Ordnance Survey that gives electoral ward (division) boundaries for a county of the United Kingdom. I have successfully used R to load the shapefile and plotted ...
22
votes
3answers
19k 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 ...
21
votes
2answers
67k views

Cropping Shapefiles in QGIS?

I need to clip a large and very detailed shapefile in QGIS showing environmental data similar to a temperature map. Is there something like the very simple crop tool like in Adobe Photoshop where ...
21
votes
3answers
43k views

Merging polygons in shapefile based on field values?

I have a shapefile with a lot of polygons in it. These polygons are grouped into a category: district. How can I merge the polygons based on the same name of the category within this shapefile?
21
votes
2answers
18k views

Understanding difference between Polygon and Multipolygon for shapefiles in QGIS?

Creating Scratch layer gives me a choice between Polygon and Multipolygon, so I started wondering how should I make use of them. Reading a new book "Mastering QGIS" (through this answer by Joseph to ...
20
votes
6answers
14k views

How to improve rendering performance of a very large shapefile?

I have a polygon shapefile that has a 100MB .dbf, and 500MB .shp file component. The reason it is so large, is that it is classified as a landbase for a whole district. Everytime I view the file in ...
20
votes
2answers
30k views

Adding shapefile or feature class as layer in ArcGIS Desktop using Python/ArcPy?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
20
votes
2answers
13k views

Instantiating spatial polygon without using a shapefile in R

So, the usual way we read a shapefile in R is via the maptools package, like this: sfdata <- readShapeSpatial("/path/to/my/shapefile.shp", proj4string=CRS("+proj=longlat")) However, I have a use ...
20
votes
1answer
4k views

How to rename field names in a shapefile from the commandline?

I need to rename the field names (attributes) in a shapefile. Is there an easy way to do this from the command line?
20
votes
2answers
13k views

Shapefile loader in pgAdmin 4

Recently I have updated my postgresql version. I have also upgraded pgAdmin from 3 to 4. But I was unable to load shapefile. I didn't find any plugin called shapefile loader. How can I get the ...
19
votes
4answers
17k views

Using ogr2ogr to convert GML to shapefile in Python?

I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script. I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
19
votes
6answers
56k views

Convert shapefile to CSV including attributes AND geometry?

I have a shapefile with 60k+ entries, all of which are polygons with corresponding attributes (acreage totals, landowner names, tax ID #s, etc.). What I ultimately need is a CSV file with all of ...
19
votes
2answers
13k views

API documentation for Gdal/Ogr with C#

I want to assign projection to shapefile in my web C# application, for this i am using Gdal/OGR/OSR C# bindings and add osr_csharp.dll and ogr_csharp.dll references. But i am facing some difficulty ...
19
votes
4answers
31k 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?
18
votes
7answers
3k views

Alternatives to Shapefiles as open-source, cross platform dataset types [closed]

I am working on software that is very ESRI oriented, but a future version will likely not be using ESRI software. It uses Shapefiles and Geodatabases. I'm planning on getting all of my data to ...