Spatial

create hexagonal cells grid using lat/lon coordinates

有些话、适合烂在心里 提交于 2019-12-05 19:38:13
I would like to create a spatial grid with hexagonal cells using WGS84 coordinates (ie cells defined by 2 coordinates X=Latitude and Y=Longitude) So, this is what I was thinkin about : library(ggplot2);library(hexbin) X<-seq(-10,20,by=0.1) # create coordinates vectors X and Y Y<-seq(35,65,by=0.1) z<-rnorm(301,0.5,1) df<-as.data.frame(cbind(X,Y,z)) # create data frame with a z value for each cells (X,Y) pl<-ggplot2(data=mat,aes(x=X,y=Y,z=z))+stat_summury_hex(fun=function(x) sum(x)) plot(pl) But doing this does not provide what I wanted. So, my question is : how to do a spatial grid with

SQL Spatial polygon inside out

若如初见. 提交于 2019-12-05 18:31:31
问题 I am allowing users to draw a polygon in Silverlight by clicking to draw. Then I loop through the points, convert them to longitude and latitude and then save to SQL (in a geography column). The problem is that because of the world being round and all that, it only works if the user draws clockwise. Otherwise it tries to make the polygon right round the world and fails. So how do I do this correctly? Do I have to work out which way they are drawing, and if so how? 回答1: You can check, if the

Query spatial data with dapper

让人想犯罪 __ 提交于 2019-12-05 16:38:25
I've found some related questions , but the author gave up and went ahead with using stored procedures to do the 'mapping'. This is actually a continuation question from here Model public class Store { public int Id { get; private set; } public string Name { get; set; } public string Address { get; set; } public DbGeography Location { get; set; } } Querying using (SqlConnection conn = SqlHelper.GetOpenConnection()) { const string sql = "Select * from Stores"; return conn.Query<Store>(sql, new { Tenant_Id = tenantId }); } Dapper doesn't understand spatial data, and as many had said, it wasn't

Coding and Paper Letter(三十三)

放肆的年华 提交于 2019-12-05 14:16:24
资源整理。接上篇,这篇是Paper。 Paper: 1. Automated Paddy Rice Extent Extraction with Time Stacks of Sentinel Data: A Case Study in Jianghan Plain, Hubei, China/利用时间叠加的哨兵数据自动提取水稻水平范围 - 以湖北省江汉平原为例 水稻是全球最重要的农作物之一。水稻稻田的空间分布在描述乡村景观中起着重要作用,水稻稻田的确切位置和范围对于分析后续的资源配置,水稻产量预测和粮食安全至关重要。水稻与其他作物相比具有明显的特征,因为在水稻种子准备和水稻移栽的初期,稻田需要水淹。为了绘制水稻图,长期以来一直使用遥感技术来提取和监测水稻作物。在许多方法中,基于物候的水稻绘图算法已被引入并在较粗糙的遥感图像中进行测试,例如MODIS(中等分辨率成像光谱仪),AVHRR(高级超高分辨率辐射计)和Landsat图像。然而,稻田的平均尺寸通常小于0.09公顷(例如,Landsat像素的面积)。因此,存在大量混合像素,这导致错误分类。同时,先前研究中使用的物候指标,如LSWI(地表水指数)和MNDWI(改良归一化差异水指数),在水稻种子制备和移植初期检测地表水含量是不可行的。 。因此,本研究首先提出了一个新的指数PMI(垂直水分指数)来识别水稻田的灌溉

How to add lines of longitude and latitude on a map using ggplot2?

和自甴很熟 提交于 2019-12-05 13:44:15
I am now plotting the map of Canada using ggplot2 . Because the default projection method is "aea"(Albers Equal Area), so the longitude and latitude are straight lines on the map. I wonder how I can display the longitude and latitude in the form of "110W, 100W, 90W" and "50N, 60N, 70N" on the map. They should be curves. Thanks a lot. The arcgis shapfile is downloaded from https://www.arcgis.com/home/item.html?id=dcbcdf86939548af81efbd2d732336db library(ggplot2) library(rgdal) countries<-readOGR("Canada.shp", layer="Canada") ggplot()+geom_polygon(data=countries,aes(x=long,y=lat,group=group)

Change projection in MSSQL for web mapping (Leaflet,Openlayer, OpenStreetMaps, GoogleAPI, …) to WSG48 or any other format

放肆的年华 提交于 2019-12-05 12:23:30
I have some WKT/WKB data in the MSSQL server like this and would like to show them on the map with the help of leaflet, Openlayer, OpenStreetMaps, or GoogleAPI. My data look likes this: POLYGON ((1736946.0983 5923253.9175, 1736895.6852 5923333.9451, 1736936.0082 5923356.6991, ......)) in this format EPSG:2193 as shown below and would like to convert them to WGS48 or EPSG:4326 I am trying to add them to leaflet, and seems that I need to convert this data to an appropriate format like this: [[42.353770, -71.103606], [42.355447, -71.104475], [42.362681, -71.089830], [42.361829, -71.079230]]

Mysql select where polygon contains point always false

女生的网名这么多〃 提交于 2019-12-05 11:55:34
I have tried various functions like MBRWithin, MBRContains, Intersects, Contains (all of them found in a plenty of posts around here) but no luck yet. This is the simplified query: SELECT * FROM users WHERE Intersects( GeomFromText( 'POINT(50 50)' ), GeomFromText( 'POLYGON(0 0, 100 0, 100 100, 0 100, 0 0)' ) ); I expected it to evaluate that condition as true (like 1=1) and return all users, however this did not happen. Please tell me, what am I doing wrong? I am running MySql 5.5 This worked for me: SELECT * FROM users WHERE MBRContains( GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'),

MySQL Spatial CONTAINS shows wrong result

六月ゝ 毕业季﹏ 提交于 2019-12-05 11:30:05
I have a strange behavior of MySQL spatial search. I have created a polygon in a GEOM field (Portugal bounds), then I am trying to find a point inside -- it is found ok. The next try is to find a point that is outside a polygon but the query still returns 1 found row. Please help, what am I doing wrong? Why does it find a point outside a polygon? SQL Code for testing is below: CREATE TABLE IF NOT EXISTS `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bounds` geometry NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `test` (`id`, `bounds`) VALUES

In R, how to average spatial points data over spatial grid squares

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:55:09
Managed to solve problem now I have a set of around 50 thousand points that have coordinates and one value associated with them. I would like to be able to place points into a grid averaging the associated value of all points that fall into a grid square. So I want to end up with an object that identifies each grid square and gives the average inside the grid square. I have the data in a spatial points data frame and a spatial grid object if that helps. Improving answer: I have definitely done some searching, sorry about the initial state of the question I had only managed to frame the

org.hibernate.MappingException: No Dialect mapping for JDBC type: 2002

佐手、 提交于 2019-12-05 10:53:40
I'm getting org.hibernate.MappingException: No Dialect mapping for JDBC type: 2002 when I try to do a JPA nativeQuery to get a geometry field type. I'm using Oracle and org.hibernatespatial.oracle.OracleSpatial10gDialect . The geometry field is mapped as: @Column(name="geometry") @Type(type = "org.hibernatespatial.GeometryUserType") private Geometry geometry; // ... List<Object> listFeatures = new LinkedList<Object>(); Query query = entityManager.createNativeQuery( "SELECT "+ slots +" , geometry FROM edtem_features feature, edtem_dades dada WHERE" + " feature."+ tematic.getIdGeomField() +" =