geospatial

Converting coordinates to WGS84

允我心安 提交于 2020-01-03 02:48:11
问题 I have the following function which plots a Circle given the centroid, but I want the coordinates to be In WGS84. var coords = new List<Tuple<double, double>>(); const double EARTH_RADIUS_NM = 3437.670013352; var lat = (latIn * Math.PI) / 180; var lon = (lonIn * Math.PI) / 180; double d = radiusIn / EARTH_RADIUS_NM; for (int x = 0; x <= 360; x++) { double brng = (x * Math.PI) / 180; var latRadians = Math.Asin(Math.Sin(lat) * Math.Cos(d) + Math.Cos(lat) * Math.Sin(d) * Math.Cos(brng)); var

Duplicate key error with mongodb 2dsphere unique index

懵懂的女人 提交于 2020-01-03 01:50:14
问题 I try to inserts geo points to mongodb with 2dsphere unique index, but it raises many duplicate key error. A simple reproduce demo: > version() 2.4.5 > use geo > db.test.ensureIndex( { loc : "2dsphere" }, unique=true ) > db.test.insert({"loc" : { "type" : "Point", "coordinates" : [ 113.3736642, 23.04469194 ] }}) > db.test.insert({"loc" : { "type" : "Point", "coordinates" : [ 113.3734775, 23.04609556 ] }}) E11000 duplicate key error index: geo.test.$loc_2dsphere dup key: { : "1f22000102222113"

How to unlist spatial objects and plot altogether in R

佐手、 提交于 2020-01-02 16:19:28
问题 I have spatial lines as 'list': > SL1 [[1]] class : SpatialLines nfeatures : 1 extent : 253641, 268641, 2621722, 2621722 (xmin, xmax, ymin, ymax) coord. ref. : +proj=utm +zone=46 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 [[2]] class : SpatialLines nfeatures : 1 extent : 253641, 268641, 2622722, 2622722 (xmin, xmax, ymin, ymax) coord. ref. : +proj=utm +zone=46 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 [[3]] class : SpatialLines nfeatures : 1 extent : 253641,

Mongodb 2dsphere index for nested array field

二次信任 提交于 2020-01-02 15:37:28
问题 I have created collection and a object is looks like this. [_id] => MongoId Object ( [$id] => 53087f483b15eaeb6c3c9869 ) [time_from] => 2014-02-22 00:00:00 [time_to] => 2014-02-22 00:10:00 [checkin] => Array ( [0] => Array ( [time_frame] => 2014-02-22 00:00:56 [user_id] => 1 [loc] => Array ( [type] => Point [coordinates] => Array ( [0] => 73.43 [1] => 42.22 ) ) ) [1] => Array ( [time_frame] => 2014-02-22 00:00:56 [user_id] => 2 [loc] => Array ( [type] => Point [coordinates] => Array ( [0] =>

PostgreSQL: How to get all points in certain radius

时光怂恿深爱的人放手 提交于 2020-01-02 12:26:12
问题 I'm using Postgresql 9.3 and iv'e installed cube and earthdistance extensions. I'm trying to follow this tutorial, so i have a simple events table with 4 fields: id, name, lat, lng. Now i'm trying to run this query, to get all events within 1 km radius: SELECT events.id, events.name FROM events WHERE earth_box(31.789225, 34.789612, 1000) @> ll_to_earth(events.lat, events.lng); but i keep getting this error: 20:59:34 Kernel error: ERROR: function earth_box(numeric, numeric, integer) does not

keep region names when tidying a map using broom package

隐身守侯 提交于 2020-01-02 08:44:30
问题 I am using the getData function from the raster package to retrieve the map of Argentina. I would like to plot the resulting map using ggplot2, so I am converting to a dataframe using the tidy function from the broom package. This works fine, but I can't figure out how to preserve the names of the federal districts so that I can use them on the map. Here is my original code that does not preserve the district names: # Original code: ################################## # get the map data from

is there something like dbgeometry makevalid in .net 4.5

点点圈 提交于 2020-01-02 08:24:42
问题 I'm trying to calculate area of polyline like that string poly = "POLYGON ((637604.918432772 2230520.64934531, 637622.257266129 2230419.44632915, 637279.107128549 2230192.04910755, 636765.470527745 2230179.6468564, 636778.005055813 2229861.77192838, 636529.81646905 2229464.29327025, 635813.486592791 2229523.30345774, 636017.385069448 2229974.32341381, 636267.323659164 2230070.32127916, 637035.026966561 2230404.70764784, 637275.265066307 2230401.13408429, 637604.918432772 2230520.64934531,

MATLAB: Plot raster map with custom colormap

旧城冷巷雨未停 提交于 2020-01-02 06:53:10
问题 In MATLAB, I have a matrix map_data associated with referencing object R (both in this MAT-file). I want to map it with a discrete colorbar given an irregular range of values to look something like this: I would like to use geoshow() or something similar that allows me to reproject at will and to overlay shapefiles on top of the raster. But really anything that gets me on the right track would be much appreciated. I'm using MATLAB r2014b. Here is the relevant information for the colormap: R G

how to use geoNear in nodejs?

不羁的心 提交于 2020-01-01 14:09:11
问题 I want to use geospatial geoNear, database in mongodb, Mongo Query: db.runCommand( { geoNear: "tmp", near: { type: "Point", coordinates: [ 77.00000, 12.00000] }, spherical: true, maxDistance : 200 } ) Gives result in mongo terminal, but how to execute it using node.js I am using mongo-pool and generic-pool for mongo pooling? 回答1: Use the $geoNear operator for the aggregation pipeline (available if you are using MongoDB 2.4 or greater). For example: var mongodb = require('mongodb') ,

how to use geoNear in nodejs?

假装没事ソ 提交于 2020-01-01 14:08:22
问题 I want to use geospatial geoNear, database in mongodb, Mongo Query: db.runCommand( { geoNear: "tmp", near: { type: "Point", coordinates: [ 77.00000, 12.00000] }, spherical: true, maxDistance : 200 } ) Gives result in mongo terminal, but how to execute it using node.js I am using mongo-pool and generic-pool for mongo pooling? 回答1: Use the $geoNear operator for the aggregation pipeline (available if you are using MongoDB 2.4 or greater). For example: var mongodb = require('mongodb') ,