POST
|
var handler = new HttpClientHandler { UseCookies = false }; var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("Cookie", $"agstoken={token}");
... View more
03-10-2021
06:30 PM
|
0
|
0
|
3086
|
POST
|
It works for me.. var handler = new HttpClientHandler { UseCookies = false }; var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("Cookie", $"agstoken={token}");
... View more
03-10-2021
06:30 PM
|
0
|
0
|
3086
|
POST
|
Hi, After adding polygon I want to calculate area and perimeter in geodesic unit. I'm able to calculate area and convert it into hectares but not sure how to calculate perimeter in kilometer. Area I'm using below code. var ft = (Feature)row;
if (ft.GetShape().GeometryType == GeometryType.Polygon)
{
var area = GeometryEngine.Instance.GeodesicArea(ft.GetShape()) / 10000;
//Calculate and convert area from meter to hectares
} I couldn't find function to calculate perimeter in GeometryEngine. Any help would be appreciated. -Prashant
... View more
03-04-2021
10:10 PM
|
0
|
3
|
1490
|
POST
|
Thank you SeanJones, Really helpful resources to understand templates in depth. -Prashant
... View more
03-02-2021
09:27 PM
|
0
|
0
|
1400
|
POST
|
Thank you KirkKuykendall1, Perfectly working.. used t.Defaultvalues["FieldName"] = "SomeValue" to update attributes in collection. Really appreciate your help, Prashant
... View more
03-02-2021
09:26 PM
|
0
|
0
|
1400
|
POST
|
I'm able to assign values for CIMFeatureTemplate but when I call SetDefinition, values are resetting again and showing empty. Here is my code: IEnumerable<FeatureLayer> featLayers = theMap.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (FeatureLayer item in featLayers)
{
foreach (var template in MappingExtensions.GetTemplates(item))
{
CIMFeatureTemplate featTemplate = (CIMFeatureTemplate)template.GetDefinition();
featTemplate.DefaultValues["fieldname"] = "SomeValue"; //Values are updated
template.SetDefinition(featTemplate); //template.Defaultvlaues are empty here
}
}
... View more
03-02-2021
05:40 PM
|
0
|
2
|
1406
|
POST
|
Hi, I've created feature layer from featureservice. I've almost 73 predefined edit templates and want to add couple of attributes to each template after layer is getting added on map. I got all templates using below code but not sure how to get predefined attributes and set values. IEnumerable<FeatureLayer> featLayers = theMap.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (FeatureLayer item in featLayers)
{
foreach (var template in MappingExtensions.GetTemplates(item))
{
//Define attribute for each template.
}
} Any help would be appreciated. -Prashant
... View more
03-01-2021
11:08 PM
|
0
|
6
|
1493
|
POST
|
Hi, I'm trying to add some field values programmatically after feature is created. Code is working fine for feature class but not working with feature layer created from FeatureService. After creating feature I assigned field value and can see feature is getting added in feature layer attribute table in Arcpro 2.7 but doesn't sync online. I manually saved all edit's but still data is not appearing in feature service. After refresh or zoom-in/out feature gets cleated from Arcpro attribute table also. Here is my code: {
var mapProjItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(item => item.Name.Contains("Map"));
if (mapProjItem == null)
return;
QueuedTask.Run(() =>
{
var theMap = mapProjItem.GetMap();
IEnumerable<FeatureLayer> featLayer = theMap.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (FeatureLayer item in featLayer)
{
var layerTable = item.GetTable();
_rowCreateToken = RowCreatedEvent.Subscribe(onRowCreateEvent, layerTable);
}
}
private Guid _currentRowChangedGuid = Guid.Empty;
private void onRowCreateEvent(RowChangedEventArgs args)
{
if (_currentRowChangedGuid == args.Guid)
return;
var row = args.Row;
row["fieldname"] = "Some Value";
_currentRowChangedGuid = args.Guid;
row.Store();
_currentRowChangedGuid = Guid.Empty;
} Is there anything additional I need to do to save feature service edits? Any help would be appreciated. -Prashant
... View more
02-21-2021
07:08 PM
|
0
|
2
|
871
|
POST
|
Hi, Code is perfectly working with feature class but having issue with feature service. See my below code for reference. I can see feature is getting added in feature layer attribute table in pro but doesn't sync online. I manually saved all edit's but still data is not appearing on feature service. After refresh or zoom-in/out feature gets cleated from pro attribute table also. {
var mapProjItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(item => item.Name.Contains("Map"));
if (mapProjItem == null)
return;
QueuedTask.Run(() =>
{
var theMap = mapProjItem.GetMap();
IEnumerable<FeatureLayer> featLayer = theMap.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (FeatureLayer item in featLayer)
{
var layerTable = item.GetTable();
_rowCreateToken = RowCreatedEvent.Subscribe(onRowCreateEvent, layerTable);
}
}
private void onRowCreateEvent(RowChangedEventArgs obj)
{
obj.Row["field"] = "Some Value";
} -Prashant
... View more
02-21-2021
05:53 PM
|
0
|
0
|
882
|
POST
|
Thank you KirkKuykendall1, Yes, Instead of adding values in attribute inspector I added in row as suggested and started working, here is my code: private void onRowCreateEvent(RowChangedEventArgs obj)
{
obj.Row["Field"] = "SomeValue";
} But in this case I can't see programmatically added value in Attribute template if template is open while editing. Not sure if its okay to add values on both side simultaneously i.e. on row and attribute inspector together. -Prashant
... View more
02-11-2021
08:32 PM
|
0
|
0
|
975
|
POST
|
Hi, I'm trying to assign default attributes for newly created feature in featureService. I'm listening row created event and getting inspector of current edit template to assign value. But when feature is created for first time it doesn't assign value. After first feature is created value is getting assigned to attribute template and gets added to further features and works perfectly . Code is as below : protected void OnRowCreated(RowChangedEventArgs args)
{
QueuedTask.Run(() =>
{
Inspector ins = ArcGIS.Desktop.Editing.Templates.EditingTemplate.Current.Inspector;
ins["Field"] = "Some value";
ins.ApplyAsync();
});
} Is there any way to assign value on or before creating feature first time? Any help would be appreciated. -Prashant
... View more
02-11-2021
05:11 PM
|
0
|
4
|
1034
|
POST
|
Thank you JamesBrander, perfectly working for me. -Prashant
... View more
02-09-2021
08:56 PM
|
0
|
0
|
1269
|
POST
|
Hi, I want to execute my addin code after opening project in arcpro. I've config file which stores project related data. Now whenever I open project I need to activate addin and execute code to retrieve config file, to avoid this behavior I would like to execute some code by default on opening project. Any help would be appreciated, -Prashant
... View more
02-09-2021
03:55 PM
|
0
|
5
|
1355
|
POST
|
Hi, I've executed your code on ArcGIS Pro 2.7 and it's working fine. -Prashant
... View more
02-09-2021
03:46 PM
|
0
|
0
|
1056
|
Title | Kudos | Posted |
---|---|---|
1 | 09-12-2019 09:02 PM | |
1 | 11-03-2021 12:16 AM | |
1 | 02-01-2021 03:10 PM | |
1 | 01-19-2021 05:45 PM | |
1 | 09-01-2019 08:19 PM |
Online Status |
Offline
|
Date Last Visited |
08-07-2023
12:11 AM
|