Local Knowledge Database Search

This topic gives an example to carry out a Local Knowledge database search using a PostGIS database.

In Web Map Layers 8.0 Admin page select Database Connections > Add Connection:

Select the Database type, i.e. PostGIS

Enter a Name for the connection.

Enter the Data Source details and click Add.

Use SQLite or similar to open WebMapLayersConfig.db (C:\inetpub\wwwroot\WebMapLayers8.0.xxxx.0\App_Data)

Click the Browse Data tab.

Select ConnectionStrings from the Table drop-down:

This will show a display similar to the following:

ConnectionStrings table

Take note of the ConnectionStringID for the connection, i.e. 17

In the Table drop-down select DBSearch:

 

DBSearch table

Enter the ConnectionStringID, i.e. 17.

Enter the Search Class in the SearchClass column, i.e. Cadcorp.NoticeBoard.DatabaseSearch.DataBaseConnector,Cadcorp.NoticeBoard.DatabaseSearch

In the Table drop-down select DBSearch_Columns:

DBSearch_Columns table

Search on address and postcode then use postcode search Column ID in DBSearch_ResultColumns.

Set Column ID in DBSearch_SearchColumns to the column you want to use in Quick Search (here: address column is column 1).

DBSearch_SearchColumns table

Note: This example shows two columns but more columns can be added.

The next step is to add a template for the results.

In Web Map Layers 8.0 Admin page select Templates > Add Template:

 

Enter a name in the Name field for the new template, i.e. PostCodeFromPostGIS.

The following code is to be added to Add Template dialog text pane:

{Items[0].Attributes[TableColumnName]}

The TableColumnName is the required column in the selected table. In this example it is postcode.

Precede this code with some introductory text, i.e. “The Post Code is “

Therefore the dialog text for this example would be:

The Post Code is: {Items[0].Attributes[postcode]}

To enter this introductory text and code click on the Tools drop-down to show the Source code screen, which will be blank at this stage:

Enter the text and code:

Click OK.

The Add Template dialog would now be:

Click Add.

In SQLite select Templates from the Table drop-down.

Select the template from the displayed list, i.e. TemplateID 22 (PostCodeFromPostGIS)

Select LocalKnowledge_DBSearch from the Table drop-down:

LocalKnowledge_DBSearch table

Locate the template to use and enter the TemplateID in the TemplateID column of the LocalKnowledge_DBSearch Table, i.e. 22.

Open IIS and restart the application pool, i.e. WebMapLayers8.0.xxxx.0:

IIS Manager

In Web Map Layers 8.0 Admin page select Searches > Add Search:

Enter the values for the new search. Example values are shown above.

Go to the Web Map Layers 8.0 Map Settings:

The new search Brighton_Addresses will now be shown on the dialog.

Enter an address or part of an address in the map search box:

Select an address.

Click on Local Knowledge.

The post code will be returned:


Send comments on this topic.