Geography Reference
In-Depth Information
Figure 80: Table with New Views
SharpMap, like any decent implementation of an OGC-compliant GIS database client, will
examine the geometry_columns table to find out the details of any layers we add. It will
cancel and produce an exception if we add a view that can't be found in the
geometry_columns table. Once we manually add the data, we can then load those views into
our application.
Back to the Code...
Now that we have our UI, our data, and some views to project our data, it's time to add some
C# to stitch it all together.
The first thing we need is a connection string for our Postgres database and a Boolean flag
for the map initialization. Add the following code just before the constructor for your first
form, and substitute the sever name, passwords, and user names as needed for your own
connection:
private const string _connString = "Server=<server>;Port=5432;User
Id=<user>;Password=<password>;Database=gisbook;CommandTimeout=300" ;
private bool _mapInitializing;
Note that I set the command timeout to five minutes. If you're going to be doing a lot of
server-based, long running geometry processing jobs, then this is a wise thing to do. The
default command timeout is 20 seconds. When you start doing bigger jobs with this stuff,
you'll end up with gigabytes of data and some lengthy run times.
 
Search WWH ::




Custom Search