geospatial

R: Add non-pch symbols to a map (polygon layer)

一个人想着一个人 提交于 2019-12-13 07:18:30
问题 I use R as a GIS here, to create a map. It's a monochrome (black/white) site plan. However, I want to distinguish forests from other areas using these open triangular symbols for coniferous forests that are quite common in cartography in the german speaking world. A bit of research led me to the my.symbols function from the TeachingDemos package. I understood one could write a function plotting the desired symbol in a xlim = c(-1,1) , ylim = c(-1,1) plot and then use TeachingDemos::my.symbols

which function is good to check whether the given lat & lng is inside the polygon?

为君一笑 提交于 2019-12-13 04:26:17
问题 I have found the following mysql spatial functions which can check a given lattitude and longtitude is inside the polygon or not. 1 - MBR_Contains 2 - MBR_Within Please guide me, which will give fast and accurate result to check a given point is inside or outside of the polygon in MySql server by the query itself. Also Suggest me, If you found any better solution than this ( It should be checked by query in Mysql Server.)? Regards, ArunRaj 回答1: They're likely the same (in terms of speed), but

$geowithin:$polygon doesn't use 2dsphere index

风格不统一 提交于 2019-12-13 04:12:05
问题 I am having a collection of documents like following: { "_id" : ObjectId("5bc15f23d672e9086ca4fbac"), "Location" : { "GeoJson" : { "type" : "Point", "coordinates" : [14.4199254356, 50.0700249768] } } And I have Index created as following { Location.GeoJson2dsphere : "2dsphere" } And now to the problem when I use the $polygon for searching, i've got the results, but query is not using index, so it's slow. Here is the query .find({"Location.GeoJson" : { "$geoWithin" : { "$polygon" : [ [14

Spark: 'Requested array size exceeds VM limit' when writing dataframe

半世苍凉 提交于 2019-12-13 03:16:51
问题 I am running into a "OutOfMemoryError: Requested array size exceeds VM limit" error when running my Scala Spark job. I'm running this job on an AWS EMR cluster with the following makeup: Master: 1 m4.4xlarge 32 vCore, 64 GiB memory Core: 1 r3.4xlarge 32 vCore, 122 GiB memory The version of Spark I'm using is 2.2.1 on EMR release label 5.11.0. I'm running my job in a spark shell with the following configurations: spark-shell --conf spark.driver.memory=40G --conf spark.driver.maxResultSize=25G

How to compute greatest distance between polygon centroid and edge

邮差的信 提交于 2019-12-13 02:57:40
问题 I have a SpatialPolygons(DataFrame) object, e.g. SpP library(sp) Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2))) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5))) Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE) Srs1 = Polygons(list(Sr1), "s1") Srs2 = Polygons(list(Sr2), "s2") Srs3 = Polygons(list(Sr3, Sr4), "s3/4") SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3) I would like to, for each polygon, calculate the greatest distance between

Convert coordinate systems using SQLGeometery

偶尔善良 提交于 2019-12-13 02:53:49
问题 One of my shape files looks like this: POLYGON ( -91.513078999999991 36.970298, -87.01993499999999 36.970298, -87.01993499999999 42.508337999999995, -91.513078999999991 42.508337999999995, -91.513078999999991 36.970298) Another file is using SRID 3857: POLYGON ( -10033572.109485552 4727287.954831399, -10033571.708142675 4727287.954831399, -10033571.708142675 4727288.1439229213, -10033572.109485552 4727288.1439229213, -10033572.109485552 4727287.954831399) Assuming I can figure out which

R mapping filled.contour georeferencing interpolation

天大地大妈咪最大 提交于 2019-12-13 01:54:25
问题 I'm trying to make a map kind of like this, but with higher resolution, and less of a tile like appearance: Which used this code: samps <- read.csv("Petra_phytoplankton+POM_xydata_minusNAs_noduplicates.csv") #my data for sampling sites, contains a column of "lat" and a column of "lon" with GPS points in decimal degrees samps_test<-samps x<-samps_test$longitude y<-samps_test$latitude z<-samps_test$d13C ## interpolation using akima x0<-seq(min(x), max(x), length = 100) y0<-seq(min(y), max(y),

Convert Spatial Lines to Spatial Polygons

非 Y 不嫁゛ 提交于 2019-12-13 00:35:58
问题 Is there an easy way to convert a Spatial Lines into a Spatial Polygon object within R? Reproducible Example I have put together a reusable dataset here, which is downloaded from OpenStreetMaps through the overpass package. This extracts the locations of a few airports in South England: devtools::install_github("hrbrmstr/overpass") library(overpass) library(raster) library(sp) # Write Query query_airport <- ' (node["aeroway"="aerodrome"](50.8, -1.6,51.1, -1.1); way["aeroway"="aerodrome"](50.8

Java: Trigonometry and double inaccuracy causing NaN

故事扮演 提交于 2019-12-12 23:47:39
问题 I have a distance formula using latitude and longitude: distance = EARTH_MILES_RADIUS * Math.acos(Math.sin(lat1 / RADIAN_CONV) * Math.sin(lat2 / RADIAN_CONV) + Math.cos(lat1 / RADIAN_CONV) * Math.cos(lat2 / RADIAN_CONV) * Math.cos((lng2 - lng1) / RADIAN_CONV)); lat1,lng1,lat2,lng2 are double primitives. They come to me as double primitives and there is nothing I can do about it. The problem is that when I have a pair of longitude or latitudes that are the same the formula sometimes returns

How to use MongoDB GeoSpatial Index in C++

核能气质少年 提交于 2019-12-12 23:26:59
问题 In python, pymongo provides nice support for MongoDB GeoSpatial index. However, for C++ when I use mongocxx in C++, I am a little bit confused about the grammar. For example, in python (pymongo) I used cursor = db.colection.find( { "loc": { "$near": [lon, lat] } } ).limit(10) to get nearest 10 items for given location. But how can I do the same thing in C++? I tried: mongocxx::cursor cursor = coll.find(document{} << "loc" << open_document << "$near" << [lon, lat] << close_document << finalize