Foros del Web » Programando para Internet » Javascript »

Un punto geolocalizado dentro de un poligono

Estas en el tema de Un punto geolocalizado dentro de un poligono en el foro de Javascript en Foros del Web. Gracias por la ayuda de antemano, estoy trabajando en phoneGap y por lo tanto puedo usar javaScript, el problema que tengo es que con app ...
  #1 (permalink)  
Antiguo 13/06/2014, 21:43
 
Fecha de Ingreso: junio-2014
Mensajes: 1
Antigüedad: 8 años, 1 mes
Puntos: 0
Pregunta Un punto geolocalizado dentro de un poligono

Gracias por la ayuda de antemano, estoy trabajando en phoneGap y por lo tanto puedo usar javaScript, el problema que tengo es que con app que estoy diseñando puedo obtener la geolocalizacion del dispositivo en Latitud y Longitud, teniendo esto necesito verificar si esta dentro de un poligono o un area limitada que puedo crear gracias a google earth y exportarlo en un .KML Enlace: https://dl.dropboxusercontent.com/u/9285185/doc.kml por lo tanto si este archivo lo abrimos como texto (en block de notas) entonces podríamos visualizar este código

Cita:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd http://www.google.com/kml/ext/2.2 http://code.google.com/apis/kml/schema/kml22gx.xsd">
<Document id="Cuadrante_1">
<name>Cuadrante_1</name>
<Snippet></Snippet>
<Folder id="FeatureLayer0">
<name>Cuadrante_1</name>
<Snippet></Snippet>
<Placemark id="ID_00000">
<name></name>
<Snippet></Snippet>
<description><![CDATA[<html xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<head>

<META http-equiv="Content-Type" content="text/html">

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

</head>

<body style="margin:0px 0px 0px 0px;overflow:auto;background:#FFFFFF;">

<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-collapse:collapse;padding:3px 3px 3px 3px">

<tr style="text-align:center;font-weight:bold;background:#9CBCE2">

<td></td>

</tr>

<tr>

<td>

<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px">

<tr>

<td>CUADRANTE</td>

<td>1</td>

</tr>

<tr bgcolor="#D4E4F3">

<td>P_REFERENC</td>

<td>CENTRO</td>

</tr>

<tr>

<td>N_TELF</td>

<td>04162086430</td>

</tr>

<tr bgcolor="#D4E4F3">

<td>SECTORES</td>

<td>CENTRO AV. 1, 2 CALLE 16 A 26; AV. 3 Y 4 CALLES 16 A 26 PLAZA BOLIVAR; AV. 5 Y 6 CALLES 16 A 26; AV. 7 Y 8, CALLES 16 A 26; LAS HEROINAS, CUESTA DE BELEN, SEMINARIO, PLAZA EL ESPEJO.</td>

</tr>

<tr>

<td>CIUDAD</td>

<td>MERIDA</td>

</tr>

<tr bgcolor="#D4E4F3">

<td>MUNICIPIO</td>

<td>LIBERTADOR</td>

</tr>

<tr>

<td>ESTADO</td>

<td>MERIDA</td>

</tr>

<tr bgcolor="#D4E4F3">

<td>ORGANISMO</td>

<td>POLICIA DEL ESTADO MERIDA</td>

</tr>

</table>

</td>

</tr>

</table>

</body>

</html>

]]></description>
<styleUrl>#PolyStyle00</styleUrl>
<MultiGeometry>
<Polygon>
<extrude>0</extrude> <altitudeMode>clampToGround</altitudeMode>
<outerBoundaryIs><LinearRing><coordinates> -71.14171534099995,8.603093654000077,0 -71.14169285299994,8.603212409000037,0 -71.14177354899994,8.603312062000043,0 -71.14189568499995,8.603322559000048,0 -71.14190472099995,8.603192191000062,0 -71.14201071499997,8.603068883000049,0 -71.14208307799999,8.602966238000022,0 -71.14220163899995,8.602829110000073,0 -71.14236000299997,8.602710083000034,0 -71.14245927999997,8.602568087000066,0 -71.14249654999998,8.602436484000066,0 -71.14253618299995,8.602287855000043,0 -71.14256540599996,8.602120090000028,0 -71.14260047999994,8.602001572000063,0 -71.14274490499997,8.601791423000066,0 -71.14282986599994,8.601779986000054,0 -71.14293357599996,8.60168367700004,0 -71.14307049099995,8.601536722000049,0 -71.14315941699994,8.601376111000036,0 -71.14332086899998,8.601222772000028,0 -71.14349415099997,8.601097947000028,0 -71.14366666099994,8.600918743000023,0 -71.14383068299998,8.600792297000055,0 -71.14387016699999,8.600662850000049,0 -71.14393801799997,8.600518025000042,0 -71.14407920299993,8.600366755000039,0 -71.14415873599995,8.600245353000048,0 -71.14426456499996,8.600017868000066,0 -71.14429082599997,8.599917069000071,0 -71.14433502199995,8.599760633000074,0 -71.14453950099994,8.599628991000031,0 -71.14479079999995,8.599479496000072,0 -71.14490843099998,8.599364172000037,0 -71.14500182899997,8.599274788000059,0 -71.14517081199995,8.599151947000053,0 -71.14536122199996,8.599038020000023,0 -71.14554068599995,8.598888589000069,0 -71.14575281799995,8.598721023000053,0 -71.14605509699999,8.598447368000052,0 -71.14619198799994,8.598325732000035,0 -71.14646281299997,8.59810709900006,0 -71.14661222299998,8.597999380000033,0 -71.14680800599996,8.59783814900004,0 -71.14700032999997,8.597707330000048,0 -71.14719527099999,8.597612077000065,0 -71.14734621599996,8.597611454000059,0 -71.14747346499996,8.597663763000071,0 -71.14767487999995,8.597506173000056,0 -71.14799138799998,8.597364726000023,0 -71.14788495299996,8.597249858000055,0 -71.14765806999998,8.596954074000053,0 -71.14742754399998,8.596699012000045,0 -71.14690748199996,8.596010623000041,0 -71.14643950099998,8.595376243000032,0 -71.14631979099994,8.595233872000051,0 -71.14611875199995,8.594998788000055,0 -71.14595214199994,8.594774328000028,0 -71.14581906999996,8.594580696000037,0 -71.14572971199993,8.594427426000038,0 -71.14558027399994,8.594180393000045,0 -71.14544317399998,8.593921786000067,0 -71.14529851599997,8.59368166400003,0 -71.14513429399995,8.593422651000026,0 -71.14496438499998,8.593134178000071,0 -71.14451413199998,8.592646560000048,0 -71.14449645899998,8.592424749000031,0 -71.14441362299993,8.592150394000043,0 -71.14436444499995,8.591713742000025,0 -71.14429748599997,8.591147480000075,0 -71.14438928399994,8.590293169000063,0 -71.14442364099995,8.590224362000072,0 -71.14444216599998,8.59017401400007,0 -71.14444333799997,8.589585855000053,0 -71.14422463299997,8.589051138000059,0 -71.14383276399997,8.588602870000045,0 -71.14351882199998,8.588390960000027,0 -71.14313784099994,8.588118163000047,0 -71.14272587899995,8.587997379000058,0 -71.14247659899996,8.587849951000067,0 -71.14170311199996,8.587957755000048,0 -71.14119247799994,8.587638642000059,0 -71.14119138899997,8.587613630000021,0 -71.14057913599999,8.587276099000064,0 -71.14019462999994,8.587170040000046,0 -71.13995124999997,8.587329314000044,0 -71.13986330899996,8.587550805000035,0 -71.13989704199997,8.587776415000064,0 -71.13984377499997,8.58817556200006,0 -71.13987249199994,8.588360299000044,0 -71.14000888899994,8.588485224000067,0 -71.14002159599994,8.588485136000031,0 -71.14010694099994,8.588696517000074,0 -71.13998932999994,8.58890096500005,0 -71.13979692299995,8.588944326000046,0 -71.13964001899996,8.589051065000035,0 -71.13923262799995,8.589315106000072,0 -71.13902527099998,8.589946539000039,0 -71.13895901499996,8.590482449000035,0 -71.13883022999994,8.591177900000048,0 -71.13875591099998,8.591653222000048,0 -71.13869774099999,8.592064983000057,0 -71.13868423799994,8.592099663000056,0 -71.13868197699998,8.592122243000063,0 -71.13866753799994,8.592674554000041,0 -71.13862798499997,8.592865829000061,0 -71.13821473299998,8.593336629000021,0 -71.13768519299998,8.59349247800003,0 -71.13743190199995,8.594034122000039,0 -71.13645996299994,8.594446033000054,0 -71.13643900599999,8.594447759000047,0 -71.13542650299996,8.594755494000026,0 -71.13430770699995,8.595120044000055,0 -71.13351728299995,8.595367656000065,0 -71.13335210899999,8.595513488000051,0 -71.13320012799994,8.595767918000036,0 -71.13315090399993,8.595833328000026,0 -71.13299343799997,8.596070083000029,0 -71.13297543899995,8.596353544000067,0 -71.13308123399997,8.596522751000066,0 -71.13318772599996,8.596783260000052,0 -71.13318848699998,8.596800492000057,0 -71.13324428999994,8.597034674000042,0 -71.13326456999994,8.597270426000023,0 -71.13328579099994,8.597473209000043,0 -71.13330524499997,8.597691295000061,0 -71.13330597499999,8.597714249000035,0 -71.13332934599998,8.597891681000021,0 -71.13333543399995,8.597897248000038,0 -71.13348425799995,8.598116936000054,0 -71.13355754199995,8.598288448000062,0 -71.13368013999997,8.598388630000045,0 -71.13370805899996,8.598595879000072,0 -71.13373375499998,8.598751051000022,0 -71.13370083799998,8.598983434000047,0 -71.13423871899994,8.599195156000064,0 -71.13556355199995,8.599278649000041,0 -71.13622372799995,8.599201392000055,0 -71.13654185199994,8.599156999000059,0 -71.13733401699994,8.599365414000033,0 -71.13751975299994,8.599539698000058,0 -71.13806273599994,8.598815522000052,0 -71.13846557999995,8.599213831000043,0 -71.13911960699994,8.599857316000055,0 -71.13968082999998,8.600447509000048,0 -71.14020467399996,8.601158207000026,0 -71.14074276399998,8.601823306000028,0 -71.14141791699996,8.602593517000059,0 -71.14175914299995,8.602965998000059,0 -71.14171534099995,8.603093654000077,0</coordinates></LinearRing></outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
</Folder>
<Style id="PolyStyle00">
<LabelStyle>
<color>00000000</color>
<scale>0.000000</scale>
</LabelStyle>
<LineStyle>
<color>ff6e6e6e</color>
<width>0.400000</width>
</LineStyle>
<PolyStyle>
<color>ffbfe8f5</color>
<outline>1</outline>
</PolyStyle>
</Style>
</Document>
</kml>

Como hago para determinar si un punto esta dentro de ese poligono con javaScript ? Tambien he investigado y existe gente que lo ha echo pero creo que es con direcciones de los .kml publicados previamente, aqui hay algo de eso http://danielbarria.com/2010/12/punto-dentro-del-poligono/

Sin embargo no puedo permitir que la app verifique a traves de internet todo el tiempo el poligono que esta en google maps, entiendase por eso que uno como usuario de google maps puede publicar estos poligonos pero eso comprenderia que el dispositivo este conectado a internet todo el tiempo para verificar si esta o no esta dentro del poligono y no me gustaría que la app haga eso.. de todos modos se agradece si alguien me lo pueda explicar mejor :D

Etiquetas: poligonos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:40.