geospatial

Discrete Global Grid in R

一笑奈何 提交于 2019-12-05 18:45:05
问题 I have a dataset consisting of latitude-longitude pairs associated with some Z value (e.g. data regarding degree of plant vegetation coverage). I'd like to perform some analyses on the spatial distribution of this data. To do so, it will be necessary to bin proximal data points. I would like to do this with a Discrete Global Grid such as an Icosahedron Snyder Equal Area (ISEA) grid, or the grid produced by DGGRID. The key is that the latitude-longitude values of the data can be convertable

SqlServer Spatial DataReader.GetFieldType returned null

走远了吗. 提交于 2019-12-05 16:26:45
I have a .net4.5 web application project that uses SQL server spatial datatype. Works perfectly locally on development machine, but when deployed to application server I get the following error when trying to run queries on table with spatial data: System.InvalidOperationException: DataReader.GetFieldType(5) returned null. I found out that if SQLServer is not installed on the server, there is no support for spatial data types. Therefore I installed the nuget package to my project: Install-Package Microsoft.SqlServer.Types This added references to Microsoft.SqlServer.Types and created a

Create a map of spatial clusters LISA in R

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 15:57:18
I would like to create a map showing local spatial cluster of a phenomenon, preferably using Local Moran (LISA). In the reproducible example below, I calculate the local moran's index using spdep but I would like to know if there is as simple way to map the clustes, prefebly using ggplot2 . Help ? library(UScensus2000tract) library(ggplot2) library(spdep) # load data data("oregon.tract") # plot Census Tract map plot(oregon.tract) # create Queens contiguity matrix spatmatrix <- poly2nb(oregon.tract) #calculate the local moran of the distribution of black population lmoran <- localmoran(oregon

Ordering queryset by distance relative to a given position

半世苍凉 提交于 2019-12-05 15:36:24
I have a model containing latitude and longitude information as FloatFields. class Trader(models.Model): latitude = models.FloatField() longitude = models.FloatField() I would like to order this model by an increasing distance from a given position(lat, lon) but can't seem to do so using F() expressions (using haversine library, I haven't succeeded in transforming them into float numbers) Trader.objects.all().annotate(distance=haversine((lat, lon), (float(F('latitude')), float(F('longitude'))))).order_by('distance') This query throws the following TypeError : float() argument must be a string

coordinateSystemId on DbGeography

我怕爱的太早我们不能终老 提交于 2019-12-05 14:51:45
问题 I need to geocode a large number of addresses, using the Bing Map service, EF 5 and SQL Server 2008. I'm using the geography data type in SQL, which translates to a DbGeography type by the EF. When I create a DbGeography object, like this string point = string.Format("POINT({0} {1})",address.Longitude,address.Latitude); address.Location = System.Data.Spatial.DbGeography.PointFromText(point, 4326); The second parameter calls for a "coordinateSystemId". What exactly is this? A lot of the

Trouble with scipy kmeans and kmeans2 clustering in Python

混江龙づ霸主 提交于 2019-12-05 12:33:20
I have a question about scipy's kmeans and kmeans2 . I have a set of 1700 lat-long data points. I want to spatially cluster them into 100 clusters. However, I get drastically different results when using kmeans vs kmeans2 . Can you explain why this is? My code is below. First I load my data and plot the coordinates. It all looks correct. import pandas as pd, numpy as np, matplotlib.pyplot as plt from scipy.cluster.vq import kmeans, kmeans2, whiten df = pd.read_csv('data.csv') df.head() coordinates = df.as_matrix(columns=['lon', 'lat']) plt.figure(figsize=(10, 6), dpi=100) plt.scatter

Parsing latitude and longitude with Ruby

流过昼夜 提交于 2019-12-05 12:04:54
I need to parse some user submitted strings containing latitudes and longitudes, under Ruby. The result should be given in a double Example: 08º 04' 49'' 09º 13' 12'' Result: 8.080278 9.22 I've looked to both Geokit and GeoRuby but haven't found a solution. Any hint? "08° 04' 49'' 09° 13' 12''".gsub(/(\d+)° (\d+)' (\d+)''/) do $1.to_f + $2.to_f/60 + $3.to_f/3600 end #=> "8.08027777777778 9.22" Edit: or to get the result as an array of floats: "08° 04' 49'' 09° 13' 12''".scan(/(\d+)° (\d+)' (\d+)''/).map do |d,m,s| d.to_f + m.to_f/60 + s.to_f/3600 end #=> [8.08027777777778, 9.22] How about

Persistent (Disk Based) R-Tree (or R* Tree)

我是研究僧i 提交于 2019-12-05 10:11:06
How can R* Tree be implemented as a persistent (disk based) one? What is the architecture of the file for saving the R* Tree index or for saving leaf values? Notes: In addition how insert, update and delete operations can be performed in such a persistent R* Tree? Notes II: I have implemented an in-memory R-Tree with bulk load functionality. But I think that is totally irrelevant when we speak about disk-based ones. If you need to have an on-disk R-Tree index, I would suggest using Spatialite or Postgis . Spatialite is lightweight and easy to embed in a standalone application. Alternatively,

GeoSpatial Radius Search Using Objectify

人盡茶涼 提交于 2019-12-05 08:39:10
I am developing an application using GeoModel . I need to perform search in a particular radius based on the given latitude and longitude. I am able to generate the GeoCells in the datastore using Objectify, but not able to get back the results in a particular radius. I am sharing my code below. Entity Class @Entity public class NewsFeed implements Serializable { private static final long serialVersionUID = 1L; @Id @Index private Long feedID; @Index private String topic; @Index private String title; private String description; @Index private Date createDate; private String imageOrVideo;

Maximum length of a decimal latitude/longitude Degree?

南笙酒味 提交于 2019-12-05 08:27:27
What is the maximum length (in kilometers or miles - but please specify) that one degree of latitude and longitude can have in the Earth surface? I'm not sure if I'm being clear enough, let me rephrase that. The Earth is not a perfect circle, as we all know, and a change of 1.0 in the latitude / longitude on the equator (or in Ecuador) can mean one distance while the same change at the poles can mean another completely different distance. I'm trying to shrink down the number of results returned by the database (in this case MySQL) so that I can calculate the distances between several points