Skip to contents

PostGIS

Connection

db_connect()
Connect to a database

Querying

get_lazy()
Get a lazy data frame for a given table or view reference.
run_lazy()
Run a query and return the result as a data frame or sf
get_definition()
Get the Definition of a View or Materialised View

Editing

edit_vals()
Edit values of a table.

Metadata

write_table_report()
Write an HTML report about a table

Admin

create_db()
create_db
db_write_data_model()
Write a postgisMoR data model to the database
db_to_json_data_model()
Create a JSON data model based on a database
add_role()
Add a role to the database
map_views()
View a directed graph of view dependencies in a database.

Spatial Tools

en2os()
Eastings and Northings to OS Grid Ref This function converts eastings and northings to an OS grid ref of a specified length.
os2en()
OS Grid Ref to Eastings and Northings
os2point()
Function for creating a polygon from a grid reference, with the size of the polygon dependant on the precision of the grid reference
os2poly()
Function for creating a polygon from a grid reference, with the size of the polygon dependent on the precision of the grid reference
postcode2point()
Convert postcode to sf point
st_centroid_within_poly()
Function for finding a centroid and ensuring that it is within the polygon for irregularly shaped polygons This function returns an sf point object.
postcode_lookup
Lookup table with easting and northing coordinates for each UK postcode.

Other

addCustomLegend()
Title Create a custom legend for a leaflet webmap
to_title_case()
Convert a string from snake_case to a pretty title case