Code Monkey home page Code Monkey logo

Comments (12)

u7390 avatar u7390 commented on July 30, 2024

The following images show what I did with red lines going around the button I clicked. If there is more than 1 line going around, there is number on the left showing the order it was clicked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

from chinese-postman.

MgTheProgrammer avatar MgTheProgrammer commented on July 30, 2024

experiencing the same on macOS🥲

from chinese-postman.

MgTheProgrammer avatar MgTheProgrammer commented on July 30, 2024

experiencing the same on macOS🥲

turns out unlike I've read somewhere qgis does install it's own python interpter. I've run pip install --force-reinstall networkx==2.3 on the pip of the qgis python installation and got one step further!

I did encounter another issue though but thankfully it was an easy fix. qgis comes with python3.9 which has moved some function called gcd from a module named fractions to math. I've changed in a file named dag.py from fractions import gcd to from math import gcd and it seems like everything works now.

from chinese-postman.

michael-ts avatar michael-ts commented on July 30, 2024

@MgTheProgrammer How did you run the QGIS version of PIP? I tried running in from a Windows command prompt in the directory that pip.exe is installed in under QGIS, but get a fatal python error and no module named encodings.

from chinese-postman.

michael-ts avatar michael-ts commented on July 30, 2024

@MgTheProgrammer I also tried:

import pip
pip.main(['install', '--force-reinstall', 'networkx==2.3'])

But got tons of errors. Next I tried:

pip.main(['install', '--force-reinstall networkx==2.3'])

But this crashes QGIS (I opened, re-ran the import and called it again and it crashes every time)

Another thing I tried was running this from the QGIS python directory:

python -m pip install --force-reinstall networkx==2.3

But this failed with a message pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available following which it failed to download anything due to the missing ssl module.

from chinese-postman.

MgTheProgrammer avatar MgTheProgrammer commented on July 30, 2024

@michael-ts
Sadly I don't quite remember what I did. I imagine though that I ran pip using its directory (on Mac it probably looked like that:
/Applications/QGIS.app/Contents/MacOS/bin/pip3 install networkx==2.3).

I opened qgis now as you reminded me about this. And weirdly enough it doesn't work correctly, it gives me a path and concludes that its length is 0 km. I'm pretty sure last time I've played with it, it worked though. So I guess it's more related to something wrong with the input I give from qgis.

from chinese-postman.

MgTheProgrammer avatar MgTheProgrammer commented on July 30, 2024

Btw if what you are looking for is mostly an optimized route and less about specifically using it with qgis. This repo works without much effort from you as a user. It does give a bit less control but it's good enough imo.

from chinese-postman.

michael-ts avatar michael-ts commented on July 30, 2024

@MgTheProgrammer Thanks, I'm looking at this and it looks like it might be helpful at least until I can figure out how to get the QGIS plug-in working. I noticed a couple of issues which using QGIS may or may not solve:

  1. I accidentally deleted a segment in the middle of a road I wanted to follow (not sure why; apparently it tries to find the closest segment to the mouse and despite the segment it deleted being some distance away it must have been the closest) and couldn't figure out how to add it back, so all the clicking I had done so far was wasted. It seems to be a LOT of clicking as there are lots of tiny line segments making up a single stretch of road.

  2. There doesn't seem to be any way of specifying that you can take a segment if needed, but don't have to. In this case I had two disconnected networks of roads I wanted to reach in one trip, and it would be nice if it could find them minimal distance way to get between the two. But as soon as I the two networks became disconnected, the one not attached to my starting point was automatically erased.

from chinese-postman.

michael-ts avatar michael-ts commented on July 30, 2024

@MgTheProgrammer Also, it seems to be brute-forcing the solution. I thought there was a polynomial time solution; this isn't the travelling salesman problem...

from chinese-postman.

michael-ts avatar michael-ts commented on July 30, 2024

@MgTheProgrammer It's also not clear to me how to find the actual route... I downloaded the GPX file (was the only option offered). I tried to download it into Google Maps but it claimed (wrongly) that the GPX file was bad. I found a GPX to KML convertor but when I look at the route on the map it shows all the streets reached but I can't tell in what order to visit them. I found an online GPX editor and I can tell the route but only by dragging a slider and this would be a pain to try to manually transcribe into something like turn by turn directions. What method do you use?

from chinese-postman.

u7390 avatar u7390 commented on July 30, 2024

This is how I make the plugin work on a newly installed Fedora Workstation that have been updated, and have its graphic driver and related software installed.

After opening , I install the plugin.
f1

f2

f3

f4

f5

f6

f7

I somehow see the information about error.
f8

f9

I do something to pip.
pip install --upgrade pip
f10

f11

pip install --force-reinstall networkx==2.3
f12

f13

This is how i run QGIS Desktop.
f14

f15

f16

f17

I see there is still error and click there to see more information.
f18

f19

I can see above the line mentioning the Python version an error. Above that error I see it says it is in a file called dag.py in line 23.
f20

I click on the option to show hidden files and then go to that file so I can edit it.
f21

f22

f23

f24

f25

f26

f27

I click on the thing to shows the line number..
f28

f29

f30

I change the writing in line 23 to
from math import gcd
f31

I click on the thing that looks the letter x on the top right.
f32

f33

I run QGIS Desktop again and see that error is gone.
f34

f35

I click that so the hidden file is not shown anymore.
f36

f37

from chinese-postman.

jarvena avatar jarvena commented on July 30, 2024

Following modification to postman.py also fixes the error. nx.connected_component_subgraphs() is deprecated, thus causing the error.

def graph_components(graph):
    # The graph may contain multiple components, but we can only handle one connected component. If the graph contains
    # more than one connected component, we only use the largest one.
    components = list((graph.subgraph(c) for c in nx.connected_components(graph))) #list(nx.connected_component_subgraphs(graph)) <-- this is deprecated
    components.sort(key=lambda c: c.size(), reverse=True)

    return components

from chinese-postman.

Related Issues (18)

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.