|
POST
|
A couple of quick things to check based on the code below - In PEDClearButton_Click it looks like you are setting the text of PED textbox to a space, not an empty string. Try using String.Empty instead as when the user clicks in the box to enter a new value, it may be appending it to that space and the logic of InputPED.Text.StartsWith() might not work since the 1st 2 characters are actually "<space>0". Using InputPED.Text.Trim().StartsWith() might work too. If that's not it 2 other things might be happening - Is it possible that _strLayerQuery is empty? If not does the case match that in your switch statement (it is case sensitive). Is the user entering something other than a 01,02,07, or 08 in the input box? TG
... View more
06-07-2011
11:49 AM
|
0
|
0
|
533
|
|
POST
|
Josh, You can set the maximum number of features returned either in ArcCatalog (with an Admin connection to the server - version 10 only), Server Manager (on the Parameters tab when viewing a Service's properties) or by editing the config file for the service, which is typically found in c:\program files\ArcGIS\Server10.0\server\user\cfg. In the .cfg file for the service, set the value for the <MaxRecordCount> tag. I believe you have to restart the SOM for this to take effect.
... View more
06-07-2011
05:54 AM
|
0
|
0
|
605
|
|
POST
|
try using the String.StartsWith() method or a switch statement on the 1st 2 characters of the value in the textbox
if (InputPED.Text.StartsWith("01") || InputPED.Text.StartsWith("02"))
{
strQueryTaskURL = "url of my MN map service�?�
}
else if (InputPED.Text.StartsWith("07") || InputPED.Text.StartsWith("08"))
{
strQueryTaskURL = "url of my BX map service�?�
}
or
switch (InputPED.Text.Substring(0,2).ToLower())
{
case "01":
case "02":
strQueryTaskURL = "url of my MN map service�?�;
break;
case "07":
case "08":
strQueryTaskURL = "url of my BX map service�?�;
break;
default:
break;
}
... View more
06-07-2011
05:37 AM
|
0
|
0
|
441
|
|
POST
|
You could sort the feature set before binding it. I've used the code below to sort the featureset returned by a query task
void QueryTask_ExecuteCompleted(object sender, QueryEventArgs e)
{
FeatureSet fs = e.FeatureSet;
if (fs.Count() == 0)
{
MessageBox.Show("Sorry, no data matches your query. Please try again", "Query", MessageBoxButton.OK);
}
else
{
FeatureSet fsSort = new FeatureSet(fs.OrderBy(x => x.Attributes[fs.DisplayFieldName]));
fsSort.DisplayFieldName = fs.DisplayFieldName;
fsSort.GlobalIdFieldName = fs.GlobalIdFieldName;
fsSort.ObjectIdFieldName = fs.ObjectIdFieldName;
... do whatever with fsSort ...............
EDIT: If you use the code above, you will do not get the FieldAliases in the new fsSort. The FieldAliases property on the FeatureSet is ready only so if you need the aliases you might try another method like this -
IList<Graphic> gsort = fs.Features.OrderBy(x => x.Attributes[fs.DisplayFieldName]).ToList();
fs.Features.Clear();
foreach (var g in gsort)
{
fs.Features.Add(g);
}
... do whatever with fs, which still has valid FieldAliases ......
... View more
06-02-2011
08:00 AM
|
0
|
0
|
344
|
|
POST
|
Hi Mike, A couple of quick things to check - I just went through this a few weeks ago but did get my MapService w/ an XY event layer to publish correctly. Did you stop/restart the service after adding the layer to the mxd? Was the service running from a .msd previously? If so you need to delete it and reset the service's source to the mxd since XY event layer are not supported in an optimized service. (Technicially you do not need to delete the msd, just good house keeping in my mind) Is the .odc connection file somewhere accesssible to the ArcGIS SOC account? Usually if you put it in the same folder as the mxd you're good. Make sure relative paths are set in the map. Did you reset the REST cache? Can you alter a service but the changes may not show up unless you reset the cache - http://<your server>/ArcGIS/rest/admin TG
... View more
05-31-2011
05:54 AM
|
0
|
0
|
458
|
|
POST
|
Hi Jennifer, Looks like the same issue as described in that post. Do you know if there is a bug # for this so we check it's status? I installed SP2 while working on this issue and that did not fix the issue. Also do you think this is why I cannot pass the graphic returned from the Identify directly to QueryAttachmentInfos? Thanks again, TG
... View more
05-31-2011
05:44 AM
|
0
|
0
|
1097
|
|
POST
|
Hi Jennifer. Yes that is correct. If I hit the REST end point of the service it shows the fields name fully qualified. Same if I query the layer that why the JSON results have the qualified names as shown here - "fields" : [ { "name" : "ppqtest.DBO.irfa_qbnd2009_test.OBJECTID", "type" : "esriFieldTypeOID", "alias" : "OBJECTID"}, { "name" : "ppqtest.DBO.irfa_qbnd2009_test.Quarantine", "type" : "esriFieldTypeInteger", "alias" : "Quarantine"}, { "name" : "ppqtest.DBO.irfa_qbnd2009_test.Shape", "type" : "esriFieldTypeGeometry", "alias" : "Shape"}, { "name" : "irfajoin.OID", "type" : "esriFieldTypeInteger", "alias" : "OID"}, { "name" : "irfajoin.Field1", "type" : "esriFieldTypeInteger", "alias" : "Field1"}, { "name" : "irfajoin.irfaoid", "type" : "esriFieldTypeInteger", "alias" : "irfaoid"}, { "name" : "irfajoin.testfield", "type" : "esriFieldTypeString", "alias" : "testfield", "length" : 50} ], Result from querying for an known Object ID - "features" : [ { "attributes" : { "ppqtest.DBO.irfa_qbnd2009_test.OBJECTID" : 403, "ppqtest.DBO.irfa_qbnd2009_test.Quarantine" : null, "irfajoin.OID" : 0, "irfajoin.Field1" : 403, "irfajoin.irfaoid" : 403, "irfajoin.testfield" : "test data from joined table" }, "geometry" : { "rings" : [ ...... However in the graphic that comes back from the identify the Keys in .Attributes are not qualified- (dumped this out via foreach (f in g.Attributes){system.diagnostics.debug.writeline(f);} [OBJECTID, 403] [Quarantine, Null] [Shape, Polygon] [OID, 0] [Field1, 403] [irfaoid, 403] It seems that when the IDictionary is getting populated the Alias is being used for the key and not the Name. Does that make more sense?
... View more
05-27-2011
10:37 AM
|
0
|
0
|
1097
|
|
POST
|
Thank you Dominique, simply setting DisableClientCaching = true and Refresh() works. Since the user can move more than one point at a time and the the WCF service runs asynch I added a little logic to reset client caching after all points have been updated as shown below in case it helps any one else. TG In my DrawComplete event handler
//turn off browser caching so updates show w/out needing to move the map
(_QueryLayer as ArcGISDynamicMapServiceLayer).DisableClientCaching = true;
UpdateCount = graphics.Count();
UpdateCount_Completed = 0;
foreach (Graphic g in graphics)
{
client.UpdateLocationAsync((int)g.Attributes["ID"], pt );
}
Then in the UpdateLocationAsync handler
(_QueryLayer as ArcGISDynamicMapServiceLayer).Refresh();
UpdateCount_Completed++;
if (UpdateCount_Completed == UpdateCount)
{
(_QueryLayer as ArcGISDynamicMapServiceLayer).DisableClientCaching = false;
}
... View more
05-27-2011
08:41 AM
|
0
|
0
|
290
|
|
POST
|
I have an application which contains a map service of point locations. The point data in the map service are from a Query Layer with the data coming from Sql Server (not SDE). I don't have control of the server and can only update the lat/longs and geometry column of the data via a stored procedure in SQL Server. This wasn't too hard - I just pass the facility ID and x/y of the MapPoint where the user clicks to a WCF service which then runs the stored proc in the database. Where I'm stuck is once the asynch WCF call is complete I'm trying to refresh the map display and have tried this - (_Layer as ArcGISDynamicMapServiceLayer).Refresh(); and this Map.Zoom(1.0); but neither actually refreshes the data. The point the user moved is still in the old location until they pan or zoom out. The code below works, but is there a better/easier way that I'm not seeing?
TimeSpan zd = _Map.ZoomDuration;
_Map.ZoomDuration = new TimeSpan(0, 0, 0, 0);
_Map.Zoom(0.99);
_Map.Zoom(1.01);
_Map.ZoomDuration = zd;
Thanks, Terry
... View more
05-26-2011
01:45 PM
|
0
|
2
|
2797
|
|
POST
|
While I found a work around, I still think this is a bug. Any comments from ESRI on this? Is this behavior by design or no? I think the API should be consistent in how field names are returned to avoid such issues. Just my 2 cents...
... View more
05-26-2011
05:44 AM
|
0
|
0
|
1097
|
|
POST
|
Here's a quick work around for anyone who needs it -it uses the 2nd overload I mention at the end of my first post and a quick LINQ query to get the features OID. Should probably add some error handling such as ensuring fli.ObjectIdField is not null..
//get OID
Field fldID = fli.Fields.First(x => (x.Name == fli.ObjectIdField));
string id = fldID.Alias;
string oid = (string)feat.Attributes[id];
if (fli.HasAttachments)
{
try
{
fl.QueryAttachmentInfos(feat, FLayer_QryAttachmentsComplete, FLayer_QryAttachmentsFail);
}
catch (System.ArgumentOutOfRangeException)
{
try
{
//issue with feature, try OID instead
fl.QueryAttachmentInfos(oid, FLayer_QryAttachmentsComplete, FLayer_QryAttachmentsFail);
}
catch
{
return;
}
}
}
... View more
05-19-2011
09:57 AM
|
0
|
0
|
1097
|
|
POST
|
I think a found a bug or two with QueryAttachmentInfos. Is anyone else using this and seeing similar behavior? I've been using the code below to get attachements, if present, for graphics returned from IdentifyResults -
flyr.Initialized += (s, e) =>
{
string title2 = t2;
Graphic feat = f2;
FeatureLayer fl = s as FeatureLayer;
FeatureLayerInfo fli = fl.LayerInfo;
if (fli.ObjectIdField != null)
{
urlFeature = urlLayer + "/" + feat.Attributes[fli.ObjectIdField];
}
else
{
urlFeature = urlLayer + "/" + Guid.NewGuid().ToString();
}
_dataItems.Add(new DataItem() { Title = title2, Data = feat.Attributes, Id = urlFeature });
_dataLinks.Add(urlFeature, new List<DataLink>());
cbxIdentify.ItemsSource = _dataItems;
if (fli.HasAttachments)
{
fl.QueryAttachmentInfos(feat, FLayer_QryAttachmentsComplete, FLayer_QryAttachmentsFail);
}
};
It works great until I joined a table to a layer in the mxd and republished the service. Now I get the following error on fl.QueryAttachmentInfos - System.ArgumentOutOfRangeException was unhandled by user code Message=Specified argument was out of the range of valid values. Parameter name: Invalid graphic or ObjectID StackTrace: at ESRI.ArcGIS.Client.FeatureLayer.QueryAttachmentInfos(Graphic g, Action`1 callback, Action`1 errorCallback).... The other overload for QueryAttachmentInfos takes the feature's OID as the input instead of a graphic, but when I try using feat.Attributes[fli.ObjectIdField] it's null. fli.ObjectIdField is coming back as the fully qualified field name but in the graphic, the attributes are not qualified. Is this by design or another error? Thanks, Terry
... View more
05-19-2011
09:13 AM
|
0
|
7
|
3294
|
|
POST
|
Harold, I hit this issue while working on a small project I was doing for my kid's school, and I haven't messed w/ the JavaScript API since..
... View more
05-05-2011
05:44 AM
|
0
|
0
|
1155
|
|
POST
|
the GraphicLayers have a FullExtent property which returns an Envelope. These 2 envelopes can be unioned to get the full extent of both layers. In general like this ..
Dim l_PointOne As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoint"), GraphicsLayer)
Dim l_polygon1 As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoly"), GraphicsLayer)
'make sure the extent from the point graphics layer is valid otherwise create one here
Dim NewExtent as Envelope = l_polygon1.fullextent.union(l_pointone.fullextent)
MyMap.ZoomTo(NewExtent)
... View more
04-25-2011
12:17 PM
|
0
|
0
|
736
|
|
POST
|
The Envelope class has a Union method which you could try to use to get the full extent of both layers.. you may need to check the extent of the graphics layers containing 1 point though, as it my not have a valid extent. If that's the case, just fake it by creating a new envelope centered on the point w/ the width & height set to 1 foot or meter or some other appropriately small value. below is a C# example of using the union method. Hope it helps, TG
//zoom to all features returned by the query task
Envelope extent = fs.Features[0].Geometry.Extent;
foreach (Graphic g in fs.Features)
{
extent.Union(g.Geometry.Extent);
}
Map.ZoomTo(extent);
... View more
04-25-2011
11:09 AM
|
0
|
0
|
736
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2017 08:59 AM | |
| 1 | 06-15-2016 03:27 PM | |
| 1 | 01-14-2016 09:55 AM | |
| 2 | 12-14-2012 09:38 AM | |
| 2 | 10-23-2017 01:22 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-17-2024
08:14 PM
|