By David Crowther
How do I do a Simple Search e.g. Planning App Number for PostGIS data?
In this previous blog - https://www.cadlinecommunity.co.uk/hc/en-us/articles/360002583337-MapThat-Create-PostGIS-Search-Layers – we explored how to create a MapThat PostGIS Search Layer using a List of Unique values. Using the syntax below we can now create a Simple Search which allows users to search by App Number/Name etc…
Having created your Search Layer, use this syntax in the Layer SQL Statement box:
Select * from planningapps4326multigeom where name like '%:name%'
- planningapps4326multigeom – is this PostGIS Tablename
- name – is this Search Parameter Name as shown below
As per normal you will also need to add the Search Parameters.
In this example we will allow the User to search via the name field and present the results as a COMBO box where the user can start typing and the list of results are filtered as the User types.
Note – PostGIS is very case sensitive, so be wary when defining the Table/View and the Column values.
Ensure that you tick the Used for Simple Search in the Data Layer edit form so that the Search Layer runs as a SIMPLE search.
Finally ensure that the new Search Layer is exposed in your Project using the Project - Project Searches Tab to add the new Search Layer.
Now within MapThat you can run the new PostGIS Planning Apps Search by App Number/Name. As the User types their value, the list of records are filtered to match the values being entered.
As this is a Simple Search, the results are shown as a Simple list below the Search criteria. Select a record and zoom into the map over the blue pin to find the feature.