The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
23 views

Clip two shapefiles in Python using only OGR results in error Segmentation fault (core dumped)

Is it possible to clip two polygon shapefiles using only the ogr library? It has to be a native Python solution, so subprocess.call(['ogr2ogr', '-clipsrc', ...] ) is not what I'm looking for. ...
1
vote
0answers
23 views

Interpolating VRT to Geotiff using gdal.Grid in Python creates null image

I have a set of points with X, and Y coordinates and associated Z values POINT (-102.9071045 31.43453407 1871.930298) POINT (-102.8339386 31.45111084 1856.14209) POINT (-102.4687424 31.53144836 1869....
0
votes
0answers
19 views

Using CARTOframes to push to CARTO account

I am using CARTOframes to create and style a map that includes widgets. I'm able to push a Dataset to my Carto account and to publish and update a map, however I can't seem to get that published map ...
0
votes
0answers
11 views

How to create an empty raster given a bounding box?

I want to create an empty raster, given its bounding box (area of interest). Let's say this is the bbox: raster_bbox = [x_min = 0, y_min = 0, x_max = 1000, y_max = 1000] Then I have a list of ...
0
votes
0answers
31 views

Slow seeding/caching from GeoServer WMS to MapPRoxy

I face a unormal speed of re-seeding (updating old tiles by new from one source - WMS GeoServer (in GeoServer this data taken from PostgreSQL source)) from 5.32% to this [08:39:10] 11 5.42% -...
0
votes
0answers
10 views

mapproxy seeding optimisation. Internal HTTP error

We are using mapproxy for caching our own big data from geoserver. When I run seed : mapproxy-seed -continue -f mapproxy.yaml -s seed.yaml the terminal sometimes throws this warning (like in this ...
1
vote
1answer
28 views

List datasets from geodatabase faster

I'm using a script to list datasets from multiple gdbs in ArcPy (to rename most datasets and gdbs). Which looks like this: dir_gdbs = 'D:\\mypath' os.chdir(dir_gdbs) lista_gdbs = glob.glob('*.gdb') ...
-2
votes
1answer
41 views

Return highest number from a list of coded numbers [closed]

I'm trying to make a button in ArcMap that returns the highest number from a list of coded numbers we have for our manhole layer. The structure of the coded values is as follows "0010010001". This ...
2
votes
0answers
29 views

IDE PyCharm settings for developing a QGIS plugin

How do i setup pycharm to recognize QGIS modules? IDE: PyCharm OS: Ubuntu 18.04 QGIS: 3.8 example of imports this answer is very close to the solution but I cannot add the interpreter location I'...
2
votes
0answers
34 views

Add WMS to matplotlib Python

Currently I am adding a basemap from stamen.com to my plots as it is explained here: http://geopandas.org/gallery/plotting_basemap_background.html . Is it also possible to load a WMS from another ...
1
vote
0answers
36 views

How to fix rasterio error: The EPSG code is unknown. Unable to open EPSG support file gcs.csv

I try to open a jp2 image with the Python's Rasterio package. The code is below. The problem is that the coordinate reference system is not recognised and when I want to see the meta attribute of the ...
0
votes
1answer
33 views

Irrigated Area Recognition in Google Earth Engine

I'm using Google Earth Engine with the Python API. I have calculated the NDVI value over an area, set a threshold and the result is a layer where black areas exceed my NDVI threshold (don't pay ...
1
vote
1answer
40 views

Earth Engine into Tkinter Canva

I'm creating a GUI in Python for a Google Earth Engine Application and this is the result so far. I can't figure out how to insert the map generated by Google Earth Engine into the grey area in the ...
1
vote
1answer
48 views

Calculating destination point using Python

I am trying to write a function that calculates the GPS (decimal) coordinates of a point that is far of a given distance from a given point. Let say that we start from point 1 (The stripe of Dublin) ...
0
votes
0answers
29 views

MMQGIS Geocode is failing in QGIS 3.8

I'm having problems with the MMQGIS plugin: after updating the QGIS version to 3.8 (Zanzibar) the plugin does not join multiple layers anymore. This is the error message: AttributeError: '...
2
votes
1answer
110 views

Counting number of points in each grid?

I would like to count the number of points in each cell. I have tried https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html but the out isn't appropriate. Does anybody know how I ...
1
vote
0answers
28 views

Change size to the squares of the confusion matrix [closed]

I have a problem with size in the 'plot_confusion_matrix', the squares of the confusion matrix appear cut off. I would like to solve this problem. svc = SVC(kernel='linear',C=1,probability=True) svc....
0
votes
0answers
33 views

Comparing 2 GPS location data files to find if any location from one file is within a specified elliptical region of a location from another

I have 2 CSV files with GPS coordinates. I want to check if there are any locations in the first file which are inside a specified elliptical region surrounded by each location in the 2nd file. The ...
1
vote
2answers
29 views

Launch bat. for QGIS 3 python not working

I'm trying to build a launch.bat for qgis 3 python. I would want to run python via batch file but I get an error 'no module named processing' Launch.bat: @ECHO OFF set OSGEO4W_ROOT=C:\OSGeo4W64 @...
0
votes
1answer
32 views

Change path in Anaconda environment to point to ArcGIS Python interpreter on Windows?

I want to have an Anaconda environment that will use the Python interpreter installed with ArcGIS Pro. I am working in Windows. I have been using Anaconda Prompt to configure virtual environments, ...
1
vote
1answer
31 views

Can't send the string output (from a Python tool) to work as a input for a tool in a model (ArcGIS Pro)

I have a model that uses the Feature Class to Feature Class tool. It needs 3 inputs (Input layer, location and output name). My goal is that a user would choose a layer, the model would create a new ...
1
vote
0answers
25 views

How to match name if layer name contain “\f” [closed]

One of my layer name is "FullProbeWMS\fullprobewms[Heatmap] Trace Lines" Where I check if this layer is present or not by using below code. for lyr in arcpy.mapping.ListLayers(mxd): if lyr....
2
votes
1answer
42 views

Moving a memory layer in the TOC using PyQGIS

I've got a layer (difflayer) that has been created in memory. Basically, all the layers I've got in this project are in memory and the layer creation/manipulation is all being handled via a plugin. ...
2
votes
1answer
54 views

Displaying Bing Maps WMS in QGIS?

I am trying to display my bing map raster tiles in QGIS. I am using an HTML file like this, except with my own raster tiles, as described in WMS Tile Layer Example. My own raster tiles don't have a ...
0
votes
0answers
25 views

Questions on Area and Perimeter with Python in ArcPro

I was given a file and asked to get an area and perimeter by utilizing the field calculator with python. To get the area I did the following: Area = !shape.area! To get that perimeter did ...
2
votes
1answer
43 views

Truncating points precision

I have geopandas with CRS in meters (ITM {'init' :'epsg:2039'}). I converted the geometry from espg:4326 so I have very high precision which I don't require: POINT (177559.4776412862 594546....
1
vote
0answers
29 views

PyQGIS ogr provider not Found

I using PyQGIS in my python application,My program couldn't find org provider and failed to create layer. My code and environment are as follows. The env: The Code: from qgis.PyQt.QtCore import Qt ...
1
vote
0answers
38 views

Mathematical rule to convert between degrees and centimeters based upon projection

I have some Tanzania drone imagery data in a local geographic projection EPSG:32737 that uses the unit of meters. Then I have other vector data that is in EPSG:4326 which is denominated in degrees. In ...
0
votes
0answers
23 views

Running pygrass on Linux(Mint) based on GRASS 7.8

I want to try out the pygrass API and I dont want to use GRASS cli. I would like to write a python script, import the pygrass and play around with common algorithms eg distance, buffer etc. On my ...
1
vote
1answer
48 views

Converting Longitude range from (0,360) to (-180,180) in Python or by using gdal commands

I have a raster downloaded. Visualising it in QGIS. I want to correctly project it so that its extent varies with longitudes from -180 to 180 instead of 0 to 360. gdalinfo filename.nc outputs the ...
1
vote
1answer
77 views

Dataframe of points to PostGIS

I have a csv file with some info and coordinates and I want to create a table in PostGIS with that CSV file. This is what I have so far: import pandas as pd import geopandas from datetime import ...
0
votes
1answer
43 views

“addItem” in Portal for ArcGIS not working?

I'm trying to upload a PDF file to my content in Portal for ArcGIS using python. So far, I'm able to succesfully create a token, but I'm having troubles using REST operation : Add Item/Add ...
1
vote
1answer
19 views

How to return object or string value with arcpy.SetParameter

I am creating a geoprocessing tool in ArcMap 10.5.1. I have the following code: import arcpy event_data = arcpy.GetParameterAsText(0) event_data_id = arcpy.SetParameter(1, event_data) event_data_pc = ...
2
votes
0answers
22 views

How to set the extent with gdal_rasterize, the “-te” does not work

I am using gdal_rasterize to clip mask by shapefile. However, the parameter "-te" does not work. I use subprocess to call GDAL util: import subprocess # define paths to raster and vector inraster = ...
4
votes
0answers
54 views

Running and scheduling processing jobs in QGIS 3?

Basically I want to write a script that would run on a daily basis on QGIS 3. This tutorial seems to have exactly what I want but the tutorial only works for QGIS 2. QGIS Tutorials and Tips | ...
0
votes
0answers
23 views

Unitary test for anisotropic ordinary kriging

I am reading the book from Isaaks and Srivastava "An Introduction to Applied Geostatistics" and I am coding a small library in Python to perform kriging. I know there are other tools but I wanted to ...
0
votes
0answers
27 views

Memory usage (or absolute bytesize) of geometry objects(shapely) in a GeoDataFrame in Python?

I am currently working on analyzing data structure and size of a shapefile. To analyze it, I was wondering how much geometry column consumes the size of a shapefile. Unlike other features, geometry(in ...
1
vote
0answers
12 views

How to disable schema locking on all services on ArcGIS Server?

I have a situation in which all services published to an ArcGIS Server (10.6.1) were published with schema locking enabled. I would like a way to disable schema locking on all services without having ...
0
votes
1answer
55 views

Converting .map() from JavaScript API to Python API?

I wrote this code using the Earth Engine JavaScript API. The code clips the image collection using variable "table," which is a feature collection of about 12,000 points. I get the length of the image ...
1
vote
0answers
28 views

How can I easily determine the precision of an OGR geometry?

I'm writing a python tool to update some river catchment boundaries and keep running into geometry errors, such as WARNING: TopologyException: Input geom 1 is invalid: Self-intersection at or near ...
1
vote
1answer
25 views

QgsVectorLayer error empty

I try to develop an app using QGIS Api. My code looks like this (it's an app with a gui) : QgsApplication.setPrefixPath("C:\OSGeo4W64\apps\qgis", True) qgs = QgsApplication([], True) qgs.initQgis()...
1
vote
0answers
31 views

How to rename a geopackage table in Python?

I'm trying to rename a geopackage table from a QGIS 3.8.0 Python processing script. But it leaves a broken dataset in 2 parts, where the tabular data table has been renamed but leaves the geometry ...
2
votes
0answers
42 views

Plotting Single Band & Multi-Band Stacked TIFF File using Rasterio in Python

I have 2 raster files (one single band and other multi-band stacked (465 bands) tiff file) which I am trying to plot using the following code: import rasterio as rio from rasterio.plot import show ##...
1
vote
2answers
38 views

Cut raster by pixels in GDAL

i've some georeferenced images that have the size of 1280 X 960. I need to cut the outer pixels to have a size of 1220 X 900 (i need to cut 30 pixel for each borders). Can i do this using GDAL or a ...
0
votes
1answer
27 views

Using raster calculator with GDAL in Python to make sum?

I have 130 rasters in a folder and I would like to create a new raster containing the sum of the 130 raster cell values. How can I do this?
1
vote
1answer
35 views

Using raster calculator with GDAL in python?

i am using an hyperspectral image with 158 bands. I want to calculate raster. i am using the following python script import gdal # Import GDAL library bindings from osgeo.gdalnumeric import * from ...
0
votes
0answers
53 views

Export: Error: Internal error. from Google Earth Engine

I'm attempting to export an image by a time block for a particular census KML using the method below. Earth Engine is kicking back "internal error". As the error is not very helpful, I am having a ...
1
vote
1answer
32 views

import gdal, return “ImportError: DLL load failed:”

I came up against this problem during the installation of gdal, I tried several solutions already read on the site but none helped me. Here's what I did: 1) uninstall gdal 2) uninstall Anaconda 3) ...
0
votes
0answers
42 views

ImportError: libkea.so.1.4.7: rasterio

I am working in Tethys platform. I am trying to use rasterstats module for getting min max for a raster data with in an AOI(area of Interest). from rasterstats import zonal_stats when I use this ...
2
votes
1answer
40 views

Python GDAL writing image output all pixels as zeros

I have an array "array" with numbers range from -5 to 1 (with decimal) and I tried to write it as a geotiff. However, the output geotiff turns out to be all zeros. Can someone tell me why? Here the ...