Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
8087f91
first commit
Idzikowski-Casey Apr 7, 2021
8c615e9
shared verticies will snap on drag. Fixed in same feature bug and tri…
Idzikowski-Casey Apr 22, 2021
7e39166
readme added
Idzikowski-Casey Apr 23, 2021
0e592dc
postgis-geo-map as submodule
Idzikowski-Casey May 8, 2021
664acd6
db persistence, WIP: creating new polys. My helper function sucks still
Idzikowski-Casey May 13, 2021
950b070
additions
Idzikowski-Casey May 13, 2021
acd028f
updates
Idzikowski-Casey May 25, 2021
37d3400
deleted voroni stuff, created a view that joins map-faces on identity…
Idzikowski-Casey May 25, 2021
ff627a6
view created from map_face
Idzikowski-Casey Jun 3, 2021
93ed571
enter in default type as well so added to topology
Idzikowski-Casey Jun 3, 2021
7e3fad3
updaates
Idzikowski-Casey Jun 3, 2021
0625b7d
property view mode init commit
Idzikowski-Casey Jun 3, 2021
76356c3
endpoint and sql file to edit column name and group text in dataabase.
Idzikowski-Casey Jun 3, 2021
e930d28
progress
Idzikowski-Casey Jun 3, 2021
94cb0d3
Importer class and API with frontend exposure if nothing in DB
Idzikowski-Casey Jun 25, 2021
d8aa4aa
WIP frontend: polygon on click, backend: config style project differe…
Idzikowski-Casey Jun 29, 2021
567e26c
backend structure remodel, db class does more of the db operations in…
Idzikowski-Casey Jun 30, 2021
39465d5
backend WIPs, mostly spelling errors
Idzikowski-Casey Jun 30, 2021
e872f05
major changes
Idzikowski-Casey Jul 13, 2021
c96d316
New project creation is now possible through frontend and supported o…
Idzikowski-Casey Aug 2, 2021
add9271
bugs and WIP column-groups
Idzikowski-Casey Aug 25, 2021
7a81fa9
Col groups meta table. Foreign key in project_schema.columns. Color c…
Idzikowski-Casey Aug 26, 2021
587c892
Col group can be added to column, a new col group can be created and …
Idzikowski-Casey Aug 26, 2021
c299114
Feature updates; can add known geometry via WKT or GeoJSON
Idzikowski-Casey Sep 1, 2021
d7146be
additional note
Idzikowski-Casey Sep 1, 2021
eb4ffbe
code refactored
Idzikowski-Casey Sep 8, 2021
34472d0
begin dockerization; column-groups are project specific, download as csv
Idzikowski-Casey Sep 13, 2021
688b113
dockerized application
Idzikowski-Casey Oct 14, 2021
43375ef
gitignore upgrades
Idzikowski-Casey Oct 25, 2021
beeec9d
delete stuff
Idzikowski-Casey Oct 25, 2021
c44dd8e
pycache and vscode directories deleted and ignored in future
Idzikowski-Casey Oct 25, 2021
a313f1f
docker ports and api base env variables
Idzikowski-Casey Oct 26, 2021
a09786d
docker now runs frontend production and runs an npx static server
Idzikowski-Casey Oct 26, 2021
fca4da2
simplified environment variables
Idzikowski-Casey Oct 26, 2021
c584717
changelog, one char change for moving connected points in same polygo…
Idzikowski-Casey Nov 17, 2021
d0acc1d
Create LICENSE
Idzikowski-Casey Nov 17, 2021
ed45315
multiline-string works for draggin, line tool not working yet
Idzikowski-Casey Nov 20, 2021
31ea1bb
updated features
Idzikowski-Casey Nov 23, 2021
9983420
Merge pull request #4 from Idzikowski-Casey/multiline-string
Idzikowski-Casey Nov 23, 2021
28a128c
Update README.md
Idzikowski-Casey Nov 27, 2021
a394926
guard against no id better, keyword error bug fixed
Idzikowski-Casey Dec 6, 2021
f04ff9c
Merge pull request #10 from Idzikowski-Casey/bug-fixes
Idzikowski-Casey Dec 6, 2021
f325345
Delete .DS_Store
Idzikowski-Casey Dec 6, 2021
2696bac
clean_change_set is more efficient
Idzikowski-Casey Dec 27, 2021
e153e42
if nothing to delete don't run the merge-sort
Idzikowski-Casey Dec 28, 2021
6e7a2f3
WIP reseting info overlay after post/put
Idzikowski-Casey Dec 28, 2021
67114e9
update changelog
Idzikowski-Casey Dec 28, 2021
734cb01
database schema updates; add a color and description field, update th…
Idzikowski-Casey Dec 28, 2021
0bbab95
columns have a description field and column-groups can have specified…
Idzikowski-Casey Dec 28, 2021
cede1ea
updated changelong
Idzikowski-Casey Dec 28, 2021
3241959
Merge branch 'main' into ui-enhancements
Idzikowski-Casey Dec 28, 2021
b7b2bb1
fixes map_face view
Idzikowski-Casey Jun 30, 2022
83705c9
work off of postgrest API
Idzikowski-Casey Jun 30, 2022
e721467
dependency warning
Idzikowski-Casey Jul 1, 2022
e5987dd
import points as well, have option for no column geometries
Idzikowski-Casey Jul 1, 2022
a32cf46
Voronoi tesselation
Idzikowski-Casey Jul 12, 2022
8db65d2
context manager for db session
Idzikowski-Casey Jul 14, 2022
5bcd438
more sql procedures for postgis things
Idzikowski-Casey Jul 14, 2022
94f94ce
new, points only approach
Idzikowski-Casey Jul 14, 2022
469068d
indents
Idzikowski-Casey Jul 14, 2022
dc24abd
buffered points will separate by voronoi when overlapping
Idzikowski-Casey Jul 18, 2022
173478a
database persistence for voronoi
Idzikowski-Casey Jul 19, 2022
6626ef6
quad_segs and radius as params
Idzikowski-Casey Jul 19, 2022
4157de3
clean up console logging
Idzikowski-Casey Jul 19, 2022
171ecc9
db method to redump lines from edges and update topology
Idzikowski-Casey Jul 20, 2022
1607502
WIP trying to solve bug
Idzikowski-Casey Jul 20, 2022
3b53d60
tried snaptogrid
Idzikowski-Casey Jul 20, 2022
cd87416
redump lines after cleanup
Idzikowski-Casey Jul 21, 2022
d66ef33
remove snaptogrid and intersect entire geometry
Idzikowski-Casey Jul 21, 2022
baceccf
wip exporter
Idzikowski-Casey Jul 24, 2022
db1407b
figuring out col-group-ids
Idzikowski-Casey Jul 24, 2022
2755ec7
data exporter to macrostrat
Idzikowski-Casey Jul 25, 2022
558fd83
don't count on a point being present from macrostrat
Idzikowski-Casey Jul 27, 2022
b11ee13
changing project ids for practice
Idzikowski-Casey Jul 27, 2022
fd12e9f
comments
Idzikowski-Casey Jul 28, 2022
2581b6b
null coalesce if there isn't a bounding geom
Idzikowski-Casey Jul 28, 2022
fc1e865
mapbox token to env
Idzikowski-Casey Jul 28, 2022
dc31865
refactor into smaller functions
Idzikowski-Casey Jul 28, 2022
9967f2f
only accept wkt
Idzikowski-Casey Jul 29, 2022
fb8adc0
greatly simplfy clean_change_set function
Idzikowski-Casey Jul 29, 2022
a5daa63
moved to database directory
Idzikowski-Casey Jul 29, 2022
3ed1585
env variables for db connections and external apis
Idzikowski-Casey Jul 29, 2022
e63c2d3
useless crap
Idzikowski-Casey Jul 29, 2022
72a13e4
moved exmaple .env
Idzikowski-Casey Jul 29, 2022
ea3e709
psycopg2-binary for updated libq on server
Idzikowski-Casey Jul 30, 2022
ccc0d66
Some small edits to dependency files
davenquinn Oct 27, 2022
bc0fa7f
Merge branch 'voronoi' of https://github.com/UW-Macrostrat/column-top…
davenquinn Oct 27, 2022
2295eb4
Moved gitmodules to root
davenquinn Aug 2, 2025
ca98eb4
Merge branch 'main' into column-footprint-editor
davenquinn Aug 4, 2025
91fd886
Reformatted with Black
davenquinn Aug 4, 2025
8bc30b5
Move files into a more standard python package structure
davenquinn Aug 5, 2025
87f34ab
Successfully runs with modern packaging
davenquinn Aug 5, 2025
2e73e0d
Updated some database configuration
davenquinn Aug 5, 2025
1de373c
Updated topology manager
davenquinn Aug 5, 2025
a82a043
Steps to fix SQL parameters
davenquinn Aug 7, 2025
7250cf2
Updated database access code
davenquinn Aug 7, 2025
8aafb5a
Updated query parameter binding
davenquinn Aug 8, 2025
620eb93
Format code and sort imports
davenquinn Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "postgis-geologic-map"]
path = services/column-footprint-editor/postgis-geologic-map
url = https://github.com/davenquinn/postgis-geologic-map.git
[submodule "deps/topology-manager"]
path = submodules/topology-manager
url = https://github.com/Mapboard/topology-manager.git
Expand Down
38 changes: 0 additions & 38 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ markers = [
"docker: marks tests as requiring a docker container",
"requires_gdal: marks tests as requiring GDAL",
]

# TODO: use UV workspaces
# https://docs.astral.sh/uv/concepts/projects/workspaces/#workspace-sources

8 changes: 8 additions & 0 deletions services/column-footprint-editor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.node_modules
__pycache__/
*.pyc
*.parcel-cache
dist
.env
.vscode/
dev.yaml
1 change: 1 addition & 0 deletions services/column-footprint-editor/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
152 changes: 152 additions & 0 deletions services/column-footprint-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Changelog:

## 2025 reactivation

- Switch to newer version of Python
- Start using `uv` for dependency managment (note, this is different than other packages which use `poetry`).

## Older changes on `voronoi` branch (2021)

You can click on a point, that has more than one vertex, and drag them together, causing the lines to also be dragged together. Deleting and creating nodes also work.

Can create new polygons from scratch using the line create tool. Edits are relatively easy, except for bugs listed below.

Backend is bootstrapped to postgis-geologic-map and mapboard-server. Creates topology nicely from lines and centroid identity polygons.

Database persistence onClick of the `save` button.

Fixed Bug of dragging two points in same feature and 1+ of another feature. My mistake was overcomplicating the logic.

I have successfully isolated the fronted custom drawing modes. Now state is handled the "right" way. The `draw.update` logic is performed in the `directselect.onstop` method.

It looks like these coding clean-ups have also fixed the deleting points where shared bug that was occuring. But some odd behavior is causing me to leave it on bugs.

Created a `GET` endpoint on top of a view table that joins `map_face` from `map_topology` schema onto the identity polygons and then the column properties table. Renders in the frontend as a geojson layer in mapbox, shade is determined by if the column has an identity.

Clicking on shaded column brings a popup that has some basic info about the column.

06/03/2021:
Fixed the identity polygon bug, instead of using centroid use `ST_PointOnSurface`. It returns the "visual center" of a polygon much like the point of unaccessability.

Polygons are automatically added to map_face table without an identity polygon being set. New polygons can be created using the line tool.

Enhanced frontend with blueprint components. Nav bar buttons allows for saving and toggling between property and edit modes.

Property editing works! Uses `ModelEditor` component from ui-components.

Frontend component for if a polygon has two identities is around. Lists them as cards and you can choose which one.

07/02/21:

Multiple projects exist in the database as separate schemas and linked topologies using a config file for each project and a passing the project_id and config to a database class instance. The config is also passed to the docker container through a subprocess so the map topology can resolve the correct schema.

Frontend WIP, click and add polygon. For now it just adds a box. Can become much more sophisticated to sense polygons around it and attach to their vertices if they're close by.

07/13/21:

Can swtich between projects through navbar and open import dialog. Import dialog has more info including all of the available projects in macrostrat.

`change_set_clean` function for backend works much better now.

Projects table in database holds project name and description.

Slightly better U.I with more info in the import overlay

Helper Project class created to make passing project attributes around easier

08/02/21:

Frontend context has more robust architecture. A async runActions allows for side-effects like fetching data
in an async method while also passing off the dispatch for the rest of the app reducer. Things are simplified and standardized through types as well.

Backend Project and Database class have some new methods to make it easier for creating a new project.

Can now successfully create blank new projects through the frontend.

08/20/21:

Deleting shared nodes now works and doesn't break the frontend.

Backend `clean_changeset` function works much better now after some additional fixes.

MAJOR FEATURE ADDITION:

- The ability to view, assign, and create `col_groups` and `col_group_names`.

onClick highlight of column in property view.

A color coded legned for column info.

feedback on create new project and import

09/01/21:

Can add a known geometry by pasting either geojson or wkt into text box.

Map legend for column-groups

09/13/21:

Column-groups are now project specific.

Frontend and Backend are Dockerized

11/23/21:

Frontend and sql queries adjusted to allow for `multilinestrings`. Dragging points
together uses more internal Mapbox-gl-js-draw methods now, consequently dragging is
more effecient and works better.

The `SnapLineMode` creates valid multiline strings. Now when using the tool if you snap to a non-vertix point on an existing line, it creates a vertix on that line at that position. This makes creating columns easier and more effcient.

12/27/21:

Backend:

- `clean_change_set` function is more efficient.

Frontend:

- U.I enhancements: Remodeled navbar and main overlay. About tab has short 'how to' section. Property dialog is draggable.
- Increased the click-buffer when determining which features' points should be dragged, increasing drag reliability. Also,
when holding down the `shift` key while clicking on a vertex will ignore any dragging, allowing for un-linking vertices.
- Draw Polygon mode is much more enhanced. OnClick a n-sided polygon (hexagon by default) is created and mousemove will change
size of the polgyon. Pressing 'a' (add) and 's' (subtract) allow the user to add or subtract how many sides the n-sided polygon
has (minimum 3).

12/28/21:

Minro database schema change to allow for a description field and color field in columns and column_groups
respectively.

Users can add a description to any column via the properties dialog as well as add a color to a column group.
Column groups are now editable through the frontend.
### Bugs:

Strange console error, `Cannot read property 'getSelectedIds' of null`, on stopDragging event

- This occurs during the onTouchEnd and onMouseUp in the custom direct_select
- During the `this.fireUpdate()`

### Next Steps/ Wanted Features:

__POINTS MODE__: I want the functionality to see and change the location of the idenitity points. Could be a toggle.

Backend workflow to remove an identity polygon when there are two for an geometry.

- Rounding of points, to 4 spots

- Will include all geometries and identity polygons as point
- for that `ST_Centroid` will work because the identity polygons are symmetrical.

Maybe have the ability to teselate polygons into n internal polygons.

Burwell Layer

Highlight lines on snap, on Join

eODP -- drill hole points, polygons aren't showing up. Perhaps render the centroid as a point.

Feedback on import and create new project should catch errors and display them

Download individual columns, column-groups and selected columns (multiple)
31 changes: 31 additions & 0 deletions services/column-footprint-editor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ghcr.io/davenquinn/geologic-map:latest

## use https://linuxize.com/post/how-to-install-python-3-9-on-debian-10/
RUN apt update -y \
&& apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev \
&& wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz \
&& tar -xf Python-3.9.1.tgz \
&& cd Python-3.9.1 && ./configure --enable-optimizations \
&& make -j 2 && make altinstall \
&& update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1 \
&& apt install -y python3-pip

## before running pip we need to change the first line in lab_release
## #!/usr/bin/python3.5 -Es
RUN sed -i "1 s/3/3.5/g" /usr/bin/lsb_release

COPY requirements.txt ./requirements.txt

RUN python3 -m pip install -r ./requirements.txt


COPY . /python_app
RUN ["chmod", "+x", "/python_app/docker-scripts/run"]

ENV GEOLOGIC_MAP_CONFIG=/app/docker-assets/docker-map-config.json

EXPOSE 3006
EXPOSE 8000

#CMD ["cd","/python_app","&&","python3", "__init__.py"]
CMD /python_app/docker-scripts/run
21 changes: 21 additions & 0 deletions services/column-footprint-editor/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Casey Idzikowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions services/column-footprint-editor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
serve:
uv run uvicorn macrostrat.column_footprint_editor:app --host 0.0.0.0 --port 8002 --reload
#cd postgis-geologic-map && docker-compose up && cd .. & python3 backend/__init__.py

kill:
kill -9 $(lsof -i TCP:8000 | grep LISTEN | awk '{print $2}')

run dev:
docker-compose -f dev.yaml up --build
# command to kill the app on port 8000

27 changes: 27 additions & 0 deletions services/column-footprint-editor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Topology Editing

## NOTE: This now depends upon a microservice in [this](https://github.com/UW-Macrostrat/column-builder/tree/develop) repository. It will no longer run independently.

### Introduction:

Column-Topology is an application that is aimed at editing GeoJSON polygons **_while_** keeping topology. This application is being developed under the [UW-Macrostrat](https://macrostrat.org/) lab group.

This application will hopefully be a column management system for footprint geometries for strategraphic columns.

### Motivation:

The Macrostrat group keeps track of sedimentary columns around the world and a U.I interface for editing and creating new columns, in the form of GeoJSON polygons, is needed. An easy to use interface that allows users to create and edit their topologies would help expand the macrostrat database and increase community unification.

### Strategy:

Most of the work has been done on the client side (javascript). The frontend is made using React js with vanilla javascript as well. For the map I am using [Mapbox-gl](https://github.com/mapbox/mapbox-gl-js) and for GeoJSON rendering I am using [Mapbox-gl-draw](https://github.com/mapbox/mapbox-gl-draw). Conceptually, I am thinking about it as lines instead of polygons. In a topology, polygons share sides, which is why in topojson they remove redundant coordinates. Here I think about it similiarly. All the sides of a polygon turn in lines. Then all you need to do is drag the vertices around.

### Goals:

Create a column version management system. Similar to git... Have a "compare" view to view two topology versions sideby side or on top. Metadata descriptions about project being edited.. Total area of polygons.

Have a info panel at top: what project, total area of polygons.

Some component that shows the change_set with maybe the ability to undo them.

Ability to switch between different projects and maybe even different drafts of projects.
14 changes: 14 additions & 0 deletions services/column-footprint-editor/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import logging

from dotenv import load_dotenv

disable_loggers = ["macrostrat.database.utils"]


def pytest_configure():
# Quiet verbose logging
for logger_name in disable_loggers:
logger = logging.getLogger(logger_name)
logger.disabled = True

load_dotenv()
31 changes: 31 additions & 0 deletions services/column-footprint-editor/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.7"
services:
db:
# PostgreSQL 13 is needed in order to allow force-dropping the database
# (in testing mode)
image: postgis/postgis:13-3.1
environment:
- POSTGRES_DB=geologic_map
# This allows connections without a password, which is expedient but insecure...
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- "5432:5432"
expose:
- 5432
volumes:
- db_cluster:/var/lib/postgresql/data
frontend:
build: ./frontend
ports:
- "1234:3000"
backend:
build: "column_footprint_editor"
entrypoint: "/python_app/docker-scripts/run"
environment:
- GEOLOGIC_MAP_CONFIG=/app/docker-assets/docker-map-config.json
ports:
- "40053:8000"
expose:
- "8000"
volumes:
db_cluster:
3 changes: 3 additions & 0 deletions services/column-footprint-editor/docker-scripts/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python3 ../python_app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pychache__/
*.pyc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .api import app # noqa
from .database import Database # noqa
Loading