TransWikia.com

Getting scipy.cKDTree to return everything with a given meter radius

Geographic Information Systems Asked by HeardEmSay on April 28, 2021

I want to find everything within a 0.1 meter radius.
I’m confused on exactly how query_ball_point is getting distance. I’m using decimal degree coordinates when creating the cKDTree, ie. [(-73.52610659993773, 40.99738620279574), (-73.52610659993992, 40.99738620279341), etc].

This currently works in my real life use cases but it was just testing different numbers until it did. I read the cKDTree documentation and I’m having a hard time understanding how it’s getting the distance and how different units come into play. I feel like I might be overthinking this but was hoping someone could give some clarity for someone with no understanding of geography.

new_tree = spatial.cKDTree(decimal_degree_coords)
found_points = new_tree.query_ball_point(check_feature, .00001)

One Answer

These coordinates are in decimal degrees. Therefore, you must calculate the decimal degree equivalent of 0.1 meter on Earth. If we assume the radius of Earth is 6370 km, then 0.1 m approximately equals to 0.0000009 degree.

found_points = new_tree.query_ball_point(check_feature, .0000009)

Answered by Kadir Şahbaz on April 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP