{"id":17671538,"url":"https://github.com/giswqs/postgis","last_synced_at":"2025-08-01T06:33:33.671Z","repository":{"id":41229195,"uuid":"352420689","full_name":"giswqs/postgis","owner":"giswqs","description":"Spatial Data Management with PostgreSQL and PostGIS https://gishub.org/sdm","archived":false,"fork":false,"pushed_at":"2022-08-19T14:39:35.000Z","size":13807,"stargazers_count":47,"open_issues_count":2,"forks_count":35,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T12:49:42.086Z","etag":null,"topics":["data-science","database","geospatial","postgis","postgres","postgresql"],"latest_commit_sha":null,"homepage":"https://postgis.gishub.org","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giswqs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-28T19:33:10.000Z","updated_at":"2025-02-21T17:18:37.000Z","dependencies_parsed_at":"2022-09-11T01:11:39.566Z","dependency_job_id":null,"html_url":"https://github.com/giswqs/postgis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/giswqs/postgis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giswqs%2Fpostgis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giswqs%2Fpostgis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giswqs%2Fpostgis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giswqs%2Fpostgis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giswqs","download_url":"https://codeload.github.com/giswqs/postgis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giswqs%2Fpostgis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262647222,"owners_count":23342616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","database","geospatial","postgis","postgres","postgresql"],"created_at":"2024-10-24T03:42:48.360Z","updated_at":"2025-06-29T18:32:27.931Z","avatar_url":"https://github.com/giswqs.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgis\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/giswqs/postgis/master)\n\nSpatial Data Management with PostgreSQL and PostGIS https://gishub.org/sdm\n\n## Sample Datasets\n\n- https://github.com/giswqs/data\n- [cities.csv](https://github.com/giswqs/postgis/blob/master/data/cities.csv)\n\n## Useful Resources\n\n- https://www.w3schools.com/sql/default.asp\n\n## SQL Tutorial\n\n- https://www.scaler.com/topics/sql/\n\n### Change column type\n\n```\nALTER TABLE cities\nALTER COLUMN population TYPE INT\nUSING population::integer\n```\n\n### SQL queries for non-spatial data\n\nThe examples below use the sample dataset - [cities.csv](https://github.com/giswqs/postgis/blob/master/data/cities.csv)\n\n- `SELECT * FROM cities`\n- `SELECT * FROM cities LIMIT 10`\n- `SELECT name, country FROM cities`\n- `SELECT DISTINCT country FROM cities`\n- `SELECT COUNT(DISTINCT country) FROM cities`\n- `SELECT MAX(population) FROM cities`\n- `SELECT SUM(population) FROM cities`\n- `SELECT AVG(population) FROM cities`\n- `SELECT * FROM cities ORDER BY country`\n- `SELECT * FROM cities ORDER BY country ASC, population DESC`\n- `SELECT * FROM cities WHERE country='USA'`\n- `SELECT * FROM cities WHERE country='USA' OR country='CAN'`\n- `SELECT * FROM cities WHERE country='USA' AND population\u003e1000000`\n- `SELECT * FROM cities WHERE country LIKE 'U%'`\n- `SELECT * FROM cities WHERE country LIKE '%A'`\n- `SELECT * FROM cities WHERE country LIKE '_S_'`\n- `SELECT * FROM cities WHERE country IN ('USA', 'CAN', 'CHN')`\n- `SELECT * FROM cities WHERE population BETWEEN 1000000 AND 10000000`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiswqs%2Fpostgis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiswqs%2Fpostgis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiswqs%2Fpostgis/lists"}