Git Product home page Git Product logo

postgres-spatial-join-areas's Introduction

postgres spatial join for areas

Script for running spatial joins between datasets areas.

description

A simple module which allows for the running of spatial join in postgres utilising the postgis extension for a number of data scenarios and join outcomes - (a) a list of the polygons each feature intersects with and (b) a single polygon a feature intersects with. Results are stored as part of the dataset in the database in new columns. In the case of (a), results are stored using the postgres 'character varying[]', resulting in an array of values which can be quireied.

With (a) where the dataset of itnerest is polygons, and the join dataset is polygons, the 'coverage', the overlap between the polygons is recorded and returned also. For points and polylines only the id of the intersecting areas is returned.

parameters

dataset: the name of the table in postgres the areas are to be join to
join_multiple_areas: if all areas which insterect those features in the dataset are to be recorded set as True. default is true
areas_to_join: the name of the table in postgres for the areas which are to be joined
join_data_is_areas: set as true if the dataset is polygons. set as false if polyines or points. default is True
fields_to_join: not currently active
dataset_id_field: the column in the dataset which can be used as the unique identifier. default is 'gid'
join_areas_id_field: the column in the table of the data to be joined which is a unique identifier and will be copied into the dataset as a result of the join. default is 'gid'
dataset_geom_field: the name of the column in the dataset which stores the geomerty which should be used for the join. default is 'geom'
join_areas_geom_field: then anme of the column in the area data which is to be joined which should be used. default is 'geom'
database_connection: a psycopg2 live connection object to the database containing the tables to be joined. default is None. if passing, set connection.autocommit=True before passing connection_parameters: a dictionary object wich contains the following keys and data for the database connection - 'database_name','user', 'password', 'port', 'host'

dependencies

psycopg2

postgres-spatial-join-areas's People

Contributors

craig-robson avatar

Watchers

James Cloos avatar

postgres-spatial-join-areas's Issues

add checks for fields

Check the passed fields, the dataset id and geom for exmaple, exist before trying to run code

miss-aggregation of areas

When aggregating areas, duplicates appear in final lists. e.g. when running at lad scale, duplicates appear in gor list (but nor lad list). need to sort this as it will speed up queries and reduce data volumes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.