You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was creating some documentation for our streets API, and I noticed a pretty obvious and easy to correct inefficiency in how we are doing it. The relevant parts of the algorithm basically look like...
for every street s:
for every clustered attribute c:
create a jts Point object from the c's latitude and longitude, Point(c)
if the Point(c) is within 10 meters of s:
increase cluster count for s
But we could easily just create the Point objects for all of the attributes just once, instead of for every street. I imagine that this could have a pretty big overhead if we are using this on a large area. It should look like this...
for every clustered attribute c:
create a jts Point object from the c's latitude and longitude, Point(c)
for every street s:
for every Point(c):
if Point(c) is within 10 meters of s:
increase cluster count for s
I can only assume that we do this for the neighborhoods API as well, but it shouldn't be as big of a deal there since a city generally has 10's of neighborhoods but 1000's of streets.
FYI I'm looking at the computeAccessScoresForStreets() function in ProjectSidewalkAPIController.scala.
The text was updated successfully, but these errors were encountered:
Can every label only be assigned to one street? If so, can we do something like:
for every clustered attribute c:
create a jts Point object from the c's latitude and longitude, Point(c)
for every Point(c):
for every street s:
if Point(c) is within 10 meters of s:
increase cluster count for s
break
to further increase performance? Or do we need to loop through every single point for every street?
Although we could assign each label to a single street (in fact, there is a street_edge_id column in the label table), I think that for this situation, it makes more sense to include labels on multiple streets. This primarily is about intersections, where curb ramps (or lack thereof) impacts all streets at the intersection, so it makes sense to count them for multiple streets.
Brief description of problem/feature
I was creating some documentation for our streets API, and I noticed a pretty obvious and easy to correct inefficiency in how we are doing it. The relevant parts of the algorithm basically look like...
But we could easily just create the Point objects for all of the attributes just once, instead of for every street. I imagine that this could have a pretty big overhead if we are using this on a large area. It should look like this...
I can only assume that we do this for the neighborhoods API as well, but it shouldn't be as big of a deal there since a city generally has 10's of neighborhoods but 1000's of streets.
FYI I'm looking at the
computeAccessScoresForStreets()
function inProjectSidewalkAPIController.scala
.The text was updated successfully, but these errors were encountered: