# How to Use Spatial Search in a Query

**URL:** <https://speciforum.org/t/how-to-use-spatial-search-in-a-query/776>\
**Category:** Query Building\
**Tags:** Specify-7, Members-only\
**Created:** [September 27, 2022, 2:53am UTC](https://speciforum.org/t/how-to-use-spatial-search-in-a-query/776 "2022-09-27T02:53:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 27, 2022, 2:53am UTC](https://speciforum.org/t/how-to-use-spatial-search-in-a-query/776/1 "2022-09-27T02:53:21Z")

</div>

> 📖 This guide explains how to use spatial search in queries to select a region on the world map and restrict the query results to only that area.

Some important restrictions to keep in mind when creating a spatial search are:

- Spatial query searches on `latitude1` and `longitude1` columns only
- You can only select a polygon area
- You can only select a single area
- The polygon’s sides must be parallel to the equator and the prime meridian

To activate it, add a Latitude1 or Longitude1 column to the query builder and press on the new pin button (`📍`)

* * *

In this example, we have a simple Locality query.

 ![Spatial Search Locality query](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/0/0f3e33670028c97753a1513ddb36576a6a640188.png)

To begin using the spatial search functionality, I need to click the

 ![pin](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/3/3746c7561c7e87ed01dc8e67eb106af6d2fe5e74.png) button. Once I do, the spatial search GeoMap dialog will appear.

 ![GeoMap dialog](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/0/0ba251ee1410787ff1bf62b82ad7c00ba1692b58.jpeg)

Using GeoMap’s built-in functionalities, I zoomed in and selected a region on the map.

 ![Region selected](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/1/182eaaa3c3edda2753cb0250865875e5f93f6321.jpeg)

Now I click Save

In the query fields, I can see that the Latitude1 and Longitude1 query field values have been modified to be between the coordinates I selected on the map.

 ![Spatial query fields](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/a/ae40baa2124be73eb3b19cb8570200a4a1c319f8.png)

Now when I run the query, I can see 113 results returned. These are all within the bounds of the region selected above.

In the top right of the query output, I can now select GeoMap and view these points on the map together. **These points are all of the loaded records returned in your query.**

> [!Tip]  
> The map will only show selected query results, so to limit the points mapped, select only the ones you wish to display in the GeoMap.

 ![GeoMap button on the query](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/5/5494014a61e6ef064caf1598dc0631dfa8ccadff.png)

Now I can navigate around the map and click on the groups of pins.

When you select a pin, you can see important information about which particular specimen record is associated as well.

 ![Pin display details](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/3/38441115a423c6c1c0e36e6fa6478815ce6cecc9.jpeg)

* * *

[This feature was requested by SAIAB](https://github.com/specify/specify7/issues/1713#issue-1257166916). Thank you for being a member of the Specify Collections Consortium!
