测量不规则多边形的Andr​​oid地区

编程入门 行业动态 更新时间:2024-10-25 22:34:28
本文介绍了测量不规则多边形的Andr​​oid地区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我开发一个应用程序中,我有画,我用的是不是谷歌地图和地图的多边形,其Mapsforge开源的离线地图library.i很容易地通过转换的GeoPoint成pixcel point.but这里绘制多边形地图我想找到是不规则的多边形,以及,我有使大量的尝试,但它让我不成功.. 我曾尝试与计算面积基本数学运算,但它不是在这种情况下工作是案例pixcel是变革accodingly而改变缩放级别。 这里是数学逻辑: 数学计算

的(INT miAreainc = 0; miAreainc< x.length-1; ​​miAreainc ++)                  {                      SUMX + =×〔miAreainc] * Y [miAreainc + 1];                      苏梅+ = Y [miAreainc] * X [miAreainc + 1];                  }                  INT单元=((SUMX - (SUMY))/ 2);                  AppLog.showLogE(TAG,单元>>中+单位);

我发现funcation留在服务器端从GeoPoint对象数组获得区,但在这里,我要下线做出来。 我已经试过到目前为止,但没有得到任何线索或结果.. 请大家帮我出这个.. 谢谢

解决方案

注意:我真的不知道该怎么愚蠢的我回答是。所以,请让我知道,如果它没有任何意义,我会删除它。

由于地图不直角坐标系,你的计算将不会产生准确的结果。您需要球面三角获得的球面多边形这是不平凡的。

有一个在计算地球表面围了任意多边形区域了很好的讨论。一起来看看。

但是,除了所有这些,我已经找到 Projection.java 在 mapsforge 其中有一个方法来查找绝对像素

:从的GeoPoint 在特定缩放级别的坐标在世界地图上   

把特定的{@link的GeoPoint}绝对像素坐标上   世界地图。

点尖山(GeoPoint对象中,点出,字节当zoomLevel =);

我不是一个真正懂行的,但我认为它会给你绝对的GeoPoint 的上投射地图坐标,所以你可以用直角坐标计算。

I am developing one application in which i have draw the polygon on map and map that I have used is not google,Its Mapsforge opensource offline map library.i have easily draw polygon on map by converting geopoint into pixcel point.but here i want to find are of that irregular polygon,and for that i have make lots of try but its getting me unsuccess.. I have tried with calculate area with basic Math but its not working in this case be case pixcel are change accodingly while change zoom level. Here is Math logic : Math calculation

for(int miAreainc = 0;miAreainc < x.length-1; miAreainc++) { sumX += x[miAreainc] * y[miAreainc + 1]; sumY += y[miAreainc] * x[miAreainc + 1]; } int unit = ((sumX - (sumY)) / 2); AppLog.showLogE(TAG,"UNIT >> " + unit);

I found that funcation stay at server side which get area from geopoint array,but here I want to make it offline. I have tried so far but not getting any clue or result .. Please help me out this.. Thanks

解决方案

Note: I don't really know how stupid my answer is. So please let me know if it doesn't make sense and I'll delete it.

Since the map is not in Cartesian Coordinate System, your calculation will not yield accurate result. You need Spherical Trigonometry for Spherical Polygon which is not trivial.

There is a good discussion at Calculating area enclosed by arbitrary polygon on Earth's surface. Take a look.

But apart from all of these, I have found Projection.java in mapsforge which has a method to find the absolute pixel coordinates on the world map from GeoPoint at a specific zoom level:

Translates the given {@link GeoPoint} to absolute pixel coordinates on the world map.

Point toPoint(GeoPoint in, Point out, byte zoomLevel);

I'm not really knowledgeable, but I think it will give you the absolute coordinate of GeoPoint on a projected map so you can use Cartesian calculation.

更多推荐

测量不规则多边形的Andr​​oid地区

本文发布于:2023-07-27 16:08:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1223313.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多边形   不规则   测量   地区   oid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!