我希望在地图上创建一个区域,并能够自动确定点(坐标)是否在该区域内。在本示例中,我使用整个美国的 geojson 文件和纽约市的坐标。
Geojson: https: //github.com/johan/world.geo.json
我已经阅读了 shapely 文档,只是不明白为什么我的结果返回 False。任何帮助将非常感激。
import json
from shapely.geometry import shape, GeometryCollection, Point
with open('USA.geo.json', 'r') as f:
js = json.load(f)
point = Point(40.712776, -74.005974)
for feature in js['features']:
polygon = shape(feature['geometry'])
if polygon.contains(point):
print ('Found containing polygon:', feature)
Run Code Online (Sandbox Code Playgroud)
我希望打印包含的坐标,但没有打印任何内容。
我已将 WordPress 连接到 Stripe,并希望在其 WordPress 管理用户页面中显示每个用户的 Stripe 事件历史记录。本质上,我想要在选择客户并单击“查看更多事件”时在 Stripe 管理中使用相同的视图,结果如下: https: //dashboard.stripe.com/test/events ?lated_object=cus_ ** ******
我无法在 Stripe API 文档中的任何地方找到解决此问题的方法,因此我当前正在尝试获取所有事件,然后返回属于当前客户的任何事件。这似乎不必要地复杂,所以我希望有更好的方法。谢谢您的帮助。
\Stripe\Stripe::setApiKey($stripe_api_key);
$stripe_customer = \Stripe\Customer::retrieve($stripe_customer_id);
$all_stripe_events = \Stripe\Event::all(['limit' => 10000]);
$event_data = $all_stripe_events->data;
foreach($event_data as $event) {
... compare every event against the current customer ...
}
Run Code Online (Sandbox Code Playgroud)