Skip to content

Quadtree: prevent infinite insert/refine recursion - #122

Merged
jteresco merged 3 commits into
TravelMapping:masterfrom
yakra:StarRoad
Nov 7, 2018
Merged

Quadtree: prevent infinite insert/refine recursion#122
jteresco merged 3 commits into
TravelMapping:masterfrom
yakra:StarRoad

Conversation

@yakra

@yakrayakra commented Nov 5, 2018

Copy link
Copy Markdown
Contributor

aln.starrd.wpt was specifically designed to:

  • look pretty in wptedit, and
  • break the WaypointQuadtree insert/refine process.

Running it thru siteupdate.py, I get a ton of

 File "./siteupdate.py", line 72, in refine
self.insert(p)
File "./siteupdate.py", line 92, in insert
self.ne_child.insert(w)
File "./siteupdate.py", line 81, in insert
self.refine()

scrolling off the top of my terminal window, until finally,

 File "./siteupdate.py", line 65, in refine
self.nw_child = WaypointQuadtree(self.mid_lat,self.min_lng,self.max_lat,self.mid_lng)
RecursionError: maximum recursion depth exceeded
[0.3] Finding unprocessed wpt files.

followed by some more normal-looking output, then

[2.4] Performing data checks...Traceback (most recent call last):
File "./siteupdate.py", line 2990, in <module>
if r.point_list[0].is_hidden:
IndexError: list index out of range

I've modified the WaypointQuadtree so that each node can contain up to 50 unique locations, rather than 50 points.

@jteresco

Copy link
Copy Markdown
Contributor

I like this. Ready to merge and go to production?

@yakra

yakra commented Nov 6, 2018

Copy link
Copy Markdown
ContributorAuthor

I believe so.

Just for fun:
As of HighwayData@a46d6d9,
Total number of Quadtree nodes: 62237 -> 42725
Number of bottom-level nodes, containing waypoints: 46678 -> 32044

@yakra

yakra commented Nov 6, 2018

Copy link
Copy Markdown
ContributorAuthor

Oops, I goofed on a couple changes to is_valid, and didn't notice because the only call to it is commented out. Will add another commit shortly.

@yakra

yakra commented Nov 6, 2018

Copy link
Copy Markdown
ContributorAuthor

I believe again that it's ready.

@yakra

yakra commented Nov 6, 2018

Copy link
Copy Markdown
ContributorAuthor

@jteresco, does any info from/or about the quadtree get put into the DB, into the .sql file?
Anything to watch out for there?

@jteresco

Copy link
Copy Markdown
Contributor

No, it's gone when the site update process ends. Entirely to make searches by coordinates a lot more efficient.

@jteresco
jteresco merged commit 6d36759 into TravelMapping:masterNov 7, 2018
@yakra
yakra deleted the StarRoad branch November 7, 2018 02:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@yakra@jteresco