我想检查标记是否在多边形内部

时间:2018-04-21 11:29:19

标签: android google-maps

My Drawn Polygon Looks like this

我正在开发一个应用程序,我需要检查标记是否在内部多边形内,请帮助

我使用kml绘制了多边形,这是我的kml代码 这里我们在使用kml文件绘制的多边形内有一个多边形

phone_end

在地图活动中使用此代码..... 我已经在onMapready方法中调用了这段代码

  <Placemark>
  <name>The Pentagon</name>
   <Style>
     <LineStyle>
      <color>ff000000</color>
      <width>1</width>
     </LineStyle>
        <PolyStyle>
           <color>7FAAAAAA</color>
           <colorMode>normal</colorMode>
           <fill>1</fill>
           <outline>1</outline>
        </PolyStyle>
   </Style>
  <Polygon>
    <extrude>1</extrude>
    <altitudeMode>relativeToGround</altitudeMode>
    <outerBoundaryIs>
      <LinearRing>
        <coordinates>
      76.983235,29.701373
      84.695638,29.529453
      84.994154,21.640226
      75.982685,21.582447
      77.287795,21.813425
        </coordinates>
      </LinearRing>
    </outerBoundaryIs>

    <innerBoundaryIs>

      <LinearRing>
        <coordinates>
               80.928147,26.930641
               80.931569,26.931032
               80.934670,26.931100
               80.935466,26.928844
               80.936332,26.924983
               80.937829,26.919408
               80.937829,26.916730
               80.937763,26.914189
               80.938580,26.913204
               80.939861,26.912909
               80.941319,26.912200
               80.943584,26.911765
               80.946237,26.911414
               80.955613,26.909236
               80.956694,26.908942
               80.957361,26.908558
               80.958495,26.907590
               80.968109,26.897893
               80.974727,26.891545
               80.978326,26.887633
               80.979482,26.887024
               80.981583,26.886344
               80.995766,26.885197
               80.995792,26.876036
               80.995451,26.874396
               80.995556,26.873600
               80.996213,26.873178
               81.014656,26.873809
               81.014745,26.872030
               81.007705,26.850172
               81.007572,26.849315
               81.007784,26.848407
               81.008805,26.845504
               81.010513,26.840599
               81.012009,26.838626
               81.013673,26.836962
               81.014281,26.835977
               81.014479,26.835071
               81.014446,26.833878
               81.014164,26.832987
               81.012155,26.830081
               81.011896,26.829408
               81.011909,26.827518
               81.012151,26.826300
               81.012879,26.820470
               81.014601,26.814856
               81.014601,26.813820
               81.013899,26.812476
               81.012164,26.810279
               81.011331,26.809469
               81.009527,26.807827
               80.996211,26.791753
               80.995778,26.791069
               80.993139,26.788713
               80.990800,26.785629
               80.988504,26.782142
               80.983547,26.779154
               80.978205,26.774920
              80.976170,26.773042
              80.974430,26.772239
              80.972653,26.772035
              80.961777,26.771110
              80.953795,26.771053
              80.952143,26.770708
              80.945577,26.768294
              80.943195,26.767604
              80.939045,26.766630
              80.926204,26.762536
              80.925032,26.762260
              80.923374,26.762402
              80.890888,26.775325
              80.886190,26.776060
              80.882770,26.776869
              80.882273,26.777370
              80.895623,26.801549
              80.895846,26.802027
              80.892746,26.803502
              80.890693,26.805393
              80.882117,26.816215
              80.880417,26.818843
              80.877928,26.821518
              80.875824,26.823020
              80.872704,26.824428
              80.870635,26.825148
              80.868339,26.825508
              80.866989,26.826055
              80.865898,26.826767
              80.854835,26.835684
              80.851329,26.842378
              80.862010,26.859240
              80.862283,26.859903
              80.862487,26.863954
              80.863613,26.868486
              80.864501,26.874522
              80.854725,26.876772
              80.856991,26.881074
              80.857541,26.881810
              80.859314,26.883534
              80.862417,26.885850
              80.863099,26.886371
              80.867478,26.891705
              80.870591,26.897173
              80.877400,26.905958
              80.880395,26.913470
              80.881326,26.915186
              80.882274,26.916250
              80.884017,26.917982
              80.886404,26.919494
              80.889914,26.921570
              80.899134,26.926494
              80.901216,26.927558
              80.903006,26.928716
              80.909761,26.932281
              80.914663,26.933453
              80.915982,26.933716
              80.917310,26.933690
              80.920035,26.934111
              80.920723,26.933982
              80.921542,26.933586
              80.924303,26.931291
              80.926269,26.930686
        </coordinates>
      </LinearRing>
    </innerBoundaryIs>
  </Polygon>
</Placemark>

1 个答案:

答案 0 :(得分:0)

您有内部多边形的坐标以及要检查的标记。
看一下this并应用它来找出它