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.

993 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
0 answers
452 views

OGR failing to unpack polygons and respective holes from shapefile

I'm trying to unpack shapefiles in Python (v3.7.4) using the GDAL-OGR library (v2.3.3). Each shapefile has only one feature containing multiple polygons with holes. They cannot be produced differently....
Thaine Herman Assumpção's user avatar
7 votes
0 answers
3k views

When does a QGIS .qix spatial index of a shapefile need to be re-created?

I understand the basics of spatial indexes but would like to understand when exactly a spatial index would need to be re-created or updated? The reason I ask is because when a folder was moved to a ...
AWGIS's user avatar
  • 3,210
7 votes
0 answers
2k views

What is the best way to display a large shapefile (with polygons) as a layer on a leaflet map?

I have a leaflet map of the UK with around ~2000 points total points and a bit of metadata loading for each point with two side-panels showing the metadata. These points are drawn from several tables ...
Jeremy Kidwell's user avatar
6 votes
0 answers
1k views

How to select points with point ids from external list

I have a point shp and list of point IDs in CSV file which match with point IDs in the shape. Points in SHP have location while points in the external file don´t. How can I select points in the shp ...
vsjbrc's user avatar
  • 61
6 votes
0 answers
2k views

QGIS: Release file lock on file used in a processing algorithm at the end of script

I am using runalg (qgis:joinattributesbylocation) on two QgsVectorLayer objects. At the end of my script I'm trying to delete all the files created during the script. I can delete everything except ...
David M.'s user avatar
6 votes
0 answers
1k views

How to set Vertical Coordinate system when creating a 3D shapefile?

I'm working with GDAL v1.11 and am seeing the vertical CS stripped when exporting a 3D shapefile (from oracle spatial). This is the command I'm running: ogr2ogr -f "ESRI Shapefile" B_POINT.shp (...
Russell's user avatar
  • 61
5 votes
0 answers
227 views

(QGIS 3.20) Adding features while spatial index is created makes them disappear

I am encountering a weird behaviour in QGIS 3.20 on Windows. Steps to reproduce: Create an empty project Create a SHP layer. Add a few features. Save the changes to disk At this point everything is ...
peauc's user avatar
  • 51
5 votes
0 answers
390 views

ogr2ogr creates too many columns with LEFT JOIN

I am creating a GeoPackage using several shapefiles using ogr2ogr (GDAL 2.2.4): ogr2ogr -f GPKG /path/to/out.gpkg -append -nln out -a_srs EPSG:4326 /path/to/in1.shp ogr2ogr -f GPKG /path/to/out.gpkg -...
vdavid's user avatar
  • 298
4 votes
0 answers
836 views

Reading zipped shapefile from URL directly into QGIS

I need to request a shapefile from an OpenTripPlanner Server and read the file directly into QGIS without saving the file to a disk. Background and requirements: Users system wont be able to write ...
MrXsquared's user avatar
  • 34.1k
4 votes
0 answers
231 views

Spatial regression: general nesting spatial model using splm package in R

I have a shapefile of panel data (multiple years of observations for each polygon). I am estimating fixed effects spatial regression models with this data. I used one year of this data to generate a ...
C. Ashley's user avatar
  • 405
4 votes
0 answers
247 views

Inconsistently getting "Input shapes do not overlap raster", CRS appear to match

Masking topographic raster data by a shapefile (bedrock geology polygon). Following this guide I do this: with fiona.open("geology.shp", "r") as shapefile: geology_mask = [...
joanmarie's user avatar
4 votes
2 answers
566 views

Extract pixel values in raster stack using shp

I am using the following code to extract mean pixel values over an area represented by a polygon: mean<-lapply(S2_stack, FUN=function (S2_stack) {data.frame(mean=extract(S2_stack, polygons2, fun=...
GCGM's user avatar
  • 1,118
4 votes
0 answers
542 views

What happens if you set QGIS as the default program to open a *.SHP file?

In the screenshots of shapefiles in this question, Accessing downloaded shapefiles/attribute data?, you can see that the .shp files have the QGIS logo as its icon. I think this means that on that ...
csk's user avatar
  • 24.8k
4 votes
0 answers
503 views

Import Large Shapefile to Postgres

I'm trying to import a large dataset to Postgres, of about 600MB, that sits on a remote AWS server. But I get the following error Not enough memory to allocate requested memory (nRecords=26923892). ...
tvieira's user avatar
  • 331
4 votes
2 answers
2k views

Searching for UN regions/sub-regions shapefile

for a visualisation project I need the boundaries of the UN regions as defined here : http://unstats.un.org/unsd/methods/m49/m49regin.htm That's 21 polygons for the sub-regions. I have been looking ...
fatz's user avatar
  • 149
4 votes
0 answers
2k views

How to build .vrt of shapefiles?

I've a huge number of shapefiles and I would like to create a VRT as I do with gdalbuilvrt for raster. I find here https://github.com/dwtkns/gdal-cheat-sheet that it should be possible and the format ...
Wraf's user avatar
  • 539
4 votes
0 answers
1k views

How to clip a big shapefile from another shapefile's extent

I am working on mangroves in Sundarbans (Bangladesh / India), using Landsat pictures. I need to equalize them in reflectance, before classification, for the evolution of the biomass in this region. I ...
Post. T.'s user avatar
4 votes
0 answers
1k views

Creating Shapefile spatial index programmatically in .NET?

I am creating a shapefile programmatically using DotSpatial using the following example syntax / pseudo code FeatureSet features = new FeatureSet(DotSpatial.Topology.FeatureType.Polygon); features....
AlexC's user avatar
  • 141
4 votes
0 answers
1k views

Open shapefile in ArcGIS Runtime WPF SDK as Graphics/Feature layer

I Googled and followed this tutorial and figured out how to import Shape files and Rasters into Runtime. However, it seems most of the functionality uses a FeatureLayer/GraphicLayer instead an ...
Kev84's user avatar
  • 860
4 votes
0 answers
2k views

Ogr2ogr: Unable to open datasource problem

I downloaded the Precints shapefile from the City of Boston's data hub, and I'm trying import it into SQLServer (I'm running the Express verson). I've already created the database in the SQLServer (...
Dan's user avatar
  • 41
4 votes
1 answer
2k views

Counting and rasterizing polygon overlaps in QGIS?

I have a large number of polygons that are overlapping. I'd like to create a heat map and plan on using raster calculation to do this. My plan: to give each polygon a raster value of 1, and adding ...
jpmaniac87's user avatar
3 votes
1 answer
87 views

How do I dodge overlapping line/polygon layers so that each is visible in QGIS?

I have 3 separate polygon layers that often overlap (image below). How do I change the symbology in QGIS to have them parallel to one another and not overlapping? (as shown in the second image below).
jabber95's user avatar
3 votes
0 answers
186 views

Create new grid based on another grid (shapefile) in QGIS

I have an shapefile of the historic grid Messtischblatt which is a CRS formerly used in Germany for the topographic map at a scale of 1:25,000. The CRS is OGC:CRS84 - WGS 84 (CRS84) I want to further ...
Mike's user avatar
  • 31
3 votes
0 answers
153 views

How to properly convert from WKT to euclidean 3d points?

I am not a geoscientist (I do computer graphics), however I am trying to render some geospatial data encoded as a WKT file. I have a POLYGON with 2 coordinates per point, which seems to be ...
Makogan's user avatar
  • 131
3 votes
0 answers
599 views

Editing shapefile adding fields with values with pyshp

I'm trying to add some fields to a shapefile using pyshp. The code I have to far is: import shapefile # Read in our existing shapefile r = shapefile.Reader(r"C:\...\Edit_SHP\TracksLines.shp"...
user179413's user avatar
3 votes
1 answer
203 views

How do I append a shapefile to PostGIS table with multiple geometry fields using ogr2ogr?

I am having an issue when trying to append shapefile data to an existing table in my PostGIS database using ogr2ogr. The existing table has multiple geometry fields. When I append the shapefile the ...
Helen's user avatar
  • 31
3 votes
0 answers
264 views

Plotting the albedo using Python

import glob import numpy as np import pandas import os import rasterio import geopandas as gpd import matplotlib.pyplot as plt def get_image_stats_only(img_array): raw_stats_dictionary = {'mean':...
Hanxi's user avatar
  • 51
3 votes
0 answers
213 views

Reducing points but maintaining attributes from original shapefile

I have a shapefile with points but there are a lot of points and I want to reduce the amount. I have tried "Points thinning" which automatically reduces the amount of points but it loses all ...
Mary's user avatar
  • 31
3 votes
2 answers
1k views

Geodataframe to PostGIS or shapefile

I have a GeoDatFrame df : df.geometry.name >>>'geometry' df.loc[:, 'geometry'] >>> Identifiant 0 MULTIPOLYGON (((2.827 42.691, 2.828 42.691, 2.... 1 MULTIPOLYGON (((2....
Basile's user avatar
  • 617
3 votes
0 answers
82 views

Difference in raster pixels between Windows x86 and Windows x64

I have a huge problem and I can not find a reason for it. I have two PCa, one in my house and the other in my workplace. The first one is an old notebook with Windows x86 and the other is Windows x64. ...
Pablo Sanhueza 's user avatar
3 votes
1 answer
813 views

Extract point cloud data from shapefile with Python

I am trying to plot profiles from LAS data. So my first step is to extract the data using a shapefile. I found this piece of code on the laspy website and thought I could use it to do this : def ...
User18981898198119's user avatar
3 votes
0 answers
763 views

QGIS 3.4.6 Cannot create fields in new shapefiles

Running 3.4.6 on Windows 10. Until today I have had no problems creating new shapefiles and fields. Now when I create a new shapefile everything in the new dialog box works as usual when I create ...
Robert Bryan's user avatar
3 votes
1 answer
220 views

Merge hole between shapes into any neighbouring shape to remove it?

I have a shapefile that I made by from 2 distinct shapefiles (I am using QGIS). The issue is that they don't overlap precisely so I have holes like the following: I tried the vertex editing tool but ...
Koo's user avatar
  • 63
3 votes
0 answers
143 views

QGIS – Edits to shapefile attribute table won't save special characters

I'm working in QGIS with a Government of Canada shapefile of all 338 federal electoral districts. The encoding is UTF-8. In the attribute table, all of the em dashes ("—") that should appear in the ...
mcsoma's user avatar
  • 31
3 votes
0 answers
93 views

Shapefile polygon operation efficiency

I would like to make a graph from a shapefile, where edges would express spatial relations between polygons according to DE-9IM For that, I use fiona + shapely My code is working but it is extremely ...
Chopin's user avatar
  • 143
3 votes
0 answers
424 views

ogr SetPrecision doesn't work

I'm creating a shapefile with a field type of real, but I want to lower the standard precision from 15 decimal places to 10, here is my code: dst_filename = "Polygonized.shp" drv = ogr....
Francis's user avatar
  • 917
3 votes
1 answer
488 views

Unicode problems while writing selected features to a new shapefile with Fiona

I have a shapefile with a large number of geographic features (marine protected areas). I'm trying to read through all of the areas in the shapefile, select those that fit a certain criterion, and ...
Matt NK's user avatar
  • 31
3 votes
0 answers
1k views

"DBF file can not be opened" error using shp2pgsql

I am trying to import a shapefile using shp2pgsql. I wrote this command: shp2pgsql -I -s 2154 -W "LATIN1" W:\IGN\BDPARCELLAIRE-RGF93-LB93-MAJ2013-V4\BDPV_1-2_SHP_LAMB93_D01\COMMUNE.shp CADASTRE....
maneva's user avatar
  • 31
3 votes
0 answers
82 views

Given a line find whether another line is along side, N,E,S,W or not

I have a shapefile representing roads (Black) and I need to know whether another line object (Red) is to the side of it. Including the orientation between them, to define whether the Red line lies to ...
nashm999's user avatar
  • 317
3 votes
0 answers
2k views

Draw shapefile over PNG image in R

I have a satellite image as a PNG with known coordinates (bottom, left, top, right). I want to draw a shapefile on it (the limits of a county) in R. My first thought was to convert the PNG (it's read ...
Rodrigo's user avatar
  • 782
3 votes
0 answers
227 views

GeoJSON files using too much memory?

I have about/more than 400 GeoJSON layer files in my QGIS project. When I checked the task manager memory, it displays qgis.bin.exe *32 using about 1,334,000 of CPU memory. I had another version ...
JAT86's user avatar
  • 932
3 votes
0 answers
183 views

Join CSV to shapefile failing when in saved map document in QGIS

I am trying to join a CSV file to a shapefile by matching on attributes. Here is the minimal workflow: Import shapefile in blank document. Save attributes of shapefile to CSV. 2.5 eventually, I ...
Chris's user avatar
  • 31
3 votes
0 answers
221 views

Enabling an Edit on Shapefile in QGIS only with a password?

I´m customizing some tasks in QGIS 2.14 using Python. I am managing these edits in different layers (always shapefile layers, not database). In one of them I want the users to enter a password ...
pacuga's user avatar
  • 103
3 votes
0 answers
81 views

QGIS - Layer missing polygons after pointsfile transformation

I'm using pointsfile transformation in QGIS for the georeferentiation of my layers. After the transformation the result some times has polygons missing like here: Why is this happening? How do I ...
dari1495's user avatar
3 votes
0 answers
534 views

Loading components of shapefile in QGIS?

I have a zipped shapefile with all components in place. It has a .shp file, a .dbf file and a .shx file.Projection file (.prj) and .sbn and .sbx files are also in place. I have tried loading the ...
Aseem Awad's user avatar
3 votes
0 answers
446 views

QGIS Error Loading Shapefile with Database Manager

I am a new QGIS user and have downloaded version 2.18.2 onto my PC (Windows 10). I'm trying to import a shapefile (using Database Manager) into a spatialite database that I created. However, I keep ...
Sean Connin's user avatar
3 votes
0 answers
488 views

Getting latitude and longitude of vertices/corner points of polygon/building from online maps such as OpenStreetMap?

I have tried using JOSM(Java OpenStreetMap) and QGIS for directly getting latitude and longitude of vertices/corner points of polygon/building but I am unable to get. Is there any way to get?
prakash's user avatar
  • 39
3 votes
0 answers
724 views

ogr2ogr{gdalUtils} correct syntax to set Ground Control Points for vector georeferencing

I would like to know correct syntax of R {gdalUtils} package (version 2.0.1.7) to georeference Shapefiles using corner points as GCPs. (These Shapefiles have y=height and x=width information, without ...
Kazuhito's user avatar
  • 30.7k
3 votes
0 answers
3k views

Clip shapefile with shapefile

There are two shapefiles. One is a compilation of municipalities on the coast with borders extending into ocean. The second shapefile is a coastal border. I'm trying to clip the municipality ...
Hanna's user avatar
  • 101
3 votes
0 answers
919 views

Shapefile "structure" of multipolygon

I am trying to generate a shapefile with Joel Lawheads pyshape-library. This works fine so far, but I have one important question: Is there any mandatory or recommended order of the rings of a ...
Kurt's user avatar
  • 7,087

1
2 3 4 5
20