Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7934605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:41:32+00:00 2026-06-03T21:41:32+00:00

I made a cool map once by plotting kml coordinates in R, and overlaying

  • 0

I made a cool map once by plotting kml coordinates in R, and overlaying species abundance data on top. When I wrote the code the first time, I used the following to call my list of coordinates:
spa<-getKMLcoordinates('Perimeter_Track.kml', ignoreAltitude=TRUE)

summary(spa) returns:

 Length Class  Mode   
[1,] 128 -none- numeric

[2,] 242 -none- numeric

[3,] 34 -none- numeric

[4,] 126 -none- numeric

(the GPS coordinates were a perimeter track measured in 4 chunks, so each list is one of those chunks):
NOW when I run the code again, summary(spa) returns:

         Length Class  Mode
[1,] 2      -none- list
[2,] 2      -none- list
[3,] 2      -none- list
[4,] 2      -none- list

If I convert spa into a dataframe using as.data.frame(), I still get this error when I try to use rbind to concatenate the 4 chunks into one big track:

Error in match.names(clabs, names(xi)) : 
  names do not match previous names

R seems not to be reading the kml file, or only reading part of it.

The list (or dataframe) spa is

  c..157.80736808..21.4323436..20.324951171875.
1                                    -157.80737
2                                      21.43234
3                                      20.32495
  c..157.80738216..21.43231443..19.36376953125.
1                                    -157.80738
2                                      21.43231
3                                      19.36377
  c..157.80533605..21.43536092..15.9990234375. c..157.8053208..21.43541138..15.9990234375.
1                                   -157.80534                                  -157.80532
2                                     21.43536                                    21.43541
3                                     15.99902                                    15.99902
  c..157.80998348..21.43706806..15.9990234375.
1                                   -157.80998
2                                     21.43707
3                                     15.99902
  c..157.80997007..21.43711106..17.441162109375.
1                                     -157.80997
2                                       21.43711
3                                       17.44116
  c..157.81074733..21.43717535..13.5958251953125.
1                                      -157.81075
2                                        21.43718
3                                        13.59583
  c..157.81071673..21.43718331..14.076416015625.
1                                     -157.81072
2                                       21.43718
3                                       14.07642

Is this an error with maptools or my code? As far as I know, this is the easiest way to convert kml coordinates into coordinates that R can use. Your help would be much appreciated.

A link to the file is here: https://www.dropbox.com/s/y8elanjnst6438v/Perimeter_Track.kml

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:41:34+00:00Added an answer on June 3, 2026 at 9:41 pm

    The fix has been committed to R-forge, maptools project, revision 232. Please try out after this evening European time:

    install.packages("maptools", repos="http://R-Forge.R-project.org")
    

    which handles this problem. However, I have no idea why you didn’t use:

    library(rgdal)
    ogrListLayers(dsn="Perimeter_Track.kml") # to find the layer name
    spa1 <- readOGR(dsn="Perimeter_Track.kml", layer="Perimeter_Track.kml")
    summary(spa1)
    

    This is a SpatialLinesData Frame, that can be used in lots of ways with no further effort. It also tackles the tabs without difficulty. To get to your input into the form returned by the ad-hoc maptools function, do:

    o0 <- coordinates(spa1)
    o1 <- lapply(o0, function(x) do.call("rbind", x))
    library(maptools) # SVN revision >= 232
    spa <- getKMLcoordinates('Perimeter_Track.kml', ignoreAltitude=TRUE)
    all.equal(o1, spa)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I made a cool demo which I want to show to my friends.
Sometimes I would like to know how a cool software is made or the
I have made a codeIgniter application. Its working oh so cool on my local,
I got a friend who made some cool functions dealing with encryption and security
I'm just learning some stuff about cryptography and I made a cool program to
So a recent question made me aware of the rather cool apriori algorithm .
I have made a cool looking scrollbar. I can not seem to get this
I have made a cool skin for my date picker. For some reason when
i have made a cool progressbar with text in the middle of it. Here
Made this nice little loop for hiding and showing div's, works as a charm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.