Skip to main content
Tweeted twitter.com/StackGIS/status/1182989439397761025
edited tags
Link
AndreJ
  • 77.1k
  • 5
  • 88
  • 163
added a reproducible example
Source Link
Rodrigo
  • 784
  • 5
  • 21

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This has 2 problems:

  1. It looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it?

EDIT - What I've done so far:

The shapefile was downloaded from here to a folder named "shp". The R code is just:

library(rgdal)
countries <- readOGR("shp","TM_WORLD_BORDERS-0.3",encoding="UTF-8",stringsAsFactors=F)
countries <- spTransform(countries,CRS("+proj=ortho +lat_0=-10 +lon_0=-60"))

It gives me the error

non finite transformation detected:
[1] 45.08332 39.76804      Inf      Inf
Erro em .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args,  : 
  failure in Polygons 3 Polygon 1 points 1
Além disso: Mensagens de aviso perdidas:
In .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args,  :
  108 projected point(s) not finite

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This has 2 problems:

  1. It looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it?

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This has 2 problems:

  1. It looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it?

EDIT - What I've done so far:

The shapefile was downloaded from here to a folder named "shp". The R code is just:

library(rgdal)
countries <- readOGR("shp","TM_WORLD_BORDERS-0.3",encoding="UTF-8",stringsAsFactors=F)
countries <- spTransform(countries,CRS("+proj=ortho +lat_0=-10 +lon_0=-60"))

It gives me the error

non finite transformation detected:
[1] 45.08332 39.76804      Inf      Inf
Erro em .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args,  : 
  failure in Polygons 3 Polygon 1 points 1
Além disso: Mensagens de aviso perdidas:
In .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args,  :
  108 projected point(s) not finite
Edited formatting, removed 'thanks'
Source Link
Joseph
  • 76.3k
  • 7
  • 172
  • 286

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransformspTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This havehas 2 problems:

  1. itIt looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it? Thanks in advance!

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This have 2 problems:

  1. it looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it? Thanks in advance!

I want to make a plot like that using R:

orthographic projection

All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non finite transformation detected" error. I've been told that I need to apply a cosine formula to each point in my world shapefile, and erase those that goes behind the Earth. This has 2 problems:

  1. It looks like something the algorithm should do automatically;
  2. I cannot just erase the points behind the Earth, cause this would destroy the topology of the polygons.

Isn't it a simple task? How should I do it?

Source Link
Rodrigo
  • 784
  • 5
  • 21
Loading