POST
|
I would like to write a python script in which the user enters the name of the directory with shapefile files. For each .shp file from a given directory (without checking subdirectories), the script generates a GeoJSON file in the current directory. On the GitHub website I found a topic (https://gist.github.com/benbalter/5858851) in which someone may have written what I need: But I need a script that first runs it, then in the console, the program asks the user for the path to the folder with the .shp files. In addition, if the GeoJSON file with the given name already exists, then before running the ogr2ogr command the program asks the user whether to overwrite it. Can you help me write such a program?
... View more
06-11-2020
05:58 AM
|
0
|
1
|
1002
|
POST
|
I am attaching a file lubelskie.tiff (DEM in the reference system EPSG:2180, for one of the counties in Poland). I need to write a python script, in which the user is asked to enter the name of the town belonging to that county (for example cities Lublin, Frampol, Parczew), and this script then cuts out from the lubelskie.tiff file a square with a side of 30 kilometers, whose center is in the center of the entered town. The cut area is to be saved to the city.tiff file, where the word "city" is to be replaced by the actual city name. You can use the ogrinfo command (from the attached file zad_07.py) to find the coordinates of the city (in the WGS84 coordinate system (longitude, latitude)), and the gdaltransform command (from the attached file zad_08.py) to convert the WGS84 coordinates to coordinates EPSG: 2180. In addition, you must add gdal_translate command to cut the area. The gdal_translate command can probably be used in the following way: gdal_translate -projwin ulx uly lrx lry lubelskie.tif city.tif where ulx, uly, lrx, lry are respectively: the x coordinate of the upper left vertex, y coordinate of the upper left vertex, the x coordinate of the bottom right vertex, the y coordinate of the lower right vertex of the cut out fragment. The files are packed here: lubelskie.tiff, zad_7.py, zad_8.py. https://www97.zippyshare.com/v/zyQXpmmx/file.html Can you help me write this script? I am stuck and need help
... View more
06-07-2020
07:07 AM
|
0
|
1
|
1192
|
POST
|
I have a point layer (miejsowosci_lubelskie.shp) with cities. This layer has a "Pow" field containing the numerical value of the city area. The smallest city has an area of "9" and the largest "235". The algorithm is to have parameters: Input parameters: WEKTOR - in this parameter the default value is to be layer "miejscowosci_lubelskie.shp" POLE - in this parameter the default value is to be the "Pow" field from the layer "miejscowosci_lubelskie.shp" WARTOSC - in this parameter the default value is 100 Output parameters: WYNIK - the resulting vector layer with the default name "output_layer.shp" The result of this algorithm is to be the output layer (output_layer.shp), which only has cities with an area less than or equal to 100. I need help writing a processing script (algorithm) in .py format, so that I can open this algorithm in QGIS.
... View more
02-14-2020
12:29 PM
|
0
|
1
|
428
|
POST
|
def percentage(field1, field2) :
if field1 != 0 and field2 != 0 :
return ( (float(field1) / float(field2) ) * 100.0)
else :
return -9999 percentage( !TOT_65__!, !TOT!) ?
... View more
02-01-2020
01:39 PM
|
0
|
3
|
503
|
POST
|
AProchow = (TOT_65/TOT)*100 if field TOT is 0 or field TOT_65__ is 0 then field AProchow equals -9999
... View more
02-01-2020
01:25 PM
|
0
|
5
|
1509
|
POST
|
all values seem fine now. thank you!!! I have to create one more field and calculate one more formula, will you wait 5 minutes? I'm already putting it here
... View more
02-01-2020
01:04 PM
|
0
|
6
|
1509
|
POST
|
many features calculated correctly, many -9999(no problem), but there are also many cases when the value of the field indeks_star should be calculated, but a value of 0 for this field is created.
... View more
02-01-2020
12:27 PM
|
0
|
8
|
1509
|
POST
|
I just edited the post now. Sorry for the mistake. Should be [TOT_65__] / [TOT_0_14] * 100 so it will be percentage( !TOT_65__!, !TOT_0_14!) ?
... View more
02-01-2020
12:03 PM
|
0
|
10
|
1509
|
POST
|
shouldn't it be the other way around? no percentage(!TOT_0_14!, !TOT_65!) but percentage( !TOT_65!, !TOT_0_14!)
... View more
02-01-2020
11:47 AM
|
0
|
12
|
1509
|
POST
|
Just like in the attached picture. I would like to calculate the value for the field "indeks_star" with the formula: indeks_star =[TOT_65__] / [TOT_0_14] * 100 And for features where in the field TOT_0_14 occurs 0 or in [TOT_65__] occurs 0, I would like the value -9999 to appear in the field indeks_star. What formula to enter in the field calculator to simultaneously calculate all values for the field indeks_star?
... View more
02-01-2020
10:50 AM
|
0
|
14
|
2524
|
POST
|
02-01-2020
08:28 AM
|
1
|
0
|
323
|
POST
|
everything works, you are the king, thank you very much
... View more
02-01-2020
08:12 AM
|
0
|
2
|
323
|
POST
|
prints all values for which the median can be calculated and those for which cannot be calculated (as -9999). I exported the attribute table to Excel and pasted the values printed in Python IDLE and everything is fine now! Can you do it so that the values are directly saved in the ArcGIS attribute table?
... View more
02-01-2020
07:55 AM
|
0
|
4
|
442
|
POST
|
again, it only prints 10,000 values instead of 18,000, without 0 and null
... View more
02-01-2020
07:13 AM
|
0
|
6
|
442
|
Title | Kudos | Posted |
---|---|---|
1 | 02-01-2020 08:28 AM |
Online Status |
Offline
|
Date Last Visited |
04-20-2021
02:51 AM
|