<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><span style="color: rgb(68, 68, 68); font-size: 15.454545021057129px; line-height: 21.299999237060547px; background-color: rgb(255, 255, 255);">Hola estimados usuarios, sobre la duda que puse ayer (y que está más abajo), finalmente creo haber encontrado una solución y además puedo explicar qué sucede cuando se usa una lectura de shape y por qué no debe usarse la opción de transformar un shp en uno de tipo kml.</span><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">Una opción que me vale (salvo que alguien me indique algo mejor), es usar una la instrucción sink() -no hace falta ninguna librería especial para cargar esto-, permite rescatar output tal cual de la pantalla y mandarlos a un fichero donde queramos, esto me permite leer el shp y tras considerar los polígonos me doy cuenta que para el municipio de Granada hay 4 líneas poligonales distintas.</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">Al final me vale esta sintaxis (si os descargáis los datos del ign y consideráis todos los ficheros en un mimo directorio y del tipo MUNICIPIO.*)</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="background-color: rgb(255, 255, 255);"><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">library(maptools)</span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">library(sp)</span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">shape1 <-readShapePoly ("C:\\Users\\EWA\\Desktop\\FJRA\\R\\TRATAMIENTO_SHP\\DATOS\\MUNICIPIO.shp")</span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;"><br></span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">sink("C:\\Users\\EWA\\Desktop\\FJRA\\R\\TRATAMIENTO_SHP\\sink-examp.txt")</span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;"><br></span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">POLIGONALES <- polygons (shape1)</span></font></div><div><font color="#444444"><span style="font-size: 15.454545021057129px; line-height: 21.299999237060547px;">POLIGONALES[13]</span></font></div><div style="color: rgb(68, 68, 68); font-size: 15.454545021057129px; line-height: 21.299999237060547px;"><br></div></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">---------------------------------</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">Adicionalmente hay opciones para quitar la conección, ...</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">Lo que kmlPoligons es que considera sólo la primera e ignora el resto, por tanto desaparece el municipio "gordo" de granada y lo sustituye por una isla en el Mar de Alborán (no sé si Peregil o vete tu a saber jeje), por tanto ojo con usar esto</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">sink() Requiere que posteriormente trate el fichero, pero bueno, puedo pensar el como hacerlo bien a mano o montar algo con R que me permita atacarlo mejor, en todo caso esto soluciona mi problema pero agradezco si alguien supiera si hay algo aún más directo</div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);">Un saludo </div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.299999237060547px; color: rgb(68, 68, 68); font-size: 15.454545021057129px; background-color: rgb(255, 255, 255);"><br></div><br><div><hr id="stopSpelling">From: fjroar@hotmail.com<br>To: r-help-es@r-project.org<br>Subject: Duda sobre lectura de Ficheros .shp del IGN<br>Date: Fri, 1 Aug 2014 20:43:40 +0000<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Hola, estimados R - usuarios, tengo una duda sobre ficheros .shp que describo en el word adjunto, estoy haciendo un trabajo a nivel municipio y necesito, de cualquier modo las correspondientes poligonales compatibles con los mapas de google, he visto que el IGN ofrece fichero en ese sentido pero no sé como extraer los datos de dicho fichero. Como indico, me da igual extraerlo aunque sea en un fichero plano sin estructura, ya me encargaré yo de manipularlo y organizarlo.<div><br></div><div>En el word doy un camino pero pierdo unos 5 o 6 municipio, por lo que no sé si estoy haciendo algo mal o hay algún modo mejor de hacerlo, u otro totalmente distinto</div><div><br></div><div>Agradezco enormemente vuestra ayuda, y recibid un cordial saludo de </div><div><br></div><div>Francisco J. Rodríguez Aragón<br><div><div class="ecxgmail_extra"><br></div></div></div>                                    </div></div>                                        </div></body>
</html>