Questions tagged [python]

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

Python logo

Python is a dynamic and strongly typed general purpose programming language. It has an extensive standard library and a community-run index of third-party packages: PyPI. The language is free and open source, even for commercial use; its license is managed by the Python Software Foundation.

Python's use in GIS goes back to about 2000 with the development of Python bindings for GDAL and AVPython.

There are additional questions and answers on StackOverlow python's tag for Q&A about python outside of GIS. There could be some related to GIS but they should most likely be moved over to GIS.

12064 questions
12
votes
2 answers

Measuring Script Writing Competency?

I've been asked by my manager to come up with some sort of competency measure for an employees understanding of scripting/programming. Because I am a self taught programmer, I really don't have a formal understanding of how to measure ones level of…
Mike
  • 2,281
  • 2
  • 29
  • 46
11
votes
3 answers

Downloading and processing raster files in Python?

I am fairly new to python and seek guidance for a question which might sound trivial to many. Is there a way to use 'wget' in a python script to download raster files from a server and process them in the same script?
Ibe
  • 1,231
  • 3
  • 20
  • 37
10
votes
3 answers

Using variables from one Python script in other Python scripts?

I want to set up a single python file containing variables that have the locations of all my data sources. This would then be used by all my other scripts, then as a data source changes, I only have to edit the one file. My Data_sources.py would…
User Error
  • 487
  • 1
  • 4
  • 16
6
votes
1 answer

What format is NEXRAD level 2 data in?

I am trying to download raw radar data off of https://s3.amazonaws.com/noaa-nexrad-level2/index.html The files do not have extensions. What format is the data in (grib, netcdf, etc.)? How do I extract it using 7-zip? How do I view it as an image? I…
anon
5
votes
4 answers

What Python package to use to calculate midpoint?

I asked a question earlier about how to calculate a midpoint. I was wondering if there is a Python library that does this alreay?
Jouah
  • 101
  • 2
  • 4
5
votes
1 answer

Create a column 'geometry' of points with longitude and latitude data given in a pandas DataFrame

I have loaded a .csv data into a pandas DataFrame and want to create a column named 'geometry' which will be made up of the shapely points from the lat and lon as given in the data. The data is below I therefore would want to create a Shapely point…
PKU
  • 53
  • 1
  • 1
  • 5
5
votes
1 answer

Getting script file name as object in Python?

I'm quite new to Python and programming in general. I have created a few scripts using Python and as part of my framework/best practices for my scripts, I'd like to display when a script begins and ends in the IDLE shell. For now, I have just been…
Kari
  • 115
  • 1
  • 2
  • 6
4
votes
3 answers

Use Python to parse string

OK, I know that this is Python 101, but I can't seem to figure it out. I have a function setup that will return a string, specifically an azimuth in DMS. I need to take the return values and pull out only the value that appears prior to an ":" So…
CodeSpatial
  • 830
  • 2
  • 10
  • 18
4
votes
1 answer

Arcgis Stop Working with my Loop Scrip (Could Be Memory)

I am having issues with my scrip, because it makes my computer very slow after 15 loops arcgis 10.1 and explorer.exe crashes. But instead of this, i can see my 15 pdf files saved correctly and i need to move the cursor to 16 for begin the loop. I am…
user15574
  • 41
  • 1
4
votes
1 answer

Reduce the size of the file while I write an array to GeoTIFF using Python

I want to change the label of a GeoTIFF array. This is what I am doing import numpy as np from osgeo import gdal def changeLabel(arr): arr[np.where( arr == 103 )] = 10 # class 1 arr[np.where( arr == 33 )] = 20 #…
emax
  • 269
  • 4
  • 17
4
votes
2 answers

Unique Character Generator Help

I am working on a script that will populate 3 letters into a field. I have to use letters due to field limitations and to make sure that I have enough combinations. I'm not really sure where I am going wrong but I don't get the repeated values…
Mike Long
  • 632
  • 6
  • 14
4
votes
0 answers

Python IDE complete code autocompletion

I am seeing that code completion in both PyScripter and PyCharm is not complete, compared to the code completion you get in the interpreter window. In PyScripter, if you add arcpy to the code completion IDE options, you will get all the options, but…
Oskar Karlsson
  • 532
  • 2
  • 5
  • 18
4
votes
1 answer

Pan sharpening Quickbird images in Python

I'm attempting to pan sharpen four band images in Python with a higher resolution panchromatic band image. I have imported them using GDAL and converted them to numpy arrays for the purpose of classification. While I'm not looking to classify the…
ArcAngel
  • 71
  • 1
  • 6
4
votes
1 answer

Python to change file names in a directory

I am converting a directory of kml files to 1 single fGDB, but they all have the date as the file name. This creates a problem when using the original name because of the number at the beginning of the file name, it also has hyphens in the name of…
Ed Hawkins
  • 189
  • 1
  • 2
  • 8
3
votes
1 answer

Calling LineString.closestPoint or LineString.project methods from Python?

I'm trying to use the GEOS library from Python, specifically via Django (django.contrib.gis.geos). Looking at the GEOS documentation, there are two methods on LineString I want to call that aren't available from Python: project and closestPoint. Is…
Tom
  • 283
  • 1
  • 2
  • 6
1
2 3 4 5 6 7 8