POST
|
When you visit a tab it calls FeatureLayer.queryIds to get the OIDs for all features that intersect with the drawn shape in the given layer. It then compares the length of this ID array to see if it needs to chunk the feature requests if the number of IDs exceed the layers max record count. Then calls FeatureLayer.queryFeatures passing in the appropriate feature IDs. The underlying interaction with the database is based on how the ArcGIS JS API handles the functions listed above.
... View more
10-23-2018
03:25 PM
|
1
|
2
|
461
|
POST
|
Happy to help. Glad it worked out ok and thanks for the follow up!
... View more
08-29-2014
07:33 AM
|
1
|
0
|
701
|
POST
|
Since this only took a couple of minutes to write I will post an example. However, if you need someone to write solutions for you then we have many people who work in Professional Services that can build applications for you.
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace EngineWindowsApplication1
{
public partial class Form1 : Form
{
private enum LayerType { Districts, SubDistricts };
IList<IGeometry> m_districts = null;
IList<IGeometry> m_subDistricts = null;
IFeatureLayer m_districtsLayer = null;
IFeatureLayer m_subDistrictsLayer = null;
string m_districtsKeyFieldName = "STATE_NAME";
string m_subDistrictsKeyFieldName = "NAME";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//could be used to cache the geoms, may not be appropriate for large feature classes
m_districts = new List<IGeometry>();
m_subDistricts = new List<IGeometry>();
m_districtsLayer = (IFeatureLayer)axMapControl1.get_Layer(1);
m_subDistrictsLayer = (IFeatureLayer)axMapControl1.get_Layer(0);
//get the districts layer
IFeatureCursor fCur = m_districtsLayer.FeatureClass.Search(null,false);
populateCBO(fCur, m_districtsKeyFieldName, false, LayerType.Districts, comboBox1);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
reset();
IGeometry g = getGeomAndZoom(LayerType.Districts, comboBox1.SelectedIndex, comboBox1.SelectedItem.ToString());
ISpatialFilter sf = new SpatialFilter() { Geometry = g, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects };
IFeatureCursor fCur = m_subDistrictsLayer.FeatureClass.Search(sf, false);
comboBox2.Enabled = true;
populateCBO(fCur, m_subDistrictsKeyFieldName, true, LayerType.SubDistricts, comboBox2);
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
IGeometry g = getGeomAndZoom(LayerType.SubDistricts, comboBox2.SelectedIndex, comboBox2.SelectedItem.ToString());
}
private IGeometry getGeomAndZoom(LayerType lt, int i, string val)
{
string fieldName = "";
IGeometry g = null;
IFeatureLayer fl = null;
IList<IGeometry> l = null;
switch (lt)
{
case LayerType.Districts:
fieldName = m_districtsKeyFieldName;
fl = m_districtsLayer;
l = m_districts;
break;
case LayerType.SubDistricts:
fieldName = m_subDistrictsKeyFieldName;
fl = m_subDistrictsLayer;
l = m_subDistricts;
break;
default:
break;
}
if (l.Count > 0)
g = l;
else
{
IQueryFilter qf = new QueryFilter() { WhereClause = fieldName + " = '" + val + "'"};
g = fl.FeatureClass.Search(qf, false).NextFeature().Shape;
}
axMapControl1.Extent = g.Envelope;
axMapControl1.Refresh();
return g;
}
private void populateCBO(IFeatureCursor fCur, string fieldName, bool cacheGeoms, LayerType lt, ComboBox cbo)
{
IFeature f = fCur.NextFeature();
while (f != null)
{
cbo.Items.Add(f.get_Value(f.Fields.FindField(fieldName)));
if (cacheGeoms)
{
switch (lt)
{
case LayerType.Districts:
m_districts.Add(f.Shape);
break;
case LayerType.SubDistricts:
m_subDistricts.Add(f.Shape);
break;
default:
break;
}
}
f = fCur.NextFeature();
}
}
private void reset()
{
m_subDistricts = new List<IGeometry>();
comboBox2.Text = "";
comboBox2.Items.Clear();
comboBox2.Enabled = false;
}
}
}
... View more
08-18-2014
03:31 PM
|
0
|
3
|
701
|
POST
|
So, I believe what you are looking for is to create a search cursor with a null QueryFilter on the feature class from the Districts layer and for each feature in the districts class add the field value that contains the districts name for example to the districts ComboBox. Then when the user selects a value from the districts combo box you will need the actual geometry for the district they select. You could either store them (the geometries for the districts) upfront when you loop through looking for the names or you could do an additional search cursor passing in a QueryFillter with a where clause that searches for the user selected name. Once you have the district geometry you can create a search cursor on the sub-districts feature class and pass in a SpatialFilter that contains the districts geometry and the appropriate spatial relationship value. With this you could get all of the sub districts that are coincident with the district. You would then basically start the general steps to the workflow over again by writing out the value for each feature returned by the spatial query on the sub-districts class to the sub districts combo-box. The user selects a sub-district and you again use the actual geometry for that sub-district to perform a spatial query on the next class in line and so on. For the zoom…each time the user selects a combo-box you will need to find the corresponding geometry for the selected value. At that point you could set the maps extent accordingly. Let me know if any of that is not clear...
... View more
08-18-2014
01:58 PM
|
0
|
5
|
701
|
POST
|
Only some types are available from the initial Project and Add-In Wizard. After you have created the project open the Solution Explorer and right-click the project > Add > New Item... From the Add New Item dialog go to ArcGIS\Desktop Add-Ins and select Add-In Command Container. Then you will see a wizard that will help you define the properties for the command container.
... View more
06-04-2014
02:12 PM
|
0
|
0
|
230
|
POST
|
The files that are generated as: <nameOfClass>.ecfg lack "AssemblyInfo" details. For example go into one of your projects that generates the {<guid_id>}_<nameOfClass>.ecfg. In the Solution Explorer (for a C# project) under properties you will see AssemblyInfo.cs. Right-click this and click Properties...set the build action to None. For VB (I am not a VB guy) but the easiest way I saw was to right-click the project in the Solution Explorer > Unload...right-click again > Edit...search for AssemblyInfo. You should see <Compile Include="<Project>\AssemblyInfo.vb" />...remove this line and reload the project. On the next build you should see the .ecfg generate without the GUID. The main reason we use this pattern is to help avoid name collisions...avoiding the case where more than one developer creates a acme.ecfg.
... View more
06-04-2014
01:57 PM
|
0
|
0
|
558
|