Skip to main content
18 votes
Accepted

calling gdal_merge into python script

Add an empty argument in the first approach (because gdal_merge.py parses arguments starting from 1 and not 0): import sys sys.path.append('C:\\OSGeo4W64\\bin') import gdal_merge as gm gm.main(['', '-...
Antonio Falciano's user avatar
5 votes

calling gdal_merge into python script

Windows 10, Python 3.9, QGIS 3.20 (installed with OSGeo4W). This code works fine: import osgeo_utils.gdal_merge output_file_path = r'insert path here' input_files_path = r'insert path here' parameters ...
Comrade Che's user avatar
  • 8,208
5 votes
Accepted

Code works in Python IDE but not in QGIS Python editor

You are converting your coordinates to "string" type: df['Easting'] = df['Easting'].astype("string") df['Northing'] = df['Northing'].astype("string") and then making a ...
Spacedman's user avatar
  • 66.5k
4 votes

Translating raster from GTiff to ASC format using GDAL Python package?

Please try with the following Python snippet. Need to remember that outputfile path is first, and is followed by the inputfile path. gdal.Translate(OutTileName_asc, OutTileName_tif,format='AAIGrid')
Ramesh K Banagar's user avatar
3 votes
Accepted

ECCODES ERROR when opening .GRIB file in Spyder/Visual Studio Code

I solved that problem just creating an environment variable called ECCODES_DEFINITION_PATH. You have to find the path to "definition" folder. In my PC, That path is C:/Users/Geanderson....
Geanderson Michel's user avatar
3 votes

How to import qgis.core in spyder?

I do not familiar with spyder since I write scripts by PyCharm which is pretty awesome. And I have solved your problem according to the blog. http://spatialgalaxy.net/2014/10/09/a-quick-guide-to-...
zhulj's user avatar
  • 51
2 votes
Accepted

How to use gdalwarp in Spyder?

You can execute a command in a subshell using os.system(). For example: os.system('gdalwarp -q -cutline G:\2016.06.MOD\MOD02\5Clip\Clip_Image_Shp\Clip_Image.shp -tr 1000.0 1000.0 -of GTiff G:\2016.06....
Aaron's user avatar
  • 51.8k
2 votes

Cannot import qgis.gui into Spyder

Not sure if you still have this issue, but just in case it helps someone: I had a similar issue with Ubuntu Studio 18.04, trying to make QGIS 3.4 and 3.10 work. I am currently using the ubuntugis PPA ...
stragu's user avatar
  • 248
2 votes
Accepted

Intercept incorrect entries Python

If you want to make sure you got a numeric input you can try to use the following try/except clause: try: lat2 = float(userEingabe) lon2 = float(userEingabe2) except ValueError: # alert ...
Marcelo Villa's user avatar
2 votes
Accepted

Import Qgis.core in Spyder

I'm somewhat confused that you have a recent QGIS (3.16.5), but that you're starting a Python 2.7? QGIS 3 uses Python 3, not 2.7 and it won't work. At any rate, in your QGIS installation, you'll find ...
Huite Bootsma's user avatar
2 votes

How do I integrate the environments of QGIS and Anaconda/Spyder?

Anita Graser (AKA @underdark) wrote an article that I was literally reading today, which may help. Its a slightly different answer, as she talks about Linux environment and Jupyter notebooks, so its ...
nr_aus's user avatar
  • 3,606
2 votes

How do I integrate the environments of QGIS and Anaconda/Spyder?

Surely you will be able to instantiate a Qgis app and project object into Spyder or Jupyter, also load a layer, set it to active and render a map canvas (thanks to Anita Graser for writing this post). ...
Gabriel De Luca's user avatar
1 vote

"ImportError: DLL load failed while importing _gui: The specified procedure could not be found" error when using PyQGIS in Standalone application

Make sure you have configured you IDE, as suggested in the QGIS user guide: https://docs.qgis.org/3.34/en/docs/pyqgis_developer_cookbook/plugins/ide_debugging.html#a-note-on-configuring-your-ide-on-...
HeikkiVesanto's user avatar
  • 16.9k
1 vote
Accepted

RuntimeError when adding shapefiles using addDataFromPath in Python

The addDataFromPath() method of the Map class expects a path to a dataset like a shapefile rather than a path to a workspace like a folder that contains a shapefile. You are currently providing the ...
PolyGeo's user avatar
  • 65.4k
1 vote

Unable to import arcpy into Spyder with ArcGIS Pro 2.7

It sounds like you are using the wrong version of Spyder. I created a tutorial on Installing spyder IDE for ArcPro [sic] at GeoNet that you can try to follow to accomplish this.
Hornbydd's user avatar
  • 44.6k
1 vote

IDE with Spyder to works with both ArcGIS Pro and ArcMap?

Most Python IDEs can do this. I personally use PyScripter. This link should help you. https://community.esri.com/t5/python-documents/run-pyscripter-with-arcgis-pro-s-python-3-x-and-the-arcgis-api/tac-...
John's user avatar
  • 617
1 vote
Accepted

Seeking Python API to assess accessibility to foodbank site?

For the HERE API there's a Python API wrapper but I've not tried this. There's a good list of other Public Transport APIs here on GitHub. I see you're in the UK. The UK Government published a data ...
Steven Kay's user avatar
  • 20.6k
1 vote
Accepted

Error sending request to OpenRouteService API from a set of client addresses to a foodbank site

I guess from this link that OpenRouteService requires a tuples of coordinates within a parent tuple like: coords = ((8.34234,48.23424),(8.34423,48.26424)) You have to provide the API the exact ...
umbe1987's user avatar
  • 3,785
1 vote

Error sending request to OpenRouteService API from a set of client addresses to a foodbank site

The API's website has its documentation behind a login, so I could not get a written version of this, but based on the slide at 14:13 of this video https://www.youtube.com/watch?v=flJx1rFvccE the ...
SMiller's user avatar
  • 3,726
1 vote

Create Query either using Select by Attributes or Python

Assuming Address is unique to a customer (may be user customer ID instead) and that there can only ever be water or sewer as service types then a simple aggregate by customer counting on type will ...
Hornbydd's user avatar
  • 44.6k
1 vote

arcgisscripting module not found in Python 3.5 in Spyder IDE

Okay all, I think that I figured out the problem. When I cloned the ArcGISPro environment, I used the following: conda create --clone arcgispro-py3 --name clone. This led to the creation of a clone ...
user44796's user avatar
  • 1,957
1 vote

arcpy SelectLayerByAttribute_management runs in the Python window in ArcGIS Pro, but fails to run from Spyder or PyCharm

You need to add field delimiters, like "quotes", 'single quotes' or [brackets]. Use AddFieldDelimiters for this: Adds field delimiters to a field name to allow for use in SQL expressions. ...
Bera's user avatar
  • 77.8k
1 vote

Importing arcpy in Spyder to use with ArcMap

You could clone ArcGispro conda like below: conda creat --name arcgispro --clone="C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3" Then, you could activate this conda env and install ...
Alireza Naziri Khansari's user avatar
1 vote

Importing arcpy in Spyder to use with ArcMap

This method worked for me to install ArcPy on Spyder. I am using ArcGIS Pro. First, open Spyder and press: shift+ctrl+alt+P to open Preferences, then go to Python interpreter, select ‘use the ...
KirkyLady's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible