Hot answers tagged

4

Here's a sample AWS Lambda setup from a colleague: Create an AWS account (free). In AWS Lambda, create a new function. Enter a function name and Runtime ➔ Python 3.7 Write the function. This sample script receives an ASSET_ID value from a URL, processes it with Python, and sends additional requests to AGOL. It returns a JSON dictionary. from urllib....


3

The .area in shapely is plane area, so we need to transform longitude, latitude (4326) to project spatial reference (e.g. 3857). For rectangle, if the original size is a * b, area is A, buffer distance is X, the buffer area B then: B = A + 2 * (a + b) * X + pi * X * X ----- (1) 2 * (a + b) = c = perimeter = poly_B.length (1) => X = sqrt(c * c - 4 * (...


3

You're right, I get ERROR 6: GDALDriver::Create() ... no create method implemented for this format in both 32bit and 64bit GDAL for HDF4 but driver HDF4Image will create a HDF4 raster. To test your installed drivers use GDALInfo --formats and you should see a full list of the available formats: Supported Formats: HDF4 -raster- (ros): Hierarchical Data ...


3

It would be easier to merge the fields without the additional commas to begin with using a field calculation in ArcGIS Desktop. Create "Field_A" Open field calculator Select Python parser Tick "Show Codeblock" in the "Pre-Logic Script Code" block define a function: def merge_fields(*fields): return ', '.join([f for f ...


2

Your proj string should be "+proj=utm +zone=38 +south +datum=WGS84 +units=m +no_defs" i.e no comma before +south. You can also use the EPSG code myProj = Proj('+proj=utm +zone=38 +south +datum=WGS84 +units=m +no_defs') Xutm, Yutm = myProj(X,Y) print(Xutm, Yutm) myProj = Proj(32738) Xutm, Yutm = myProj(X, Y) print(Xutm, Yutm) # 323263.484317678 ...


2

GeoPandas now pass kwargs to shapely, so you can do below now: gdf.geometry.to_crs("epsg:3857").buffer(10, cap_style=2) PR: https://github.com/geopandas/geopandas/pull/535


2

You create a labels list but don't use it for anything other than print(labels). You append to this list each time you loop through the cursor, so by the end of the cursor loops, it will contain all of the labels, not just the one for the current row. You don't change the row values, then update the cursor with the unchanged row. row[0].replace("-ADMIN&...


2

Simply use the following layer.setSubsetString(expression)


2

More of an FME expert than Python... but that dialog is showing two different templates: one is for a function and the other for a class. You'd keep one and remove the other depending on what you want your code to do. Generally, a class is used when your script needs to process features in a group. Here it looks to me like you are processing each feature ...


1

As per Vince's comment, you need to fully qualify the paths to your feature classes by prepending the appropriate path the to file geodatabase they come from.


1

You can use the python datatime module: import datetime str_date = '2019-11-17 15:42:04' date = datetime.datetime.strptime(str_date, '%Y-%m-%d %H:%M:%S') In QGIS 3 you can use the following expression: to_datetime('2019-11-17 15:42:04')


1

You can set the output transform using the source dataset window_transform method: etc... window = int(width*i/grid_size), int(height*j/grid_size), grid_width, grid_height transform = file.window_transform(window) profile.update({'transform': transform})


1

You can use https://gdal.org/programs/gdal_translate.html. Perhaps it is easies to use option -srcwin <xoff> <yoff> <xsize> <ysize> Selects a subwindow from the source image for copying based on pixel/line location. You can write the first 1000 by 1000 pixel part into GeoTIFF with a simple command gdal_translate -of GTiff -srcwin 0 ...


1

To do this you need to make the top layer non-interactive as follows: #makes boundaries plot Boundaries = folium.GeoJson( cluster_stab_df, style_function = lambda x: { 'color': 'black', 'weight': 4, "opacity":1, 'fillOpacity': 0, 'interactive':False }).add_to(m1)


1

Neither ArcGIS Online nor ArcGIS hub allow you to run Python code in this fashion. The only thing close to this would be either: A GP Service, which has a RESTful endpoint that you can hit. This would execute your Python code. Note this is only available from an on premise ArcGIS Server. You cannot publish GP Services to AGOL Possibly ArcGIS Notebooks. You ...


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