POST
|
yep, I know and agree. But for other use cases and users it is at least nice to know that this functionality is there. The widget should be improved to handle normal data sets, this functionality is available in operations dashboards, should not be to hard to get it into web appbuilder for ESRI.
... View more
11-15-2019
07:27 AM
|
0
|
0
|
1202
|
POST
|
Hi, a late reply, but might be relevant for others as well. So to be able to visualize multiple lines you need multiple numeric fields in your data. So you might need to restructure your data. So by setting up your data similarly to what I've done here, then you're able to show the multiple lines.
... View more
11-11-2019
04:04 AM
|
0
|
2
|
1202
|
POST
|
Sorry, that was a typo from my part, the code does state the row_val = row[0] as you pointed out. Indeed there is only a small % that gets deleted every time, will seldom be more than 500 rows that are updated/added each turn.
... View more
07-30-2018
03:41 AM
|
0
|
0
|
1351
|
POST
|
in this test I had 424'857 records where 19 where duplicates. so after the script runs I'm left with 424'838 records.
... View more
07-30-2018
03:26 AM
|
0
|
2
|
1351
|
POST
|
I tried modifying the script to use the da module, but it only slightly improved performance. previous script with arcpy.UpdateCursor used 1070s, while the new script with arcpy.da.UpdateCursor used 1032s. Here's the code I used this time: import arcpy fc = fc = r"C:\Users\Documents\ArcGIS\Projects\kun.gdb\kun_A" fieldss = ["USER_Id", "date"] keepList = [] with arcpy.da.UpdateCursor[fc, fieldss, sql_clause=(None, "ORDER BY date DESC")) for row in cursor: row_val = [0] if row_val not in keepList: keepList.append(row_val) else: cursor.deleteRow() Am I using the da module correctly? after reading about the performance differend between arcpy.da. Cursors and arcpy.Cursors I would think the improvement should be larger.
... View more
07-30-2018
03:18 AM
|
0
|
4
|
1351
|
POST
|
I've been using this script, posted here, to do basically what you asked for in the first place. It needs one field where you need to look for duplicate values and a date-field to sort your data. Before this code block runs I append my new/updated data to my master feature class, and then run this code to see if there is any duplicates, if yes it keeps only the newest. # Script loops through a feature class and deletes duplicate records, keeps newest entry
import arcpy
# Set parameters
# path to feature class:
fc = r"C:\Users\Documents\ArcGIS\Projects\kun.gdb\kun_A"
# unique field to search for duplicates
id = "USER_Id"
# Field to sort by. D = Descending A = Ascending. choose D to keep newest entry
sort_field = "date D"
# print("Looking for duplicates")
cursor = arcpy.UpdateCursor(fc,"","",id,sort_field)
keepList = list()
for row in cursor:
row_val = row.getValue(id)
if row_val not in keepList:
keepList.append(row_val)
elif row_val in keepList:
cursor.deleteRow(row)
else:
pass
# print("Finito!") The downside of this code as i see it is that it's slow. For my use it has to loop through 4.5M records each time, thus taking 15-20minutes to complete. (So if anyone has tips for faster methods I'm all ears)
... View more
07-26-2018
10:58 PM
|
2
|
8
|
1351
|
POST
|
Thanks for the suggestions Balaji Veera, unfortunatley they did not work. However since I already had un-registered the data stores i tried to uninstall and re-install Arcgis Datastore and configure it again towards the old content directory c:\arcgis\arcgisdatastore, which gave me the same error as before. Then i renamed the old content directory to c:\arcgis\arcgisdatastore_old and configured data store once again to c:\arcgis\arcgisdatastore - forcing it to create a new folder from scratch. This did the trick and I manage to get my data stores up and running again. Off course this solution means that none of my data from the old datastores are available at the moment, but I have them in the backups, next step will be to find a way to import them into.
... View more
07-26-2018
12:08 AM
|
3
|
7
|
4031
|
POST
|
Hi I had arcgis enterprise 10.6 installed on my computer, single machine setup, basic settings, installed with Enterprise builder. Configured Datastore for Relational and Tile Cache. I tried to upgrade my enterprise to 10.6.1 and ran into some troubles. Firstly the enterprise builder for 10.6.1 ran through and upgraded my applications, telling me everything was OK and upgraded except my Portal. So to fix this i downloaded the setup file for Portal for acrgis, installed it and configured the web-adaptor. So far so good. I can log in to both the portal and the federated server. However, I noticed that none of my hosted feature layers didn't work, and that I got a red exclamation point when trying to validate the server/data stores. So I tried to run the Arcgis Data Store Configuration Wizard and run in to this little error message: Runtime error detected on one or more operation on the configuration store, with message:'{0}'.. Extended error message: Failed to get file permission Which suggest the user doesn't have the right permissions, so I gave admin user account full priveliges for the following directories(included subdirectories) : C:\arcgis\arcgisdatastore, C:\arcgis\arcgisportal, C:\arcgis\arcgisserver, C:\inetpub\wwwroot\portal, C:\inetpub\wwwroot\server, C:\Program Files\ArcGIS (subdirectories: DataStore, Portal, Pro, Server) and C:\python27. Basically every directory related to the enterprise. When trying to validate the Data Store through the ArcGIS Server Administrator Directory with Relational data store: data > items > enterpriseDatabases > <data store name> >machines > <machine name> > validate I get this message: Server machine 'https://(Machine.Name):2443/arcgis/datastoreadmin/machines/PC-(Machine.Name)/validate' returned an error. 'Data store hasnt been created on this machine.' Get Error msg 404 unable to get ...:2443/arcgis/help/nb/cxhelp.xml Have tried to run a repair on the Data Store installation - no success. Have tried with running the config wizard for datastor with both localhost url and url with machine name, results in same error message. Any suggestions?
... View more
07-25-2018
04:09 AM
|
0
|
12
|
7608
|
POST
|
I got the same functionality with that code, but the same error as well. I think it has something to do with setting the variable osloExtent. used some of your code and combined it with previous attempts/code i've found, works quite well : _onMapLoaded: function(map) {
this.map = map;
this.layoutManager.setMap(map);
this.layoutManager.loadAndLayout(this.appConfig);
var initialExtent = map.extent;
map.on('extent-change', function(event) {
//If the map has moved to the point where it's center is outside the initial boundaries,
//then move it back to the edge where it moved out
var currentCenter = map.extent.getCenter();
if (!initialExtent.contains(currentCenter) &&
event.delta.x !== 0 && event.delta.y !== 0) {
var newCenter = map.extent.getCenter();
//check each side of the initial extent and if the
//current center is outside that extent,
//set the new center to be on the edge that it went out on
if (currentCenter.x < initialExtent.xmin) {
newCenter.x = initialExtent.xmin;
}
if (currentCenter.x > initialExtent.xmax) {
newCenter.x = initialExtent.xmax;
}
if (currentCenter.y < initialExtent.ymin) {
newCenter.y = initialExtent.ymin;
}
if (currentCenter.y > initialExtent.ymax) {
newCenter.y = initialExtent.ymax;
}
map.centerAt(newCenter);
}
});
}, Thanks for your help Robert!
... View more
06-21-2018
12:34 AM
|
1
|
1
|
1730
|
POST
|
Indeed, and thats fine and all, the problem, as tried explained in my question, is that the code I've put in to my LayoutManager.js is affecting the initial extent. so by adjusting the initial extent from Web AppBuilder or the Web Map the app is using, I'm getting a result where the basemap and the feature layer loads in two different extents. If i remove all of the code written above the map and feature will both load in their rightful place, but then i lose the desired panning restriction..
... View more
06-20-2018
07:51 AM
|
0
|
5
|
1730
|
POST
|
Hi Robert We had trouble finding the code snippet that specify the initial extent, thats why we wrote the code that recenters the map to desired extent postload. I can see in the config.json that it referes back to my web map in my portal, and in some way it gathers the extent saved in my web map and uses it to set initial extent. Which my code now overrules with the mention flaud in my original answer. Sorry for the incomplete response..
... View more
06-20-2018
07:02 AM
|
0
|
7
|
1730
|
POST
|
Hi I have made a basic app portraying a single feature hosted Feature layer(points) on top of esri basemaps. The basemaps covers the whole world, but my app should only focus on Oslo city. To do this I've tried to restrict the panning possibilities to the city, throwing the user back if he pans to far out, this works fine now. Using a script with Web AppBuilder for developers. However I have a challenge that I havn't been able to solve. 1. When my app loads, it sets the specified extent from a script for the basemap, but it doesn't seem to affect my feature layer, resulting in the features beeing placed with a certain offset from their correct place. (I suspect the script is forcing the basemap to a certain extent, while the features are still using the default extent set by the map layer). The moment I zoom in or out, the problem corrects itself and will work fine until you reload the application. Left pic, nr1 shows the initial extent, whil right pic,nr2, shows how it should be. This is the script I've tried, placed in the file "LayoutManager.js" _doPostLoad: function(map){
//load somethings that may be used later.
//let it load behind the stage.
require(['dynamic-modules/postload']);
var osloExtent;
if(!osloExtent){
osloExtent = map.extent;
osloExtent.xmin = 1164244.8971553196;
osloExtent.xmax= 1218767.932529483;
osloExtent.ymin= 8360539.398234147;
osloExtent.ymax= 8390138.410556029;
}
map.on('extent-change', function(event) {
//If the map has moved to the point where it's center is outside the initial boundaries,
//then move it back to the edge where it moved out
var currentCenter = map.extent.getCenter();
if (osloExtent && !osloExtent.contains(currentCenter) && event.delta && event.delta.x !== 0 && event.delta.y !== 0) {
var newCenter = map.extent.getCenter();
//check each side of the initial extent and if the current center is outside that extent,
//set the new center to be on the edge that it went out on
if (currentCenter.x < osloExtent.xmin) {
newCenter.x = osloExtent.xmin;
}
if (currentCenter.x > osloExtent.xmax) {
newCenter.x = osloExtent.xmax;
}
if (currentCenter.y < osloExtent.ymin) {
newCenter.y = osloExtent.ymin;
}
if (currentCenter.y > osloExtent.ymax) {
newCenter.y = osloExtent.ymax;
}
map.centerAt(newCenter);
}
});
},
_onOpenWidgetRequest: function(widgetId){
this.layoutManager.openWidget(widgetId);
}
}); If i remove the script, allowing end users to pan all over the world, the features will be at their correct place when reloading the application - so there's nothing wrong with the layer. Ps: I'm new to scripting java, had a lot of help coming up with this one. Have noticed that there are some similiar questions out there, but their quite old, and not linked to Web AppBuilder as far as I can tell.
... View more
06-19-2018
11:51 PM
|
0
|
9
|
2027
|
POST
|
figured it out, the problem was with: relPath = sys.path[0] Changed sys.path[0] to an absolute path and it worked like a charm!
... View more
06-19-2018
11:15 PM
|
0
|
0
|
12870
|
POST
|
Hi, firstly thansk for the quick and explainatory answer. However I'm getting an error when i try to run the script, not understanding how to solve it: Any tips? Creating SD file
--------------------------------------------------------------------------
ExecuteError Traceback (most recent call last)
<ipython-input-3-540a66d6dc34> in <module>()
32 mp = prj.listMaps()[0]
33 arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)
---> 34 arcpy.StageService_server(sddraft, sd)
35
36 print("Connecting to {}".format(portal))
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py in StageService(in_service_definition_draft, out_service_definition, staging_version)
846 return retval
847 except Exception as e:
--> 848 raise e
849
850 @gptooldoc('UploadServiceDefinition_server', None)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py in StageService(in_service_definition_draft, out_service_definition, staging_version)
843 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
844 try:
--> 845 retval = convertArcObjectToPythonObject(gp.StageService_server(*gp_fixargs((in_service_definition_draft, out_service_definition, staging_version), True)))
846 return retval
847 except Exception as e:
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
504 val = getattr(self._gp, attr)
505 if callable(val):
--> 506 return lambda *args: val(*gp_fixargs(args, True))
507 else:
508 return convertArcObjectToPythonObject(val)
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (StageService).
... View more
06-15-2018
01:53 AM
|
0
|
2
|
12870
|
POST
|
Hi I'm trying to automate an update process for one of my hosted features in portal. So far I have: 1. Solved the automatic download and adjustment of the file in question. (using powershell/task scheduler) 2. exportet the python code that runs the "Geocode Addresses" tool on my file, saves it in a file gdb. 3. manually published the feature class with the "overwrite web layer" function. My challange is to automate step 3, and connect it to step 2. Please keep in mind that I'm completely new to scripting/python. I'm currently using ArcGIS Pro 2.1.0, and have admin rights on the portal. I have looked at thise sites, and think they describe partly how to solve my issue, I'm just not able to pick out the relevant parts and build a script that works for my particular problem.. community.esri.com "using python to overwrite a feature layer" developers.arcgis.com python, overwriting feature layers esri updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python
... View more
06-14-2018
12:53 AM
|
4
|
79
|
36831
|
Title | Kudos | Posted |
---|---|---|
1 | 06-21-2018 12:34 AM | |
4 | 06-14-2018 12:53 AM | |
3 | 07-26-2018 12:08 AM | |
2 | 07-26-2018 10:58 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|