POST
|
After all, to use strptime with different locales, I now use win32api to find the id for the current user locale and set locale to it. The format string "%x %X" than accepts my parameter. Later in my script I'm able to get the date/time components using _start_dt.year, _start_dt.month, _start_dt.day and so on. import arcpy
from datetime import datetime
import locale
import win32api
# parameter value (of type date)
start_time = arcpy.GetParameterAsText(0)
# internal ID for user locale for windows
_lcid = win32api.GetUserDefaultLCID()
_loc = locale.windows_locale[_lcid]
locale.setlocale(locale.LC_ALL, _loc)
_format = '%x %X'
# now create datetime using strptime with locale formatting
_start_dt = datetime.strptime(start_time, _format) Maybe someone finds that useful. Thank you!
... View more
08-17-2023
07:17 AM
|
0
|
0
|
1487
|
POST
|
Similar question by me: running a tool which does some "datetimes" calculations needs to convert the string value into a datetime object. Can I use system locale formatting to get correct datetime values? (I need to share my toolbox with users that run windows under different languages.) I did something like that: from datetime import datetime
p0 = arcpy.GetParameterAsText(0) # A date/time string
if len(p0.split(' ')) == 1:
_format = '%x'
else:
_format = '%x %X'
dt = datetime.strptime(p0, _format) Thanx!
... View more
12-30-2022
10:09 AM
|
0
|
1
|
2116
|
POST
|
Hi Thomas, thank you for your hint. My problem occured with 2.6.3 and I upgraded to 2.7. I hoped that possible bug could be fixed, also because they worked on the KML part and added the Map To KML tool. Unfortunately, this wasn't the case.
... View more
01-04-2021
01:26 AM
|
0
|
0
|
2436
|
POST
|
Thank you Roland, but thats not my problem. I have footprints of buildings from OSM, a few thousand. Although GE rendering gets slow with a certain amount.
... View more
01-03-2021
02:47 AM
|
0
|
0
|
2463
|
POST
|
Hello Dan, thank you for your respond! Yes, I think, I did 😉. I changed the entries in the "Configure Pop-ups" for the Layer and in Pro I get what I intended to show. But it is not exported into the kmx-File, it's still the "standard" attribute list.
... View more
01-03-2021
02:41 AM
|
1
|
0
|
2463
|
POST
|
Hi, I try to export a vector layer to KML with Pro 2.7, so that I can see my configured Pop-ups in Google Earth. But this doesn't work. After running the tool "Layer To KML" Google Earth still shows my (visible) attributes but not the confgured pop-up. Further more, a popup for the layer does show the label I entered under contents (and in the layer properties) what is ok, but it also shows the name of the datasource (a shapefile) - I don't want that. I tried Map To KML with the same result. At last, one of my fields has the alias "KMLSnippet" which I hoped to see in Google Earth, but it has also no effect. Is there something I am missing?
... View more
01-02-2021
08:29 AM
|
2
|
12
|
2917
|
POST
|
Found it, but it doesn't work with multipart color schemes.
... View more
01-17-2020
03:55 AM
|
1
|
1
|
4620
|
POST
|
Swapping the lines like this seems to solve the problem: arcpy.mapping.AddLayerToGroup (df, group_lyr, layer) arcpy.ApplySymbologyFromLayer_management(layer, symb_layer)
... View more
01-09-2019
08:25 AM
|
0
|
0
|
296
|
POST
|
I wrote some script tools to extract several rasters from a dem and load, order and draw them in a group layer. Extractions happens with RasterCalculator_sa and SetNull, so all Rasters have one constant value=1. When loading these rasters back into an empty document, I get different results in terms of symbology types on different machines (all 10.6.1). Machine A loads with symbology type "Stretched", while Machine B with Symbology "UniqueValues". Because I need to set the same symbology to these layers with arcpy, this causes trouble when i use ApplySymbologyFromLayer_management to do that (You can't aply a symbology layer with a different symbolgy type). Rasters are stored with unsigned integer in a file geodatabase with raster.save: rastemp = arcpy.gp.RasterCalculator_sa('("%s" %s)*%s'%(raster_layer, queryTuple[1], queryTuple[0])) raster1 = arcpy.sa.SetNull(rastemp,1,"Value=0") raster1.save(outputname) and later loadeds into a group layer: result = arcpy.MakeRasterLayer_management(raster_workspace + "\\%s"%inputname, shortname) arcpy.ApplySymbologyFromLayer_management(layer, symb_layer) arcpy.mapping.AddLayerToGroup (df, group_lyr, layer) These are only code snippets, but I think, it's not a problem with scripting, but with a different environment or something like that. Any suggestions?
... View more
01-08-2019
06:17 AM
|
0
|
1
|
371
|
POST
|
I have 10.4.1 now and is there still a bug? If I calculated ZonalStatisticsAsTable with the data supplied by Günther Grill, calculations with parameter ignore_nodata set to "DATA" my result set contains nine rows, otherwise, set to NODATA, it contains eight rows. Does that mean ignore the whole zone if there is nodata in it?
... View more
03-14-2017
07:31 AM
|
0
|
0
|
140
|
POST
|
I can't doing it that way, but there is another way, i'm sure... Just found this tips: Adding Fields: Performance Tips | ArcPy Café would it help to make a in memory template first? If i can get over the creation of Field1, i would be lucky. So the problems with different field names ObjectId, OID, OJECTID will still exist and the info format has this additional Rowid-Field, can i ignore them when using an insert cursor?
... View more
01-19-2017
04:45 AM
|
0
|
1
|
513
|
POST
|
I have difficulties to find a straightforward solution for, as i think, a simple task. In a script tool the user has to choose a location to save a table. I used a Table typed input field in the tool parameters, so in my script a get a parameter containing a path and name for the table. In my script i want to use CreateTable_management and AddField_management to structure the table for my needs. Later i use an insert cursor to fill the table. The problem is, that, depending on what parameter value the user gave, i got different table formats, eg. the user selects a folder and a name without an extension, CreateTable builds an info table, within a geodatabase it builds a gdb table, with folder and extension .dbf it creates dbase table - i don't know how much possibilities there may be further. Creating a table produces different, automatically created fields: - gdb: ObjectID - dbf: OID, Field1 - info: Rowid, OBJECTID, FIELD1 I don't need these automatically created fields, i want my own structure, so : can i suppress the creation of those fields? What would be a straightforward solution, working with tables in a script tool. I attached an example with code.
... View more
01-19-2017
03:02 AM
|
0
|
3
|
979
|
POST
|
I tried before, the only option I had was "richtige Antwort" (correct answer) and then it gets "assumed answered"...
... View more
02-08-2016
05:10 AM
|
0
|
1
|
686
|
POST
|
So true, that's why you store the return of getOverlapExtents in ext, oversawed this... clever!
... View more
02-08-2016
03:22 AM
|
1
|
3
|
686
|
POST
|
I tried out a few example extents: It works, order seems not to be important. So, thank you very, very much for contributing your code!
... View more
02-08-2016
02:49 AM
|
0
|
1
|
686
|
Title | Kudos | Posted |
---|---|---|
1 | 01-17-2020 03:55 AM | |
1 | 01-03-2021 02:41 AM | |
2 | 01-02-2021 08:29 AM | |
1 | 02-08-2016 03:22 AM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|