Geography Reference
In-Depth Information
DataSource = new PostGIS (_connString, townTableName, townGeometryColumnName,
townGidColumnName),
MaxVisible = 40000
};
The only difference here is that we set the point color rather than the fill and line colors as
we do for a polygon layer. We set the Style property of the layers to our VectorStyle
object to give the layers their visual appearance. Next, we set the DataSource property to a
connection to our Postgres server using the constants and connection string we previously
defined. MaxVisible is the maximum zoom level that objects will be visible at in our map
viewer. If we zoom beyond the value we specify, nothing will be drawn on the screen.
After we define the layers and their styles and connections, we then simply add these layers
to the map control on our form.
mpbMapView.Map.Layers.Add(ukCountys);
mpbMapView.Map.Layers.Add(ukCitys);
mpbMapView.Map.Layers.Add(ukTowns);
Then we set our default tool, zoom to the full extents of the map, and render it.
mpbMapView.ActiveTool = MapBox . Tools .Pan;
mpbMapView.Map.ZoomToExtents();
mpbMapView.Refresh();
We'll finish by inserting the following code as the first two lines of the function; this will add a
status message to our status bar while the map is initializing:
_mapInitializing = true ;
lblStatusText.Text = "MAP Initializing please wait" ;
Your code should now look something like the following image:
Search WWH ::




Custom Search