Geography Reference
In-Depth Information
{
if (!theLayer.DataSource.IsOpen)
{
theLayer.DataSource.Open();
}
Envelope boundingBox = new Envelope (wgs84Location.CoordinateValue);
if ( Math .Abs(boundingBox.Area - 0.0) < 0.01)
{
boundingBox.ExpandBy(0.01);
}
theLayer.DataSource.ExecuteIntersectionQuery(boundingBox, selectedGeometry);
theLayer.DataSource.Close();
}
This should result in our FeatureDataSet collection being filled with any geometry found at
that location, which in our case should be the county that we clicked on.
Next up, we need to check if we have any data in the FeatureDataSet . If we do, grab the
name of the county that was clicked on.
Each row in the FeatureDataSet is pretty much the same as a row in a normal data set, so
we can look for a column with the same name as a column in the underlying table in
Postgres. If no rows are found, it's better to return.
if (selectedGeometry.Tables[0].Count <= 0) return ;
string countyName = selectedGeometry.Tables[0].Rows[0][ "name2" ].ToString();
Once we have a county name from our U.K. counties layer, we then want to get a list of
cities and towns for our county. We do this with the following two methods:
List < string > cityList = GetCitysForCounty(countyName);
List < string > townList = GetTownsForCounty(countyName);
Now that we have our data, we want to provide some visual feedback to the user. First, we'll
highlight the county we clicked on.
Search WWH ::




Custom Search