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 [python]

Python is an open source interpreted programming language used in many GIS programs.

0
votes
0answers
25 views

Retrieving lat-lon coordinate from projdef?

I am trying to plot an hdf5 file where geographical domain is defined like : group LL_lat : 23.55908203125102 LL_lon : -138.4263916015652 LR_lat : 16....
2
votes
0answers
40 views

Estimating a Rotated Pole given a gridded dataset with lat/lons at each point

I have netcdf dataset that I think is regular gridded dataset using a Rotated pole mapping, but the rotated pole information is wrong. For those not familiar with Rotated Poles, the cartopy ...
1
vote
1answer
12 views

Python SQLite JSONSTRINGLIST

I have converted an XML (NAS) - File into a SQLite-Database using ogr2org - which worked quite well. Now I'd like to read the data using Python (3.72) - which works quite good as well. But there is a ...
1
vote
0answers
33 views

Importing gdal in Python with anaconda changes environment

I have installed gdal through anaconda. When I run a subprocess in Python before importing gdal I can get that gdal tools are located in my conda environment. For example subprocess.run(['which', '...
1
vote
0answers
17 views

ROI signature creation error

I'm trying to run a maximum likelihood classification on a Landsat 8 mosaic to assess land cover, but I keep getting the same error during signature generation: I never got this error before, and ...
1
vote
1answer
34 views

How to fill values in a field of a layer if the id columns of two layers match using pyqgis 3?

I have two layers, pipes and intersect layers. Both layers have an id, score column but intersect layer does not have all the ids present in pipes. So I am trying to check if the id present in pipes ...
0
votes
0answers
43 views

Issue with GeoPandas method 'contains' for two GeoDataFrames

I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2. In the image is clearly visible that transect number 16 (TR_ID=...
1
vote
1answer
135 views

QGIS 3 plugin not able to detect Python packages

I have installed the custom plugin which was created through plugin builder 3. I just added an import pymango statement and have deployed the plugin to QGIS. This gave below error with stacktrace. ...
0
votes
0answers
46 views

How to save Overpass query results to a GeoJSON file with Python?

I have just started to use Python and I would like to make a query to Overpass and store the results in a geospatial format (e.g. GeoJSON). As far as I know, there is a library called overpy that ...
0
votes
0answers
44 views

Broadcast Shapely Point on numpy array

I have some code that looks something like this: def get_objs(all_objs, line, my_distance): """ Gets all objs within my_distance of line. all_objs is a numpy array of shape (x, 4) ...
2
votes
1answer
106 views

How to create a squared buffer around a point with Python GDAL? [closed]

I have a large collection of points with X and Y coordinates in a projected coordinate reference system (EPSG:28992). I would like to compute a square buffer around it (say, 500 meters around the ...
0
votes
0answers
16 views

Filtered WMS from QGIS 3.2 Python console

I am using QGIS 3.2 and I am trying to get the WMS with a filtered display based on an attribute. The code works but the WMS is not filtered. urlWithParams3 = 'url=http://localhost:8080/sso/wms&...
0
votes
0answers
50 views

Noticing that Landsat 8 BQA band has smaller extent than other bands in Google Earth Engine?

I am using Landsat 8 TOA imagery and noticed the BQA band has a smaller extent than the other bands. This results in gaps along the edges where there are no values. This is a problem for me because ...
0
votes
1answer
49 views

Find higher elevation (10m) perpendicular point from stream network at regular interval

I have a stream network and for that network, I want to find the points at regular intervals which lie at 10m distance perpendicular from the stream.The final goal is to find the buffer of that 10m ...
0
votes
0answers
45 views

ArcGIS loads splash screen then quits (possible Python issue)

I have a student license of ArcGIS Desktop 10.6.1, working on Windows 10. When I try to open ArcMap, the splash screen loads, but then the program never actually opens. It doesn't generate any crash ...
0
votes
0answers
36 views

Why gdal create does not give the proper projection?

Here is my code. I want to resample the raster. But it doesn't set the projection, although I write it. May be there is a simplier way to perform the resampling by pixel size? Is it incorrect to set ...
0
votes
0answers
30 views

Loading spatialite with python3's module under Windows

I installed spatialite's Python module using pip: pip install spatialite I copied the mod_spatialite.dll found on https://www.gaia-gis.it/gaia-sins/index.html into my windows/system32 folder (I have ...
0
votes
0answers
59 views

GDAL install path issues on Mac OSX High Sierra

trying to run Django (django==1.11.9) in a Python 3.6.3 virtualenv with PostGIS. I've installed postgres, postgis, and gdal2 via homebrew. when I run make, the build signals: CPLUS_INCLUDE_PATH=/...
1
vote
0answers
34 views

Most effective way to find spatial relationships in python

I am trying to find the spatial relationship between two polygon geoDFs as follows: Find geoDF1.geom within geoDF2.geom else (not within) Find geoDF1.geom with largest intersection fromgeoDF2.geom ...
0
votes
0answers
28 views

Get central meridian, PyProj?

I am using PyProj and I am trying to find a way how to get Central Meridian and Latitude of the center of the zone for my State Plane coordinate system.
1
vote
0answers
56 views

QGIS plugin + project: Enter db credentials(password and username) programmatically

I am developing QGIS Python plugin. I have a QGIS project and layers stored in a PostGIS database. I don't want to store the password into the project and I want to avoid that user need to type ...
1
vote
1answer
51 views

Python - Convert shapefile lat-long value from Degree minutes seconds to Degree decimal

I am processing shapefiles in python using standard library functions like Python “shapefile” library and GeoPandas. I have two shapefiles having the same projected co-ordinate system-> ...
1
vote
0answers
29 views

Open Identify Results Window from QGIS Plugin [duplicate]

I am trying to open Identify Results docked window using qgis plugin. How can i open the identify results window using feature id? I am iterating through active layer, get a specific feature and then ...
0
votes
2answers
49 views

Remove duplicate strings from a field with Field Calculator in ArcGIS

I tried using the same codeblock in this post: Remove duplicates from a field, but it is just copying the contents and not removing duplicates. I think my data is formatted the same. Anyone see what I'...
2
votes
1answer
44 views

Lambert conformal conic alternative projection in PROJ4

What's the difference between Lambert conformal conic projection and Lambert conformal conic alternative projection in PROJ4?
-1
votes
1answer
39 views

Python gdal.Warp doesn't create a file

I would like my code to write a tiff file from GRIB while changing the resolution. So I take file1 (GRIB fmt) and translate it to tiff. The file appears in the folder. Then, I make a warp, but no ...
0
votes
0answers
35 views

Float not iterable with Python shapefile lib

I'm learning the basics of shapefile lib for Python, but I've found a problem. After several hours searching I haven't found the cause of this problem. When I try to create a simple poly: # -*- ...
3
votes
1answer
38 views

How can I programmatically style layer after output is returned from QGIS 3 processing script?

Hi this may be more of a python question rather than qgis processing script question. I've managed to successfully get the output that I want from my processing script, but I wish to take one step ...
1
vote
0answers
38 views

What is the difference between creating a plugin in QGIS 3.x and writing a python standalone script in QGIS 3.x? [closed]

I am developing a plugin in QGIS where I have used the template "Tool button with dialog". I am using this tutorial: http://g-sherman.github.io/Qgis-Plugin-Builder/ and https://www.qgistutorials.com/...
2
votes
0answers
32 views

How to create a raster in GDAL with Int64 datatype: Rasterizing a vector layer with very large ID as attribute

I use the following python code to rasterize a vector layer using gdal.RasterizeLayer output = 'F:\\TEMP\\rasterized.tif' target_ds = gdal.GetDriverByName('GTiff').Create(output, x_res, y_res, 1, ...
1
vote
1answer
43 views

How do I interactively select a polygon in ArcMap 10.3 and pass the selected feature to a Python script

I currently have a Python 2.7 script that takes a hard-coded select by attribute arcpy.SelectLayerByAttribute_management("SoilLandscapePolygons_Layer", "NEW_SELECTION", "POLY_ID = 25984) that then ...
2
votes
2answers
76 views

Read aviris data with python

I try for too ling to read the envi file in python. Normally this is very easy. First, I extract necessary values from the .hdr: for line in open("../../local_storage_only/aviris/...
3
votes
0answers
57 views

Automatically update and reclassify project layer from Excel data

I have a project in Qgis that gets its data from a locally stored excel file (linked). Is there a way to automatically update the linked data? What is happening now is that when I change some rows in ...
0
votes
0answers
39 views

Sort before/during identify duplicate values

I'm using ArcMap and I'm trying to find (and eliminate) features based on duplicate values. I found the following code: uniqueList = [] def isDuplicate(inValue): if inValue in uniqueList: ...
1
vote
0answers
37 views

gdal_calc.py result are false and not the same as “direct” calculation

I need to do the raster calculator operation as "raster + constant" in Python. The input rasters are DEM data with float original type and -9999 for the NoData. The constant is float too. In 1st way, ...
1
vote
1answer
42 views

Buffer loop with Python QGIS

I want to iterate a buffer from a list of distances I have, but I can´t find the way to do it. I´m a beginner on Python. import processing x=[100, 200, 300, 400, 500] processing.run("native:buffer",\ ...
0
votes
1answer
34 views

How do I contribute to opencv-python? [closed]

I have an implementation of a computer vision algorithm in python. I would like to contribute this to opencv-python. This is my first time contributing to FOSS. How should I go about it?
2
votes
1answer
58 views

Automatically get an adequate projection system based on a bounding box [closed]

The website http://projectionwizard.org/ offers a very easy way to get an appropriate projection system based on a bounding box and choosing whether projection criterion should be equal-area, equi-...
1
vote
1answer
255 views

Fixing “The resource compiler pyrcc5 was not found”

I was trying to use Plugin Builder to create custom tool. When I set up parameters for plugin and press "generate", an error appear. Same situation in QGIS that was downloaded with OSGEO4W64. I ...
2
votes
0answers
17 views

Clustering by Equal Sum Value [closed]

I have a shapefile of points that each have a value A. I want to be able to create cluster regions such that if I sum value A for each point in a region, the sum of value A for each region will be ...
2
votes
1answer
72 views

How to convert a spatial Oracle LOB object type to a Geodataframe listlike geometry object column

I have in my dataframe one column with cx_Oracle.LOB object [2D polygon type], made with a SDO_UTIL.TO_WKTGEOMETRY SQL function and I want to create a geodataframe, and set my geometry column the ...
3
votes
1answer
53 views

Python time condition within Calculate Field

I am attempting to assign 0/1 values to each row with a point feature class based upon a time dependent condition with ArcMap Model Builder 10.2.2. The points are categorized based upon a series ID ...
1
vote
0answers
68 views

Python GDAL showing incorrect metadata for GRIB file

I'm trying to read a GRIB file containing ERA-5 single level data that I downloaded from the Climate Data Store (CDS, https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?...
1
vote
1answer
32 views

Check if point in GIS polygon fails to produce correct output

I've tried many, many many, ways to find out if a point is in a GIS polygon based on many great posts, but I can't get any to work properly. Specifically I created a grid of points covering the ...
2
votes
1answer
72 views

How do I set QgsVectorFileWriter.SaveVectorOptions for QGIS 3?

I wrote a processing scrip for QGIS 2.18 to create a multi-distance buffer rings using the haversine formula. Unfortunately, it no longer works after I updated to QGIS 3.4.5. I've tried updating the ...
1
vote
0answers
33 views

Raster output symbology differs in tool vs. Python

I have a bunch old DOQQs from the 90's that are projected in NAD27, giving them the black angled collar you see in the image. I am trying to set the collar to null by running SetNull on Value = 0. If ...
1
vote
0answers
25 views

wkbMultiPoint to wkbPoint conversion using python

Is there a way to convert an ogr.wkbMultiPoint geometry (only one record for several points in the attribute table) to an ogr.wkbPoint one (a record per point) using python or pyQgis?
3
votes
1answer
70 views

PyQGIS: “for” loop with nested “if ..elif …” condition

I want to update an existing field according to another, it means the equivalent of a CASE WHEN .... THEN ..... ELSE .... END in SQL , but I want to know how to write this same update in Python for ...
1
vote
1answer
85 views

Calculate percentile value of raster

I want to set null all raster values that fall below the 75th percentile value. E.g. If you classify the raster by quantile method into 4 classes I want to be left with the top 25% percentile. For the ...
1
vote
1answer
89 views

Increasing resolution of Cartopy stock background?

I am trying to create a small application that will show zoomed in maps. If possible, I would like to avoid using map tiles. Going off the example on this page: https://scitools.org.uk/cartopy/docs/...