Group Abstract Group Abstract

Message Boards Message Boards

How can I make GraphDistance and FindShortestPath work with Quantities?

Posted 3 years ago

I am creating a local street map from OSM data. I have represented the street network as a weighted graph. The weight of an edge is its geographical length, expressed as a Quantity with Unit="Meters". The plan was to use GraphDistance to find shortest routes. I assumed quantities such as distances would be acceptable as weights for this purpose. It seem such an obvious requirement in any GIS application. But I can't make GraphDistance work with anything other than numbers. Same goes for FindShortestPath. Is there a way to make GraphDistance work with quantities? Obviously I could cast the quantities into pure numbers and then back to quantities, but that is inelegant, a potential source of error, and against all my instincts!

POSTED BY: Tony Durham
2 Replies

I would recommend storing the weights as just the quantity magnitudes without the Quantity wrappers

POSTED BY: Jason Biggs
Posted 3 years ago
POSTED BY: Tony Durham
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard