我有一个问题让我在某些项目中停滞了一段时间。
我基本上希望使用我编写的某些脚本绘制的 x、y 点来捕获多边形。纬度、经度是多边形的中心 GPS 线,我正在寻找其周围的多边形。
这是我的Python代码的一部分:
def getcords(lat, lon, dr, bearing):
lat2=asin(sin(lat)*cos(dr)+cos(lat)*sin(dr)*cos(bearing))
lon2=lon+atan2(sin(bearing)*sin(dr)*cos(lat),cos(dr)-sin(lat)*sin(lat2))
return [lat2,lon2]
Run Code Online (Sandbox Code Playgroud)
我的输入是这样的:
但是对于输入:
getcorsds1(42.189275, -76.85823, 0.5/3958.82, 30)
Run Code Online (Sandbox Code Playgroud)
我得到输出: [-1.3485899508698462, -76.8576637627568],但是这[42.2516666666667, -76.8097222222222]是正确的答案。
至于角距离,我简单地通过将英里距离除以地球半径(= 3958.82)来计算。
有人吗?
我一直在使用geopy包,它做得很好,但是我得到的一些结果不一致或者有一个相对大的位移,我怀疑问题在于我的轴承计算:
def gb(x,y,center_x,center_y):
dx=x-center_x
dy=y-center_y
if ((dy>=0)and((dx>0)or(dx<0))):
return math.degrees(math.atan2(dy,dx))
elif (dy<=0)and((dx>0)or (dx<0)):
return (math.degrees(math.atan2(dy,dx))+360)
else:
return (math.degrees(math.atan2(dy,dx))+360)%360
Run Code Online (Sandbox Code Playgroud)
我需要计算轴承,st center_x和center_y是枢轴.之后我使用geopy对gps坐标进行逆向工程:
latlon = VincentyDistance(miles=dist).destination(Point(lat1, lon1), bearing)
Run Code Online (Sandbox Code Playgroud)
谁能指出我可能做错了什么?
我想重新创建UI功能,例如新的G +应用程序,或者在标题图片上庄严地调用视差效果的airbnb界面.我的应用程序在不同的约束条件下使用(两个)ListView和Gridview,我正在浏览@CFlex 教程以重新创建它但无法实现效果.
Main.axml:
namespace ParallaxTest
{
[Activity(Label = "ParallaxTest", MainLauncher = true, Icon = "@drawable/icon")]
public class ParallaxTest : Activity, AbsListView.IOnScrollListener
{
int count = 1;
public GridView _gridView;
public CustomImageView _imageView;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
_gridView = new GridView(this)
{
VerticalFadingEdgeEnabled = false,
LayoutParameters =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.MatchParent),
CacheColorHint …Run Code Online (Sandbox Code Playgroud)