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

Code for finding SpatiaLite in the usual locations #135

Closed
simonw opened this issue Aug 21, 2020 · 3 comments
Closed

Code for finding SpatiaLite in the usual locations #135

simonw opened this issue Aug 21, 2020 · 3 comments
Labels
enhancement New feature or request spatialite

Comments

@simonw
Copy link
Owner

simonw commented Aug 21, 2020

I built this for shapefile-to-sqlite but it would be useful in sqlite-utils too:

https://github.com/simonw/shapefile-to-sqlite/blob/e754d0747ca2facf9a7433e2d5d15a6a37a9cf6e/shapefile_to_sqlite/utils.py#L16-L19

SPATIALITE_PATHS = (
    "/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
    "/usr/local/lib/mod_spatialite.dylib",
)

https://github.com/simonw/shapefile-to-sqlite/blob/e754d0747ca2facf9a7433e2d5d15a6a37a9cf6e/shapefile_to_sqlite/utils.py#L105-L109

def find_spatialite():
    for path in SPATIALITE_PATHS:
        if os.path.exists(path):
            return path
    return None
@simonw simonw added the enhancement New feature or request label Aug 21, 2020
@simonw
Copy link
Owner Author

simonw commented Aug 21, 2020

https://github.com/simonw/cryptozoology/blob/2ad69168f3b78ebd90a2cbeea8136c9115e2a9b7/build_cryptids_database.py#L16-L22

try_these = (
    "mod_spatialite",
    "/usr/local/lib/mod_spatialite.dylib",
    "/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
    "/usr/lib/x86_64-linux-gnu/libspatialite.so.5",
    "/usr/lib/x86_64-linux-gnu/libspatialite.so.7",
)

@simonw
Copy link
Owner Author

simonw commented Aug 21, 2020

I'm going to start with just the first two - I'm not convinced I understand the .so.5 variants.

@simonw simonw closed this as completed in bf4c6b7 Aug 21, 2020
simonw added a commit that referenced this issue Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spatialite
Projects
None yet
Development

No branches or pull requests

1 participant