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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:12:08+00:00 2026-05-31T15:12:08+00:00

i would like to create a buffer around a line-shapefile with wgs84 coordinates. I

  • 0

i would like to create a buffer around a line-shapefile with wgs84 coordinates.

I prepared a shapefile with a single line segment and Datum: D_WGS_1984.
After that, i loaded the .shp into R using the ‘readOGR’ command.

After that i tried the gBuffer method out of the rgeos-package for computing the buffer:

gBuffer(l2, width=1.0, quadsegs=5, capStyle="ROUND", joinStyle="ROUND", mitreLimit=0.01)) 
Warning:
In gBuffer(l2, width = 1, quadsegs = 5, capStyle = "ROUND", joinStyle = "ROUND",  :
Spatial object is not projected; GEOS expects planar coordinates

Obviously the command has a problem with the coordinates. I tried some approaches, but didn’t find a solution.

Another example i found for a buffer around points was the following, but i’m not sure how to use it in my case:
http://r-sig-geo.2731867.n2.nabble.com/compute-buffer-from-point-shapefile-to-have-shapefile-td4574666.html

Any ideas?

Best regards,
Stefan

//update:

Reduced to the relevant part, here is the code:

require("rgeos")
require("rgdal")

l2=readOGR(dsn="C:/Maps", layer="osm_ms")

proj4string(l2) <- CRS("+proj=longlat")
l2.trans <- spTransform(l2, CRS("+proj=longlat"))
summary(l2.trans)

> Object of class SpatialLinesDataFrame
> Coordinates:
>   min       max
> x  7.478942  7.772171
> y 51.840318 52.058856
> Is projected: FALSE 
> proj4string : [+proj=longlat +ellps=WGS84]
> Data attributes:

plot(l2.trans)
plot(gBuffer(l2.trans, width=1.0, quadsegs=5, capStyle="ROUND", joinStyle="ROUND", mitreLimit=0.01))

Probably the line:

Is projected: FALSE
is the reason for the problem, but i’m not sure how to use the spTranform and how to find the correct projection.

  • 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-05-31T15:12:09+00:00Added an answer on May 31, 2026 at 3:12 pm

    Think about your buffer size of 1.0 units. That would be, in lat-long, 1.0 degrees. Which doesn’t make much sense, since 1 degree N-S is different from 1 degree E-W. GEOS is trying to stop you from doing something it thinks is a bit odd.

    So you can fool it by assigning it almost any projected coordinate CRS string, doing the buffer, then assigning it back. The underlying numbers wont change. For example if you do:

     proj4string(l2) = CRS("+init=epsg:27700")
    

    you are lying to the system that the numbers are Uk Grid metres. Then you do the buffer, and you give the units which you know are really degrees. GEOS does the calculation using the numbers, assuming the points are on a grid (and not a sphere). Then you just set the CRS back. The numbers don’t change.

    Actually, there appears to be a proper ESPG code for projected lat-long, so ignore the previous line, and do:

     proj4string(l2) = CRS("+init=epsg:3395") 
    

    EPSG code database here: http://www.epsg-registry.org/ – note the “scope” in the details for epsg:3395 is ‘very small scale mapping’.

    If you really want a buffer in metres, then you have to convert to a metric projection (for work in the UK I always use epsg:27700) using spTransform which does change the underlying numbers.

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

Sidebar

Related Questions

I would like create my own collection that has all the attributes of python
I would like create a web service in ASP.Net 2.0 that will supports JSON.
i would like create a array of structure which have a dynamic array :
Would like to create a strong password in C++. Any suggestions? I assume it
I would like to create a database backed interactive AJAX webapp which has a
I would like to create an SSL connection for generic TCP communication. I think
I would like to create a file format for my app like Quake, OO,
I would like to create a stored procedure in MySQL that took a list
I would like to create an application wide keyboard shortcut for a Java Swing
I would like to create events for certain resources that are used across various

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.