gis

How to properly project and plot raster in R

旧街凉风 提交于 2021-02-20 20:00:02
问题 I have a raster in an equal area Behrmann projection and I would like to project it to the Mollweide projection and plot. When I do this with the following code, however, the plotting doesn't seem right, as the map extends to the sides, and there are outlines of various landmasses where I wouldn't expect them.Also, the map extends beyond the plot window. Can anyone please help me get this to plot nicely? Thanks! The data file used can be downloaded from this link. Here is the code I have so

How to properly project and plot raster in R

一笑奈何 提交于 2021-02-20 19:59:26
问题 I have a raster in an equal area Behrmann projection and I would like to project it to the Mollweide projection and plot. When I do this with the following code, however, the plotting doesn't seem right, as the map extends to the sides, and there are outlines of various landmasses where I wouldn't expect them.Also, the map extends beyond the plot window. Can anyone please help me get this to plot nicely? Thanks! The data file used can be downloaded from this link. Here is the code I have so

Adding Provinces to Canadian Map in R

≡放荡痞女 提交于 2021-02-20 02:46:43
问题 I've been browsing a lot of the topics on mapping in R and would appreciate a little help. I've made it to this code which builds an image of a purchase density then overlays a US State map on top and a Canadian national map as well. It's an ok solution, but Ideally I'd like to show the provinces in Canada as well. library(mapdata); library(maps); library(maptools); library(spatstat); png(filename=file_name, type="cairo-png", bg="transparent", width=10.*960, height=10.*960, pointsize=1);

Adding Provinces to Canadian Map in R

谁说我不能喝 提交于 2021-02-20 02:45:49
问题 I've been browsing a lot of the topics on mapping in R and would appreciate a little help. I've made it to this code which builds an image of a purchase density then overlays a US State map on top and a Canadian national map as well. It's an ok solution, but Ideally I'd like to show the provinces in Canada as well. library(mapdata); library(maps); library(maptools); library(spatstat); png(filename=file_name, type="cairo-png", bg="transparent", width=10.*960, height=10.*960, pointsize=1);

Determine if point is in set of coordinates in java

风流意气都作罢 提交于 2021-02-19 12:46:21
问题 I have searched for an answer to this question, but I cannot seem to find a solution. What I need is I have a set of coordinates (of unknown length in the beginning) and I need to determine if a point resides inside of the polygon determined by this coordinate. However, I cannot use the AWT (as I originally thought I could), as the coordinates can range anywhere in the US. I think I need to use a for-loop , with a series of less than , greater than checks. Am I on the right path, or is there

Convert xyz coordinate of a tile to longitude/latitude

≡放荡痞女 提交于 2021-02-19 03:20:36
问题 I wanted to make a map using openlayers but center it a unique way. For example I have a z/x/y coordinate of 12/2045/-1362, how do I convert it to longitude/latitude? It's quite the polar opposite of this: How to get X Y Z coordinates of tile by click on Leaflet map It's quite hard for me to get the logic of the above link and invert it. I hope someone here has an experience or a ready-made formula for this. Thanks Later I'll this in rendering the center of my map like this: var z = 12; var x

Plotting static base map underneath a sf object

≯℡__Kan透↙ 提交于 2021-02-18 21:01:48
问题 I'm trying to plot a static base map underneath my sf object (for print). When using ggmap I first get a lot of errors, then I can't seem to figure out how to chain the base map to my ggplot2 object with a geom_sf . library(sf) # devtools::install_github("tidyverse/ggplot2") library(ggplot2) library(ggmap) nc <- st_read(system.file("shape/nc.shp", package="sf")) nc_map <- get_map(location = "North Carolina, NC", zoom = 7) ggmap(nc_map) nc_centers <- st_centroid(nc) nc_centers %>% ggplot() +

Shader that transforms a mercator projection to equirectangular?

早过忘川 提交于 2021-02-18 16:55:14
问题 I am trying to make a shader in Unity taking a mercator projection texture as a source and converting it to an equirectangular projection texture . Input example: Output example: This example does the opposite with an equirectangular as source. If you look at the source of the above example: // mercator float latClamped = clamp(lat, -1.4835298641951802, 1.4835298641951802); float yMerc = log(tan(PI / 4.0 + latClamped / 2.0)) / PI2; float xMerc = xEqui / 2.0; vec4 mercatorPos = vec4(xMerc,

Create random points within a polygon within a class

核能气质少年 提交于 2021-02-16 20:06:56
问题 I am trying to create a single point within a polygon using a class for use in an agent based model. Currently I am able to create random points constrained to the bounds of the polygon, but not the polygon itself. My code at present appears to ignore the if statement within the while loop. I am very new to python so this could be a limitation I am missing. Here is my current code: import geopandas as gpd import matplotlib.pyplot as plt import random import pandas as pd bounds = gpd.read_file

Create random points within a polygon within a class

五迷三道 提交于 2021-02-16 20:06:31
问题 I am trying to create a single point within a polygon using a class for use in an agent based model. Currently I am able to create random points constrained to the bounds of the polygon, but not the polygon itself. My code at present appears to ignore the if statement within the while loop. I am very new to python so this could be a limitation I am missing. Here is my current code: import geopandas as gpd import matplotlib.pyplot as plt import random import pandas as pd bounds = gpd.read_file