多个纬度/长度坐标到英里

时间:2016-03-16 14:41:46

标签: matlab latitude-longitude

我有几个x,y坐标,我想得到的区域。我认为最好的做法是将X,Y小数点坐标转换为海里,然后进行多边形区域。我已经用Google搜索过了,但是我找不到任何对我的问题有帮助的东西。没有找到答案,但我只是想知道如何处理这个以及可能用于转换的内容。

这些是数组中的坐标:

    Lat_Long = [60.8427194, -042.7969500; ...

                60.8646972, -042.5323889; ...

                60.7640417, -042.5178639; ...

                60.5882139, -042.8185056; ...

                60.8080111, -042.8507500; ...

                60.8069889, -042.8374167; ...

                60.8083028, -042.8278361; ...

                60.8114056, -042.8186167; ...

                60.8152306, -042.8117389; ...

                60.8203694, -042.8055667; ...

                60.8256528, -042.8013611; ...

                60.8315167, -042.7985083; ...

                60.8374056, -042.797078; ...

                60.8427194, -042.7969500];

1 个答案:

答案 0 :(得分:0)

如果该区域的直径不超过几公里(如果坚持则为英里),那么

1)将坐标转换为x,y空间,单位为米 2)使用简单的公式f = 40 000 000 / 360. // or use a more exact value using the WGS84 equitorial radius

for 1):将lat和long以单位度数转换为米,乘以因子

x = longitude * f;
y = latitdue * f

(以米为单位的地球环形围栏360度)

所以

x= x * cos(toRadians(averageLatitude));

加上x与cos(averageLatitude)相乘,这消除了lat和lon具有相同比例的事实(在赤道上,两度经度之间的距离是aproxx 111km,而在北极上它是0。 / p>

let schoolObjectIdQuery = PFQuery(className:"Schools")
        schoolObjectIdQuery.whereKey("school_name", equalTo: "\(PFUser.currentUser()!.objectForKey("school_name")!)")

        let query = PFQuery.orQueryWithSubqueries([schoolObjectIdQuery])

        query.findObjectsInBackgroundWithBlock({ (results: [PFObject]?, error: NSError?) -> Void in

            if let objects = results {

                for object in objects {

                    let schoolObjectId = object.objectId!

                    //////////////////

                    let classInfo = PFObject(className: "Classes")

                    classInfo.setObject(className!, forKey: "class_name")
                    classInfo.setObject(teacherName!, forKey: "teacher_name")
                    classInfo["school"] = schoolObjectId

                    classInfo.saveInBackgroundWithBlock({ (success:Bool, error:NSError?) -> Void in

                        if error != nil {

                            spinningActivity.hideAnimated(true)

                            self.displayAlert("Error", message: error!.localizedDescription)

                            print(error?.localizedDescription)        
                        }
                        else if success {

                            spinningActivity.hideAnimated(true)

                            self.dismissViewControllerAnimated(true, completion: nil)        
                        }
                        else {

                            self.displayAlert("Something Went Wrong", message: "Please try again")               
                        }
                    })  
                }  
            }
        })

结果是面积为平方米。

averageLatitude是该区域所有纬度坐标的平均值