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.

905 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
0 answers
300 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....
user avatar
8 votes
2 answers
441 views

Multi-field labeling of shapefile with PyQGIS

I wrote the following code in order to draw the line labels with multiple fields. However, the label do not appear automatically in QGIS and I have to switch the "Layer Properties/Labels", ...
user avatar
  • 811
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 ...
user avatar
6 votes
0 answers
2k 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 ...
user avatar
  • 2,778
6 votes
0 answers
1k 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 ...
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 (...
user avatar
  • 61
5 votes
0 answers
107 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 ...
user avatar
  • 51
5 votes
0 answers
209 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 -...
user avatar
  • 298
5 votes
0 answers
2k views

GeoPandas transform latitude/longitude coordinates to UTM coordinates

I have a shapefile which I read with GeoPandas, this shapefile has lat/long coordinates and I want to transform it to UTM coordinates. I tried this: shapefile = gpd.read_file('example.shp') #CRS = ...
user avatar
5 votes
0 answers
840 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 ...
user avatar
  • 51
4 votes
0 answers
159 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 = [...
user avatar
4 votes
1 answer
303 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=...
user avatar
  • 1,068
4 votes
0 answers
3k views

Change default "save as" folder QGIS

I would like to change the default path for saving layers ("save as" in the main layers panel). Now the default is C:\Program Files\QGIS Lyon\bin (in which I even don't have the rights to save ...
user avatar
  • 543
4 votes
0 answers
409 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). ...
user avatar
  • 321
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 ...
user avatar
4 votes
0 answers
972 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....
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 ...
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 (...
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 ...
user avatar
3 votes
0 answers
42 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 ...
user avatar
  • 31
3 votes
0 answers
598 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 ...
user avatar
  • 26.3k
3 votes
1 answer
200 views

Shapefile not aligning with raster in Google Earth Engine?

When I upload a raster and shapefile into Google Earth Engine, the shapefile doesn't align properly. The datasets align perfectly in ArcMap, Envi and R. Both the raster and the shapefile are in EPSG ...
user avatar
3 votes
0 answers
65 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 ...
user avatar
  • 131
3 votes
0 answers
235 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"...
user avatar
3 votes
2 answers
983 views

Calculating the area of multiple polygons using GeoPandas

I am writing a Python script to calculate the area of polygons, as I have a small polygon, I am getting the area of polygon 0.000. A shapefile contains multiple shapefiles. I am thinking due to the ...
user avatar
  • 111
3 votes
2 answers
195 views

Simulation in grid/array over map in Python

I'm new to GIS. I'm a physicist and I have a simulation which I usually run in numpy arrays (usually ending up with a heatmap or contour plot like below). However, I now want to run the simulation ...
user avatar
  • 39
3 votes
0 answers
149 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':...
user avatar
  • 51
3 votes
0 answers
85 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 ...
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....
user avatar
  • 567
3 votes
0 answers
74 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. ...
user avatar
3 votes
0 answers
598 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 ...
user avatar
3 votes
0 answers
357 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 ...
user avatar
  • 23.2k
3 votes
0 answers
102 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 ...
user avatar
  • 31
3 votes
0 answers
85 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 ...
user avatar
  • 143
3 votes
2 answers
2k views

QGIS "Sum Line Lengths" return 'nan.'

I have a polygon shapefile and a (merged) line shapefile (both are zipped). When I use Vector -> Analysis Tools -> Sum Line Lengths on these shapefiles, I get a layer with some of the LENGTHS filled ...
user avatar
3 votes
0 answers
315 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....
user avatar
  • 817
3 votes
1 answer
418 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 ...
user avatar
  • 31
3 votes
0 answers
920 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....
user avatar
  • 31
3 votes
0 answers
4k views

Create custom color map for multiple GeoPandas plots to share same scale

My objective is to create a 2x2 figure where each cell in each grid is on the same color scale. Currently, I haven't found a compound plot option in GeoPandas that allows me to plot one GeoDataFrame ...
user avatar
  • 169
3 votes
0 answers
114 views

Extracting information from netcdf file

I started using QGIS yesterday since ArcGIS refuses to work, and I have my difficulties with it. In short, I want to extract the information on GCP from this netCDF file, so that I can perform geo-...
user avatar
3 votes
0 answers
77 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 ...
user avatar
  • 307
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 ...
user avatar
  • 733
3 votes
0 answers
181 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 ...
user avatar
  • 892
3 votes
0 answers
168 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 ...
user avatar
  • 31
3 votes
0 answers
172 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 ...
user avatar
  • 103
3 votes
0 answers
77 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 ...
user avatar
3 votes
0 answers
520 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 ...
user avatar
3 votes
0 answers
441 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 ...
user avatar
3 votes
0 answers
643 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 ...
user avatar
  • 29.2k
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 ...
user avatar
  • 91

1
2 3 4 5
19