creating query layers in arcmap using postgis tables

This post will demonstrate how a GIS Analyst can create layers in Arcmap from applying queries to PostGIS tables . This is a useful way of bringing in filtering datasets in a PostGIS database and loading them as layers into the ArcMap environment.

For our demonstration, we will be using a PostGIS database hosted in our QGIS Cloud account.

1. Go to the ArcCatalog and create a connection to your PostGIS database or refresh an earlier connection. In the screenshot below, you can see our connection and the tables.


2. Once a connection is established, go to File – Add Data – Add Query Layer


3. A. Click on the drop down button to select the PostGIS Connection.B) Select a Table in the database C) Give the query a name. D) Write the query expression, in this case- Select from the table district_lagos where the field- name_2 has the value – Agege.                           Click Next


4. Inspect the next page and ensure all the parameters fit the ones you require for the query layer. Click Finish4


5. The screenshot below shows the resultant query layer in ArcMap. Query layers have to be exported as


6. We can also query two tables simultaneously in the PostGIS connection and create a query layer in ArcMap. For the next expresion, we select data from tables’- ibadan_schools and southwest.. We ask to know the point locations in one table that intersect the feature with name-akinyele in another table called southwest.


7. The final result is a query layer comprising selected points with the attribute table shown in the screenshot below. Note that all the query requested the id and geometry fields from the ibadan_schools table and the name_2 field from the southwest table. All points have value=akinyele in the name_2 field.


Thank you for following the blog.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s