• Blog posts

    Bio

    By David Crowther

    MapThat___PostGIS_Simple_Search_-_1.PNG

    Question:

    How do I do a Simple Search e.g. Planning App Number for PostGIS data?

    Answer:

    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…

    Search Syntax

    Having created your Search Layer, use this syntax in the Layer SQL Statement box:

    Select * from planningapps4326multigeom where name like '%:name%'

    MapThat___PostGIS_Simple_Search_-_2.PNG

    • planningapps4326multigeom – is this PostGIS Tablename
    • name – is this Search Parameter Name as shown below

    Search Parameters:

    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.

    MapThat___PostGIS_Simple_Search_-_3.PNG

    Note – PostGIS is very case sensitive, so be wary when defining the Table/View and the Column values.

    Simple Search:

    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.

    MapThat___PostGIS_Simple_Search_-_4.PNG

    Projects Searches:

    Finally ensure that the new Search Layer is exposed in your Project using the Project - Project Searches Tab to add the new Search Layer.

    MapThat___PostGIS_Simple_Search_-_5.PNG

    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.

    MapThat___PostGIS_Simple_Search_-_6.PNG

    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.

    MapThat___PostGIS_Simple_Search_-_7.PNG