Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix to enable build using cx_freeze
- this is a small refactor so that tagmaps can still be run with new 5.01 cx_freeze - created package, installable with setuptools (e.g. dev mode) - separated cx_freeze setup - renamed generateTagClusters.py to __main__.py and added entrypoint accordingly for direct command line execution - moved utils to subfolder (classes), renamed references - moved main code to 'def main():', also added a number of globals where it was unavoidable with current setup - successfully tested build
- Loading branch information
1 parent
921a68d
commit 664939b
Showing
10 changed files
with
2,447 additions
and
2,326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,8 @@ graph.png | |
.vs/standalone_tag_cluster_hdbscan/v15/.suo | ||
|
||
.vs/ | ||
|
||
emojifile.txt | ||
|
||
tagmaps.egg-info | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
Tag Maps | ||
============= | ||
Spatio-Temporal Tag and Photo Location Clustering for generating Tag Maps | ||
|
||
**Tag Maps** are similar to Tag Clouds, but Tag Maps use the spatial information that is attached to geotagged photographs, in addition to tag frequency, to visualize tags on a map. | ||
This Library uses the single-linkage tree that is available from [HDBSCAN](https://github.com/scikit-learn-contrib/hdbscan) to cut trees at a specific user-defined distance for all available tags in the given dataset. | ||
Afterwards, Alpha Shapes are generated as a means to 'soft' placement of tags on a map, according to their area of use. Two Shapefiles are generated that can be used to visualize maps, for example, in ArcGIS. | ||
|
||
```diff | ||
- Please be advised: This repository contains, in its current form, | ||
- Python code that is very difficult to read or contribute to. | ||
- I intend to put more work into structuring code ...as soon as more time is available. | ||
``` | ||
|
||
![Tag Map Example](/resources/img6.png?raw=true) | ||
|
||
## Installation | ||
|
||
1. The easiest way for Windows users is to download the Pre-compiled build that is available [here](https://cloudstore.zih.tu-dresden.de/index.php/s/8EFfeJcpNCStQ9X/download) (315MB!) and run `generateTagClusters.exe` | ||
- you can also compile the program yourself using the `setup.py` with [cx_Freeze](https://anthony-tuininga.github.io/cx_Freeze/): run `python setup.py build` | ||
- or simple run `generateTagClusters.py` if you have Python and all dependencies installed | ||
2. Place geotagged photo data in `/01_Input` subfolder | ||
- example files/format are available in the Pre-compiled build zip-file above | ||
3. Output files will be saved in `/02_Output` (2 Shapefiles in WGS1984 projection, one containing all Tag Cluster and one with the Photo Location Clusters) | ||
4. Visualize Shapefiles using ArcGIS (I haven't tried other GIS Software such as QGIS, but it should theoretically be possible..) | ||
- download `BasemapLayout_World.mxd` from [resources folder](/resources/BasemapLayout_World.mxd) and replace missing links with 2 resulting Shapefiles in `/02_Output` | ||
- adjust minimum and maximum Font Sizes, Weighting Formula or other metrics to your needs. There are two Power Point files available which explain the complete process: [Tag Clustering](/resources/01_TagMaps.pptx) and [Photo Location Clustering](/resources/02_PhotoDensityMaps.pptx) | ||
|
||
## Code | ||
|
||
At the moment, the code is pretty messy. I wrote this in less than a week, without any other contributors in mind. I will work on this when there's more time available.. | ||
|
||
## Resources | ||
|
||
* Check out [this album on Flickr](https://www.flickr.com/photos/64974314@N08/albums/72157628868173205) with some more Tag Maps examples | ||
* There's also an semi-interactive interface to explore some Tag Maps [here](http://maps.alexanderdunkel.com/) | ||
* Check out my blog [here](http://blog.alexanderdunkel.com/) with some background information | ||
|
||
|
||
## Contributors | ||
|
||
* todo: future goals, extending scope of program beyond Flickr photo data (include Twitter & Instagram, for example) | ||
|
||
## Built With | ||
This project includes and makes use of several other projects/libraries/frameworks: | ||
|
||
>[*Alpha Shapes*](http://blog.thehumangeo.com/2014/05/12/drawing-boundaries-in-python/) Kevin Dwyer/ Sean Gillies | ||
>>Generating Concave Hull for Point Clouds | ||
>[*HDBSCAN*](https://github.com/scikit-learn-contrib/hdbscan) McInnes, J. Healy, S. Astels - BSD licensed | ||
>> A high performance implementation of HDBSCAN clustering. | ||
>[*Shapely*](https://github.com/Toblerity/Shapely) | ||
>> Manipulation and analysis of geometric objects | ||
>[*SciPy and Convex Hull*](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html#scipy.spatial.ConvexHull) | ||
>> Simple shapes for point clusters are generated using SciPy's excellent Convex Hull functions | ||
## License | ||
|
||
GNU GPLv3 | ||
|
||
## Changelog & Download | ||
|
||
2018-01-31: [**TagMaps v0.9.2**](https://cloudstore.zih.tu-dresden.de/index.php/s/8EFfeJcpNCStQ9X/download) | ||
|
||
* Because Tag Maps can be generated from local to regional to continental scale, finding an algorythm that fits all was not straight forward. The current implementation will produce shapes for all of these scales without any user input. | ||
* This Final Alpha Shape Implementation is motivated from [Kevin Dwyer/ Sean Gillies](http://blog.thehumangeo.com/2014/05/12/drawing-boundaries-in-python/) great base code | ||
* Implementation of Auto-Projection from Geographic to Projected Coordinate System. The code will select the most suitable UTM Zone for projecting data. | ||
|
||
2018-01-17: **TagMaps v0.9.1** | ||
|
||
* First build | ||
* Initial commit, still lots of unnecessary comments/code parts left in code | ||
|
||
[//]: # (Readme formatting based on https://gist.github.com/PurpleBooth/109311bb0361f32d87a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import sys | ||
from cx_Freeze import setup, Executable | ||
|
||
#Derive Package Paths Dynamically | ||
import os.path | ||
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) | ||
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6') | ||
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6') | ||
|
||
# Dependencies are automatically detected, but it might need fine tuning. | ||
#build_exe_options = {"packages": ["os"], "excludes": []} | ||
includes_mod = ["tkinter.filedialog", | ||
'numpy.core._methods', | ||
'numpy.lib.format', | ||
'matplotlib.backends.backend_tkagg', | ||
'seaborn', | ||
'seaborn.cm', | ||
'scipy.sparse.csgraph', | ||
'argparse', | ||
'scipy.sparse.csgraph._validation' | ||
]#,'scipy.spatial.ckdtree' | ||
|
||
include_folders_files = ["C:/Python36/DLLs/tcl86t.dll", | ||
"C:/Python36/DLLs/tk86t.dll", | ||
'tagmaps/01_Input/', | ||
'tagmaps/00_Config/', | ||
'00_generateClusters_OnlyEmoji.cmd', | ||
'00_generateClusters_OnlyPhotoLocations.cmd', | ||
'00_generateClusters_OnlyTags.cmd', | ||
("D:/03_EvaVGI/05_Code/Py/standalone_tag_cluster_hdbscan/tagmaps/matplotlibrc","matplotlibrc") | ||
] | ||
packages_mod = ["tkinter", "hdbscan"] | ||
excludes_mod = ["scipy.spatial.cKDTree"] | ||
|
||
|
||
|
||
# GUI applications require a different base on Windows (the default is for a | ||
# console application). | ||
base = None | ||
#base = "Console" | ||
#if sys.platform == "win32": | ||
# base = "Win32GUI" | ||
|
||
executables = [ | ||
Executable('tagmaps/__main__.py', base=base) | ||
] | ||
|
||
setup( name = "tagmaps", | ||
version = "0.9.3", | ||
description = "Tag Clustering for Tag Maps", | ||
options = {'build_exe': {'includes': includes_mod, 'include_files': include_folders_files,'packages':packages_mod,'excludes':excludes_mod}}, | ||
executables = executables) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,27 @@ | ||
import sys | ||
from cx_Freeze import setup, Executable | ||
|
||
#Derive Package Paths Dynamically | ||
import os.path | ||
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) | ||
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6') | ||
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6') | ||
|
||
# Dependencies are automatically detected, but it might need fine tuning. | ||
#build_exe_options = {"packages": ["os"], "excludes": []} | ||
includes_mod = ['numpy.core._methods', | ||
'numpy.lib.format', | ||
'matplotlib.backends.backend_tkagg', | ||
'seaborn', | ||
'seaborn.cm', | ||
'scipy.sparse.csgraph', | ||
'argparse', | ||
'scipy.sparse.csgraph._validation', | ||
]#,'scipy.spatial.ckdtree' | ||
|
||
include_folders_files = ["C:/Python36/DLLs/tcl86t.dll", | ||
"C:/Python36/DLLs/tk86t.dll", | ||
'tagmaps/01_Input/', | ||
'tagmaps/00_Config/', | ||
'00_generateClusters_OnlyEmoji.cmd', | ||
'00_generateClusters_OnlyPhotoLocations.cmd', | ||
'00_generateClusters_OnlyTags.cmd', | ||
("D:/03_EvaVGI/05_Code/Py/standalone_tag_cluster_hdbscan/tagmaps/matplotlibrc","matplotlibrc") | ||
] | ||
packages_mod = ["tkinter", "tkinter.filedialog"] | ||
excludes_mod = ["scipy.spatial.cKDTree"] | ||
# -*- coding: utf-8 -*- | ||
|
||
from setuptools import setup | ||
import sys | ||
|
||
|
||
# GUI applications require a different base on Windows (the default is for a | ||
# console application). | ||
base = None | ||
#base = "Console" | ||
#if sys.platform == "win32": | ||
# base = "Win32GUI" | ||
|
||
executables = [ | ||
Executable('tagmaps/generateTagClusters.py', base=base) | ||
] | ||
|
||
setup( name = "generateTagClusters", | ||
with open('README.md') as f: | ||
long_description = f.read() | ||
|
||
|
||
## setuptools dev | ||
setup( name = "tagmaps", | ||
version = "0.9.3", | ||
description = "Tag Clustering for Tag Maps", | ||
options = {'build_exe': {'includes': includes_mod, 'include_files': include_folders_files,'packages':packages_mod,'excludes':excludes_mod}}, | ||
executables = executables) | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
author='Alexander Dunkel', | ||
author_email='alexander.dunkel@tu-dresden.de', | ||
url='https://gitlab.vgiscience.de/ad/TagCluster', | ||
license='GNU GPLv3 or any higher', | ||
packages=['tagmaps'], | ||
install_requires=[ | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'tagmaps = tagmaps.__main__:main' | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from .hdbscan_ import HDBSCAN, hdbscan | ||
from .robust_single_linkage_ import RobustSingleLinkage, robust_single_linkage | ||
from .validity import validity_index | ||
from .prediction import approximate_predict, membership_vector, all_points_membership_vectors | ||
|
||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from .classes.utils import Utils |
Oops, something went wrong.