Questions tagged [python]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
82 views

Getting EPSG code in pyproj with version==2.1.3?

I'm using pyproj in python and I want to get epsg code based on an existing Proj class. An example in version=1.9.6: from pyproj import Proj CGCS2000metre = Proj(init='EPSG:4544') print(CGCS2000metre....
7
votes
2answers
258 views

Getting geometries of hurricane's 'cone of uncertainty' using shapely?

I'm trying to plot hurricane forecast maps using python. I have several forecast positions derived from official advisories, and interpolate them into a smoothed curve, then draw a polygon of 'cone of ...
1
vote
0answers
41 views

QGIS Custom form

I would like to create a custom form in QGIS. Unfortunately I can't manage to disconnect the ButtonBox signals. (Save / Cancel). The form should not close until a condition matches. from PyQt5.QtCore ...
2
votes
1answer
165 views

Can gpxpy write .gpx file?

I want to build a .gpx file and was hoping to use gpxpy. I can see how to build such a file in memory, but I can't see how to write it out to disk. Is it possible for gpxpy to write files?
0
votes
1answer
37 views

Returning raw address from pandas column using Geopy?

I have a Pandas dataframe, and I'm calling a geopy function on each row of 'address_original' column to get as much detail as possible about every address from geopy.geocoders import GoogleV3 ...
0
votes
0answers
10 views

Line segment overlap aggregation / analysis in Python?

I have a large sample of gps coordinates, and I would like to create a similar analytical visualization to that in Overlaying lines and aggregating their values for overlapping segments using R? Does ...
2
votes
1answer
83 views

How to create a grid of pixel coordinates from the corners of a MODIS tile?

I have an HDF4 file whose StructMetadata.0 contains the following attributes: UpperLeftPointMtrs = (-20015109.354000,1111950.519667) LowerRightMtrs = (-18903158.834333,0.000000) These are X and ...
2
votes
1answer
84 views

How aggregate data in a geodataframe by the geometry in a geoseries

I have a geoseries where each row is a (square) polygon. Housing price data is in a geodataframe where the geometry is a polygon of the zip code. I need to aggregate the housing price data by squares ...
0
votes
1answer
43 views

GeoPandas intersect not working as expected

Using GeoPandas 0.4.0 with Python 3.5, I'm finding that geopandas.intersects does not behave as I expect it to. For example, a buffer around Switzerland does not appear to intersect with neighbouring ...
0
votes
0answers
58 views

Improving speed of GeoPandas dissolve?

I am trying to dissolve grid spaces by category using GeoPandas' dissolve function, but it doesn't finish after hours of running and I want to make sure I'm not doing something wrong and/or there isn'...
1
vote
2answers
46 views

Using intersect in QGIS Python gives error “no geometry”

I am using the QGIS Python Console to automate some bulk processing. I want to create a Voronoi polygon layer from point data (solved this part) and then from a folder of shapefiles clip the Voronoi ...
3
votes
1answer
136 views

Getting Unique Intersections of Multiple Polygons Efficiently in Python

I would like to get a list of all polygons that are intersections of other polygons. However, that list of intersections cannot self-overlap. For example, if I have a triple Venn diagram, I would ...
1
vote
0answers
76 views

What are the arguments for QgsDistanceArea().setSourceCrs() [duplicate]

I am really struggling with migrating a custom plugin from QGIS 2.x to 3.x. Below is a code snippet that seems very straightforward, but I can't find documentation that I understand for setSourceCrs()....
1
vote
1answer
39 views

How to export attributes from QGIS to a .txtf file using Python

I have used this method outlined in: https://howtoinqgis.wordpress.com/2016/10/31/how-to-export-attributes-from-qgis-to-a-txt-file/ ##input_file=vector from qgis.core import * import processing # ...
1
vote
1answer
38 views

Having difficulty retrieving city and area names using Geopy (Google V3)

I am using Geopy to call different addresses, to see what cities and neighbourhoods they belong to. from geopy.geocoders import GoogleV3 import json places = '1238 Davie St, Vancouver, BC' ...
1
vote
0answers
31 views

Select features of a shape which are not in another shape

I have a shape with some features (let's say 100) and a second shape with some of this features (50) buffered (5 meters inside buffer). I want to select and write in a new shape every feature of the ...
0
votes
0answers
32 views

Set default version of Python in ArcGIS to 64-bit?

This is the output from Python terminal within ArcMap 10.6.1 for Windows 10: >>> import sys, numpy, matplotlib >>> print(sys.version, numpy.__version__, matplotlib.__version__) ('2....
1
vote
1answer
75 views

Error: Input [<shapely.geometry.point.Point>, <shapely.geometry.point.Point>] is the wrong shape for a LineString

I'm trying to create a linestring out of a dataframe of latitudes and longitudes. geometry = [Point(xy) for xy in zip(linkdf.lon, linkdf.lat)] linkgdf = GeoDataFrame(linkdf, geometry=geometry) ...
1
vote
1answer
97 views

How to connect multiple cities on a map using MapQuest route API

I am working on any optimal vehicle routing problem. I want to start map routing on the road starting from one city A to city B to City c to city D back to city A Based on lat/lng of these cities ...
1
vote
1answer
82 views

Converting shapefile to .osm.pbf

I am trying to convert a GIS LINE shapefile into a .osm.pbf file on Windows. I've done some research on the topic and some tools that kept coming out are: Merkaator shp2osm - which deals mostly with ...
0
votes
0answers
34 views

Python error on QGIS

We are doing the slope analysis for one of our clients and can find the following error every time we do the analysis. We have not faced this situation in the past. The QGIS version which are using is ...
0
votes
0answers
43 views

Fail to import gdal from conda environment?

I installed gdal from this link: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-3-0-0-mapserver-7-4-0.zip When I use the the following command from this ...
0
votes
0answers
153 views

Can't open shapefile with GeoPandas

I downloaded a shapefile from the Brazilian Institute of Geography and Statistics (IBGE). I can open it on QGIS and work with it perfectly there, but I need to work with it using Python. I'm trying ...
0
votes
1answer
79 views

Buffering geometry with points in WGS84 using shapely?

I have a polygon in python shapely that I would like to buffer with a 100 foot buffer. If the polygon is stored as a series of WGS84 lon/lat points how would I go about calculating the distance of ...
1
vote
1answer
87 views

Getting data closest to specified point in a grib file (Python)?

I have a grib file. I would like to be able to do something like this: grib_data = grib_data_nearest_point(grib_file='grib_file.grib2', lat=15.5, lon=23.3) Is there a library that can accomplish ...
0
votes
2answers
52 views

Transforming time series gridded meteorological data from .csv file to multiple .shp files (one per date) with pyQGIS

I downloaded gridded meteorological data as .csv file from the JRC CGMS database for a territory of interest. The file has data for predefined point locations over the territory in a regular-spacing ...
0
votes
0answers
85 views

How to convert Lat, Lon, Alt to ECEF and EPSG 4979?

I am programmatically generating data to use in Cesium's 3D Tile System. The data I have is in (Latitude, Longitude, Altitude) format. To display the data in Cesium, I have to first define a region to ...
1
vote
0answers
32 views

Saving raster layer to disk using Python: TIFF raster layer loses data type when saved with QgsRasterFileWriter

I'm trying to save a TIFF image stored as a raster layer. The image is fetched from a server so that its source (the url passed when creating the layer) is a HTTP url: the image should be saved to ...
2
votes
1answer
30 views

GDAL SQLite geometry error

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed: ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected ...
1
vote
0answers
29 views

What would cause a Cesium 3D-Tiles tileset to not even request it's content?

I am generating an I3DM through Python. I know that the I3DM is probably ok, since the 3d-tiles-tools allow me to extract the binary GLTF file from it. However, when I go to render the tileset in ...
0
votes
0answers
34 views

How to dynamically provide input for contour thresholding in openCV

I am the following codes for getting the contours in openCV # load the image, convert it to grayscale, and blur it slightly image = cv2.imread(args["image"]) gray = cv2.cvtColor(image, cv2....
2
votes
1answer
133 views

How to merge geoseries to geodataframe based on geometry attribute

I have 5868 points in a geodataframe with some columns/attributes. Between points which have distance less than 10 m, I just want to select only one point as representation in that area. I have done ...
1
vote
1answer
77 views

Python Error with QGis2Web on QGIS 3.6.3 Noosa

I'm receiving a Python Error when trying to create a web map using QGIS2Web and for the life of me cannot figure out what to do. Running QGIS 3.6.3 Noosa Windows 10 Professional KeyError: 100 ...
0
votes
0answers
32 views

Load CSV file Polygon Column to Microsoft SQL Table

Is there a best practice for importing a polygon from CSV to SQL? I have attempted to use the SQL Import and Export wizard to load it in as varchar(max) and then convert using geography::Parse(column)...
1
vote
1answer
28 views

Setting Layer rendering Blending Mode of Feature using Python

I'm trying to set the blending mode of a layer like on the picture, Darken on Feature, not on layer, with Python. Here is the code that i used to modify the "Layer" Blending mode. layer=iface....
1
vote
1answer
190 views

Store GeoTIFF with color table - Python [closed]

I have a large number of GeoTIFFs for which I would like to add and store symbology as Color table. What is the easiest way for doing that? I would like to use Python, maybe with GDAL.
1
vote
1answer
171 views

SAR processing using Python

I would like to batch process Sentinel-1 images in Python. Previously I have used SNAP (Sentinel-1 Toolbox) to apply Calibration, Multilooks, Speckle Filters, Terrain Correction and then export as a ...
1
vote
0answers
26 views

Show MySQL vector data on QGIS canvas

I am a novice to Python and QGIS coding. I am facing an issue while showing the MySQL spatial data on QGIS canvas. Database connection details are below: database name:- mysql host :- localhost port :...
0
votes
0answers
19 views

How to add an extra layer of values to Sentinel 2 data

I'm working on Sentinel-2 data on water bodies. I collected the bathymetry information of a particular lake(which is having x,y,z. ie lat long and depth). Now I want to superimpose those depth values ...
0
votes
1answer
66 views

Geopandas intersects/contains fails between GeoDataFrames

I am struggling to make the GeoDataFrame functions: intersects/contains work between GeoDataFrames instances. Let t be a GeoDataFrame with contents: id ...
0
votes
1answer
161 views

Hotspot analysis with geopandas? [closed]

Is it possible to perform a hotspot analysis (like the one you can do in ArcGIS - Getis-Ord Gi*) with Geopandas, or with any other Python library?
2
votes
1answer
28 views

Using splitGeometry in PyQGIS

Using QGIS 3, I'd like to split a polygon using a line. My inputs are .geojson files, but that should be irrelevant: Line: { "type": "FeatureCollection", "name": "line", "crs": { "type": "name", "...
1
vote
0answers
49 views

QGIS crashes when trying to return layer from processing toolbox console

The following script is intended to take a polygon layer and extract the features having a particular value ('natural') in a given field ('landuse') and return the selection. Everything seems to work ...
0
votes
0answers
20 views

Assign shape file attribute as a vertex label in networkx

I have a shapefile which has attribute 'num' and I want it to use it as vertex ID. It means if I print G.nodes() and G.edges() then the vertex IDs should appear as per attribute 'num'. But in networkx ...
1
vote
1answer
34 views

Sample method returns empty featureCollection (GEE)

I have some troubles with the sample method from Google Earth Engine. On some images, it returns an empty feature collection (0 element). Why this is happening and how do I deal with that ? It's ...
1
vote
0answers
41 views

QGIS Python - Error: Feature 0 for attribute update not found

I'm new to QGIS python development. I'm trying to create new features in an existing vector layer and then to display the Feature Form so that the user can fill the attribute values. The problem is, ...
1
vote
0answers
54 views

Processing error when using PyQGIS in PyCharm

Running processing alghorithms works fine from the Python console in QGIS. I am using OSGEO4W (Python 3.7). However when trying to run the same processing algorithm in PyCharm, I get the following ...
0
votes
0answers
13 views

Rendering Polygon from geom data onto pyqt widget

I am developing a program that will show the polygon of a selected location. My geometry data is in a spatial PostgreSQL database and I want to use the geom column. I have searched the internet for a ...
1
vote
1answer
53 views

Error during a for loop in Python terminal from QGIS 2.18.17

When I run the script below in Python Terminal at QGIS 2.18.17 (Linux Mint 19) it always crash after doing 73 iterations at the 2nd for loop from the script. Could anyone explain why this happens and ...
0
votes
1answer
44 views

How can I insert degree symbol to attribute table in feature class?

I am trying to insert a bearing string into an attribute table, I want the string to look like this -> S 58°15'31" W , but what I am getting in the table is this -> S 58°15'31" W The code I am ...