Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTableAccessor: Inserting geometry values into tables #34

Open
AL89 opened this issue Apr 18, 2024 · 0 comments
Open

DataTableAccessor: Inserting geometry values into tables #34

AL89 opened this issue Apr 18, 2024 · 0 comments

Comments

@AL89
Copy link

AL89 commented Apr 18, 2024

Hi

I like the idea of this library to access certain things of the M+ database. And furthermore to insert data into it.

However, I was wondering how you insert spatial data into the M+ database for the data tables that contains geometric features, e.g. msm_Node, msm_Catchment, msm_Link etc.? How do you link the coordinates the each individual feature?

From the example that comes from the DataTableAccessor notebook, I would like to add another field that contains the geometric values (i.e. coordinates for upstream and downstream nodes). I mean, which format do I write this in? Should I convert it to shapely.geom objects, a WKT/WKB string, or what?

from mikeplus import DataTableAccess
data_access = DataTableAccess("../tests/testdata/Db/Sirius/Sirius.sqlite")
data_access.open_database()

values = {'Diameter': 2.0, 'Description': 'insertValues','geometry':LINESTRING(0 0, 1 1)} # <- added another field for 'geometry' with WKT geometry type
data_access.insert("msm_Link", "link_test", values)

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant