Hi

I'm not close to my R right now. Can you explain to me what you think your second argument to readORG does?

Br. Frede


Sendt fra Samsung mobil


-------- Oprindelig meddelelse --------
Fra: Gabriele Cozzi
Dato:16/04/2014 19.11 (GMT+01:00)
Til: r-sig-geo
Emne: [R-sig-Geo] import iml with readOGR

Dear all,

I am trying to import a kml (polygon) into R following the suggestions from:
http://gis.stackexchange.com/questions/58131/how-to-efficiently-read-a-kml-file-into-r

and
https://stat.ethz.ch/pipermail/r-sig-geo/2010-May/008355.html


the code I run is the following:

S <- readOGR(“~/Documents/Sarikamis.kml", "Sarikamis”)
and I also tried:
S <- readOGR(“~/Documents/Sarikamis.kml", “Sarikamis.kml”)

but I get the usual error:
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv =
use_iconv) :
  Cannot open file


When I open the kml file using a text editor it reads as below (in blue),
which makes me think that the kml file name is “Sarikamis” and the string
is “Document/Sarikamis.kml”. But obviously I am doing something wrong, but
I can’t understand what.

<?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:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Sarikamis.kml</name>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin</styleUrl>
                       ......
                        ......


Any advice is highly appreciated!

I am running R 3.0.3 for Mac


Best,
Gabriele


--
Gabriele Cozzi
Postdoctoral Research Associate
Population Ecology Research Group
http://www.popecol.org

Zurich University
Institute of Evolutionary Biology and Environmental Studies
Winterthurerstr. 190
8057 Zurich - Switzerland
E-mail: gabriele.cozzi@uzh.ch
Phone: +41(0)44 635 49 12
Fax: +41(0)16355711
http://www.ieu.uzh.ch

        [[alternative HTML version deleted]]


	[[alternative HTML version deleted]]

