Skip to Content
Mastering Geospatial Analysis with Python
book

Mastering Geospatial Analysis with Python

by Silas Toms, Paul Crickard, Eric van Rees
April 2018
Beginner to intermediate content levelBeginner to intermediate
440 pages
11h 36m
English
Packt Publishing
Content preview from Mastering Geospatial Analysis with Python

Querying the data

You created a table, added columns for code and location, and populated it using data from another source. Now, you will learn how to query the data and get it out of the database.

While there are spatial SQL queries available to you, you can always just select the data as if it were a non-spatially enabled database so that you can use it as follows:

SELECT * FROM table

The following code shows the generic SELECT all query and the results:

cursor.execute("SELECT * from art_pieces")data=cursor.fetchall()data

The result should look as follows:

 [(1, '101', '010100000025FFBFADE0A55AC06A658B6CE7934140'), (2, '102', '0101000000CC4E16E181AA5AC0D99F67B3EA8B4140'), .......,]

The first number, 1,2,n, is the id (the SERIAL PRIMARY ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Geospatial Analysis with Python

Learning Geospatial Analysis with Python

Joel Lawhead

Publisher Resources

ISBN: 9781788293334Supplemental Content