Giter VIP home page Giter VIP logo

chinese-postman's People

Contributors

peternowee avatar rkistner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chinese-postman's Issues

Slightly off topic - CRS?

I noticed the update to the code here to notify the user to check the CRS in QGis. Indeed, I am getting very very small numbers for my "km" lengths. I believe from my reading that these are degrees instead of distance units. I have tried reprojecting my vector layer of OSM streets/trails, but nothing changes. QGis 2.12 reports "CRS was undefined: defaulting to EPSG:4326/ WGS 84. Any tips on how to get a reasonably accurate distance from the plugin? I selected "Use Project CRS" under "CRS for new layers" in the preferences with also no improvement.

On another note - any interest in a solver for the Windy Chinese Postman problem? ;) The 2 different edge weights could be total elevation gain along that segment in that direction, or total gain per distance traveled, or similar, for a route optimization taking into account more than just distance!

Thanks!

Error postman.py

python postman.py --csv path.csv --gpx path.gpx --png path.png test_graph.csv
Traceback (most recent call last):
File "postman.py", line 379, in
make_png(graph, args.png.name)
File "postman.py", line 99, in make_png
subprocess.call(['neato', '-n2', '-Tpng', '-o', path, dfile])
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Cannot import gcd from fractions

Hi,

I'm running into an import error. Here's the log:

ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py) 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/__init__.py", line 34, in classFactory
    from .chinesepostman import ChinesePostman
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/chinesepostman.py", line 27, in 
    from . import postman
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/postman.py", line 18, in 
    import networkx as nx
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/lib/networkx-1.7-py2.7.egg/networkx/__init__.py", line 76, in 
    import networkx.algorithms
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/lib/networkx-1.7-py2.7.egg/networkx/algorithms/__init__.py", line 11, in 
    from networkx.algorithms.dag import *
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/lib/networkx-1.7-py2.7.egg/networkx/algorithms/dag.py", line 2, in 
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)


Version de Python : 3.10.7 (main, Mar 10 2023, 10:47:39) [GCC 12.2.0] 
Version de QGIS : 3.30.1-'s-Hertogenbosch 's-Hertogenbosch, 447e8d717a 

Chemin Python :
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/LAStools
/usr/share/qgis/python
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/jeremy/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/ext_libs
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/mmqgis/forms
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis2web
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/home/jeremy/carto/carto-ndls_hors-ligne/2023
/home/jeremy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/lib/networkx-1.7-py2.7.egg

Unable to install plugin in QGIS 3.14.0-Pi

Following instructions with zip install. Ran bundle.sh and attempted to install resulting zip file with no success. I've tried modifying a few of the files but still have not gotten a successful install. Error output below:

File "/Users//Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/chinesepostman.py", line 37, in
from . import resources
ImportError: cannot import name 'resources' from 'chinesepostman' (/Users//Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/chinesepostman/init.py)

Python version: 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]
QGIS version: 3.14.0-Pi Pi, 9f7028fd23

Windy Chinese Postman

Just an idea... Would be cool to implement the "Windy" version of this problem - "solve the problem on a graph where the weight of an edge depends on the direction along which it is traveled". This is highly analogous to GIS applications where terrain is a factor rather than just distance. The weight in each direction could represent total elevation gain in that direction, or perhaps total gain per km.

Furthermore, as far as I can tell, there is no working implementation of this on the entire internet - only academic papers discussing algorithms. Once I get a little more free time I was going to take a crack at it, but I'm not truly a programmer, graph theory expert, or QGis power-user (see other open issue....). Perhaps with enough time and effort I can do it or at least help however.

failed by: AttributeError: 'generator' object has no attribute 'sort'

Hi, rkistner.

I'm trying to run the test but it report an error. Could you give me some help?
python version is 2.7.3. And I've installed networkx

Traceback (most recent call last):
File "postman_test.py", line 18, in test_postman
components = postman.graph_components(graph)
File "/home/wangrenyuan/renyuan/chinese-postman/postman.py", line 107, in graph_components
components.sort(key=lambda c: c.size(), reverse=True)
AttributeError: 'generator' object has no attribute 'sort'

Inaccurate results for trivial problems

In a trivial case, such as

Start Node, End Node, Segment Length
0,1,1000.0
1,2,1000.0
2,3,1000.0
3,4,1000.0
4,5,1000.0
5,6,1000.0
6,1,1000.0
7,8,1000.0
8,9,1000.0
9,0,1000.0
0,10,1000.0
10,11,1000.0
11,7,1000.0

The result given by the code is 11,7,8,9,0,1,6,5,4,3,2,1,0,10,11 (cost = 14000). However, there is a shorter path that, in fact, does not require to cover lines multiple times: 1,2,3,4,5,6,1,0,9,8,7,11,10,0 (cost = 13000).

problem1

icon.png

I can't find the file "icon.png" used by the script install.sh included from the file resources.qrc

Tips for using the Chinese Postman plugin

Hi,

I have successfully downloaded and installed the latest version of the Chinese Postman Plugin, but still could not get any results from it. I am currently planning activities for a future stratified random sampling demersal fish survey, and my goal is to evaluate alternative tracks connecting the 51 bottom trawls assuming constant cruise and trawl speeds. All tracks are included in a SHP file, and I could easily select them using the polygon tool. I cannot proceed any further, though, because I constantly get a python error connected to some graph files.
Best regards,

No module named resources

Under Linux Mint/Ubuntu, I can't install due to this error already mentioned in the icon issue.
What python package might this be? Would be nice to mention that in the docs, cause obviously its something not installed by default.

cant export from qgis

hi! i was testing this plugin, and altough i can visualize the cpp path, i cant export any file or data from qgis layer (csv,geojson, to postgres, shp, anyhow)

Untitled

why this may be? thanks.

AttributeError: 'set' object has no attribute 'items'

$ python postman.py --csv path.csv --gpx path.gpx test_graph.csv
Skipping input row 1
Traceback (most recent call last):
File "postman.py", line 355, in
paths = chinese_postman_paths(component, n=5)
File "postman.py", line 303, in chinese_postman_paths
matchings = find_matchings(odd, n)
File "postman.py", line 231, in find_matchings
for u, v in best_matching.items():
AttributeError: 'set' object has no attribute 'items'`

Turn-by-Turn?

Hey there - is there any way i can use the result to a service that provides turn by turn directions?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.