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 8606695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:09:36+00:00 2026-06-12T03:09:36+00:00

From this Question I obtained the great function areaPolygon() which gives me the area

  • 0

From this Question I obtained the great function areaPolygon() which gives me the area within a polygon of coordinates. however, when I experiment with the function the calculations seem odd:

I start by creating a set of two points

 require(fields)
 coords <- c(11.3697193956209, 47.233380520521, 11.3723606043791, 
 47.235179479479)
 coords <- matrix(coords, nrow=2, ncol=2, byrow=TRUE)

then I check the distance between these two:

 rdist.earth(coords,coords,miles=FALSE)[1,2]

obtaining: 0.2827821 kilometres (which will be the diagonal of the rectangle)

I go on with creating a rectangle

 polygon <- matrix(coords, nrow=2, ncol=2)
 polygon <- rbind(polygon, polygon)
 polygon[4,2] <- polygon[1,2]
 polygon[4,1] <- polygon[2,1]
 polygon[3,2] <- polygon[2,2]
 polygon[3,1] <- polygon[1,1]
 polygon <- rbind(polygon, polygon[1,])

see if this looks good: plot(polygon)

Fourth step: I calculate the area within the polygon.

geosphere::areaPolygon(polygon)
[1] 31.99288 #from the help file I know this ought to be square metres.

however, I would have expected 200*200=40000 m² since the sides of my recangle are 200 by 200 metres. this can be checked via

rdist.earth(polygon,coords,miles=FALSE)

           [,1]         [,2]
 [1,] 0.0000000 2.827821e-01
 [2,] 0.2827821 9.504539e-05
 [3,] 0.2002671 1.996434e-01
 [4,] 0.1996501 2.002671e-01

so coming now to my question (finally) what am I doing wrong? thank you very much for your help!

  • 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-12T03:09:37+00:00Added an answer on June 12, 2026 at 3:09 am

    You’ve made an invalid polygon! If you plot it with type="l" you’ll see a bow-tie:

    > plot(polygon,type="l")
    

    Half the bow-tie will have a negative area, the other half positive, so your result is the difference in the sizes of the halves. They won’t be exactly the same because of the earth being spherical…

    You just need to reorder your points in polygon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I obtained the data from the server using ajax like this: (EDITED) $(document).ready(function() {
From this question & the answers - What is the correct answer for cout
From this question I learned Double.NaN is not equal to itself. I was verifying
Continuing from this question : When I am trying to do fopen on Windows,
My question originates from this question, where one of the comments suggests that a
This question is a follow on from this one ... I am binding to
I'm gleaning from this question [ Facebook Connect Won't Validate that using Facebook Connect
Following on from this question , I am interested in finding out how you
following on from this question (Developing to an interface with TDD), I'm still having
Following on from this question...I'm trying to unit test the following scenario: I have

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.