Skip to main content

All Questions

Filter by
Sorted by
Tagged with
19 votes
1 answer
44k 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') # ...
djq's user avatar
  • 16.3k
18 votes
2 answers
31k 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 ...
John's user avatar
  • 181
18 votes
9 answers
12k 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 ...
andreash's user avatar
  • 741
18 votes
2 answers
16k views

Creating 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....
Flavio's user avatar
  • 541
17 votes
7 answers
9k views

Free tool to simplify parcel shapefiles?

Is there any tool available which let's me run millions of parcel shapefiles and simplify them?
NetConstructor.com's user avatar
16 votes
1 answer
14k views

Importing shapefile to PostGIS using Python and ogr

I just export a PostGIS Table to shp using this tips but I'm not able to import a shp to PostGIS using the same library(ogr). Any idea?
franco_b's user avatar
  • 522
16 votes
4 answers
26k views

Explaining difference between shx and shp files of shapefile?

I am searching for a more in depth explanation of the differences in shp and shx files to little avail. I mean beyond the 'shp contain geometry - shx contains an index of the geometry'. The reason I ...
Maggie's user avatar
  • 401
16 votes
4 answers
91k views

Permission denied when creating shapefile

I'm having problems creating new shapefiles - in QGIS 2.14.20 any new fields I create and any associated data are not saved. I've now got the same problem in QGIS 3.0, but there I get a message ...
Cameron's user avatar
  • 181
15 votes
7 answers
32k views

Changing field length using QGIS

I have a shapefile I made in QGIS 1.7.4. One of the fields is a String of length 80. I'd like to make the field accept longer stings, but I can't figure out how to change its length. How do I do this?
Evan's user avatar
  • 1,123
15 votes
5 answers
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 ...
Pure.Krome's user avatar
  • 1,793
15 votes
5 answers
35k views

Converting 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)), ((...
Gregory's user avatar
  • 1,671
15 votes
4 answers
51k 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 (...
DevRaj's user avatar
  • 171
15 votes
6 answers
3k views

Creating simple image from vector data

Can anyone suggest a quick (and preferably open source) way to create an image from a shapefile. For example, I have a shapefile containing parcel boundaries, I want to create a png file depicting ...
user890's user avatar
  • 5,733
14 votes
3 answers
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. ...
Bob Mitchell's user avatar
14 votes
1 answer
43k views

How to extract long and lat from geometry column in GeoPandas?

I read a shapefile with GeoPandas and I get a nice table with a column "geometry". This column contains shapely.geometry.polygon.Polygon or shapely.geometry.multipolygon.MultiPolygon object. import ...
Ger's user avatar
  • 279
13 votes
4 answers
770 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 - ...
François's user avatar
  • 275
13 votes
3 answers
44k 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 ...
Lars's user avatar
  • 2,197
13 votes
5 answers
646 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 ...
AKR1989's user avatar
  • 141
13 votes
4 answers
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?
user1899's user avatar
  • 1,437
13 votes
3 answers
9k 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 ...
Pris's user avatar
  • 1,251
13 votes
8 answers
11k 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 ...
sirgeo's user avatar
  • 2,059
13 votes
2 answers
21k 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, ...
andriatz's user avatar
  • 419
12 votes
3 answers
7k views

Voronoi Diagram on a given polygon using QGIS

I am trying to create a Voronoi Diagram on a specific polygon, but there is some issue when dealing with edges. Here is how I do it: Preparing the points for Voronoi and the polygon for the diagram ...
Pete's user avatar
  • 365
12 votes
2 answers
11k views

Determining if shapefile and raster overlap in Python using OGR/GDAL? [closed]

I am building a script in python using OGR/GDAL. I have a set of shapefiles and a set of GeoTiff raster files. I would like to have my script ignore shapefiles if they do not intersect with the ...
JFerg's user avatar
  • 347
11 votes
1 answer
27k 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 ...
Martin's user avatar
  • 4,938
11 votes
3 answers
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 ...
Tanner's user avatar
  • 7,404
11 votes
2 answers
8k 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 ...
Qwertie's user avatar
  • 211
11 votes
2 answers
1k 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 ...
gisnside's user avatar
  • 7,888
11 votes
4 answers
35k 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 ...
user3915459's user avatar
10 votes
6 answers
10k 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/...
ChrisJ's user avatar
  • 1,129
10 votes
6 answers
1k 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 ...
Lost Mapper's user avatar
  • 1,971
10 votes
6 answers
3k 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 ...
Aaron's user avatar
  • 51.8k
10 votes
1 answer
9k views

How to export multiple Shapefiles to one KML file in QGIS?

As the title says, is it possible to export multiple Shapefiles to one single KML in QGIS (Similar to "Map to KML" in ArcMAP)?
Andersson's user avatar
  • 383
10 votes
4 answers
16k views

Convert Polygon Feature Centroid to Points using Python

I would like to convert some polygon based shp files that have several polygon features into points for each feature that would essentially represent the centriod of each polygon feature. I know in ...
wilbev's user avatar
  • 1,719
10 votes
1 answer
10k views

Is it possible to change default encoding for QGIS?

I often transfer layers from Windows machine to Linux and vice versa and it causes me problems (incorrectly displayed labels and same with text in attribute table) when I use drag and drop to put ...
Juhele's user avatar
  • 1,738
10 votes
3 answers
23k views

How to get all the lat/long coords that define a shapefile

I have a Shapefile with several shapes inside it. Using MapWindow I have been able to determine that the shape I need is the one with shapeId 19. As you can probably tell I have very little ...
Zebs's user avatar
  • 203
10 votes
2 answers
9k 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 ...
user39901230's user avatar
9 votes
3 answers
16k views

Dissolving shapefile but retain attribute fields using ArcGIS Desktop?

Is there any way to dissolve shapefile but keep attributes fields in the same time? This is how I want to retain fields: There are two fields I want to conserve in a shapefile. The first column is ...
NewHere's user avatar
  • 141
9 votes
1 answer
13k views

Exporting shapefile to KML with labels

In QGIS, When exporting my point shapefile to KML, points label are not visible in Google Earth Pro. I follow these steps: In QGIS, my point shapefile has a name attribute Right click on the shape ...
Olivier Cristol's user avatar
9 votes
2 answers
18k views

Adding CRS to shapefile in GeoPandas

I am trying to add CRS to a shapefile that I am exporting: shp1 = gpd.read_file(i[1], encoding='iso8859_7', crs_wkt='2100') shp1.to_file(out, encoding='iso8859_7', crs_wkt='2100') When I import it to ...
user10092387's user avatar
8 votes
1 answer
7k views

Generate rectangular fishnet or vector (grid cells) shapefile in R?

I would like to create a polygon of 20 x 10 degree graticules from 180, -180 to 90, -90 degrees. To do this in QGIS, I followed: Vector creation tools > Create grid [Grid extent: -180, 180, -90, 90]...
Amroco's user avatar
  • 435
8 votes
1 answer
791 views

The longest straight line (L) within a polygon and the longest perpendicular line (T) to L

I'm mapping elongated glaciological features within QGIS 2.18.22 and I need to measure the longest straight line (L) and the longest perpendicular line (T) to L (as illustrated in the picture) within ...
Lena Uldal's user avatar
8 votes
1 answer
25k views

Creating shapefile from Excel file in QGIS?

I am using QGIS 2.6.1 and have worked in an Excel file database (which was actually converted from a Shapefile). I have managed to convert it as CSV file and load it into QGIS (displays data fine) but ...
Darth Freder's user avatar
8 votes
4 answers
11k 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 ...
Cesare's user avatar
  • 2,021
7 votes
1 answer
2k views

Updating Lat/Longs and actual position of point shapefile using arcpy.UpdateCursor()?

I have a point shapefile with over 3000 points that are updated frequently, when they are updated they need to have their lat/longs changed which is entered into the attribute table. When the lat/...
Furlong's user avatar
  • 2,125
7 votes
4 answers
13k views

How to convert SHP to GPX or to JSON?

I would like to convert the tree inventory shape files of London (Canada) into a GPX file and if possible into a JSON file. You can download the archive from their Open Data website. It contains the ...
JJD's user avatar
  • 1,521
7 votes
1 answer
20k views

Why is my prj file not being read by QGIS?

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. Altering the project properties>...
Lisa's user avatar
  • 73
7 votes
5 answers
14k views

Converting WKT to SHP?

I have a text file containing exactly this: POLYGON ((6.2973716 48.98613 1772.1, ...many other Long Lat Altitude values ... )) And only this. It seems to be just like a WKT geometry of a polygon. But ...
swiss_knight's user avatar
  • 10.9k
7 votes
2 answers
8k views

How to to validate geometries using ogr2ogr

I have been trying to dissolve a shapefile with more than 38000 rows. I used query as follows ogr2ogr -f "ESRI Shapefile" dissolved.shp Barangays.shp -dialect sqlite -sql "select ST_union(Geometry),* ...
AMahajan's user avatar
  • 198
7 votes
3 answers
4k views

Calculating area of vegetation in raster file?

How do I calculate area of several vegetation types in a raster (.img file type) image. They are color coded. Am using QGIS (1.8.0) and ERDAS 9.2.
Infinity's user avatar

1
3 4
5
6 7
18