[R-sig-Geo] R Help

chris english englishchristophera at gmail.com
Fri Jan 8 08:18:14 CET 2016


Krishan,

Create functions to compute the area, centroid and perimeter of a polygon
list (as in the format of georgia.polys).
The secret here is the specificity of georgia.polys, which googling leads
us to Cran R "GISTools". Looks like this handles the polygon area calc.
Perimeter can also be referred to as envelope which might lead one to
either "geosphere" or "spatstat". Thence to "rgeos" for centroid, and a
small walking tour of aspects of spatial R.

I'm imagining the idea is to use what has already been validated as correct
code rather than writing the same.
HTH,
Chris

On Thu, Jan 7, 2016 at 10:38 PM, Sarah Goslee <sarah.goslee at gmail.com>
wrote:

> You'd get better results if you send your information to the list, and
> as plain-text email with data either included or using one of the
> built-in datasets in R. I don't necessarily know the answer even
> though I know the right way to ask the question.
>
> Sarah
>
> On Thu, Jan 7, 2016 at 3:35 PM, Mistry, Krishan <km314 at student.le.ac.uk>
> wrote:
> > Dear Sarah,
> >
> > This isn't homework, but in fact optional extra work for a R practical
> session. I am new to R and haven't done any programming before.  Would you
> be able to assist me, if i am able to send you the question on a word
> document along the data that is used.
> >
> > Kind Regards
> > Krishan
> >
> > ________________________________________
> > From: Sarah Goslee <sarah.goslee at gmail.com>
> > Sent: 07 January 2016 20:31
> > To: Mistry, Krishan
> > Cc: r-sig-geo at r-project.org
> > Subject: Re: [R-sig-Geo] R Help
> >
> > As you will see below, posting in HTML format made your question
> unreadable.
> >
> > However, this looks rather like homework, and if so then you should
> > look for help from the resources associated with your course.
> >
> > If it isn't homework, you will get much more assistance if you provide
> > a reproducible example including data and the code you've tried
> > already.
> >
> > Sarah
> >
> > On Thu, Jan 7, 2016 at 3:24 PM, Mistry, Krishan <km314 at student.le.ac.uk>
> wrote:
> >> Dear Sir/Madame,
> >>
> >> I am currently a Masters student at the University of Leicester in the
> UK studying MSc Geographical Information Science and am having a bit of
> difficulty with the programme R. I am a new user of the programme and don't
> have any previous experience in programming. Having looked at various web
> sites, I wondered if you are able to help me with some trouble i am having
> in trying to write some code for a mathematical equation.
> >> I have attached the question to this email and it can be seen below.
> The dataset is a list of polygons with each polygon containing another list
> within it, of x and y coordinates.
> >>
> >> I would really appreciate it, if you could help me with this question.
> >>
> >> Question
> >> Create functions to compute the area, centroid and perimeter of a
> polygon list (as in the format of georgia.polys). The formula for the area
> of a polygon is
> >>
> >> A=0.5*?(x? y???) (x??? y?)      for i until n-1
> >>
> >> where A is the polygon area, xi is the ith x-coordinate of the polygon
> boundary (x[i] in R), yi is the ith ycoordinate of the polygon boundary
> (y[i] in R) - and n is the number of points used to specify the polygon
> boundary. The polygon is assumed to be in closed form so that the x1 and y1
> take the same value as xn and yn.
> >>
> >> Hope to hear from you soon.
> >>
> >> Yours sincerely
> >>
> >> Krishan Mistry
> >>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list