geospatial

Geotools: bounding box for a buffer in wgs84

社会主义新天地 提交于 2019-12-07 15:41:20
问题 I am need a Java function that will generate a bounding box (rectangle) around a buffer. The buffer is defined by the center point (WGS84 coordinate) and the radius (in meters). Getting a bounding box for a buffer in JTS seems to be quite simple: Point center = .... Geometry boundingBox = center.buffer(...).getEnvelope(); This however is pure planar geometry. Is there a way to do this using a coordinate reference system with the distance given in meters? Optimally with Geotools but other Java

Geospatial Indexing with a simple key first

和自甴很熟 提交于 2019-12-07 14:24:52
问题 After reading about MongoDB and Geospatial Indexing I was amazed that it did not support compound keys not starting with the 2d index. I dont know if I would gain anything on it, but right now the mssql solution is just as slow/fast. SELECT TOP 30 * FROM Villages WHERE SID = 10 ORDER BY (math to calc radius from the center point) This works, but is slow because it not smart enough to use a index so it has to calc the radius for all villages with that SID. So in Mongo I wanted to create an

Query database values based on user's location

痞子三分冷 提交于 2019-12-07 10:01:33
问题 How can I perform a query on the database as per the user's location value? The application was developed with HTML5, CSS, Javascript, PHP has a database with columns as in the below table. On the html webpage the users geo coordinates are collected and are to be compared with the values in the database to find the nearest place to the user with the places in the database. Please let me know how to achieve this. Any examples / samples will be appreciated. 回答1: There is a question that

Finding nearest places using point datatype and st_distance_sphere in MySQL 8

邮差的信 提交于 2019-12-07 08:53:41
问题 I have a table called place : id | name | coordinates (longitude, latitude) 1 | London | -0.12574, 51.50853 2 | Manchester | -2.25, 53.41667 3 | Glasgow | -4.25, 55.86667 The coordinates column is of the point datatype . I inserted the points into the place table using: st_geomfromtext('point($longitude $latitude)', 4326) Notice that I've made use of the SRID. Given any coordinates, I'd like to find the nearest places to it (order by ascending). The solution I have currently come up with (by

Create a map of spatial clusters LISA in R

柔情痞子 提交于 2019-12-07 08:10:49
问题 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

Trouble with scipy kmeans and kmeans2 clustering in Python

别说谁变了你拦得住时间么 提交于 2019-12-07 07:47:49
问题 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()

Maximum length of a decimal latitude/longitude Degree?

会有一股神秘感。 提交于 2019-12-07 06:08:57
问题 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

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

三世轮回 提交于 2019-12-07 06:02:35
问题 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. 回答1: If you need to have an on-disk R-Tree index, I would suggest using

RTree: Count points in the neighbourhoods within each point of another set of points

☆樱花仙子☆ 提交于 2019-12-07 00:40:54
问题 Why is this not returning a count of number of points in each neighbourhoods (bounding box)? import geopandas as gpd def radius(points_neighbour, points_center, new_field_name, r): """ :param points_neighbour: :param points_center: :param new_field_name: new field_name attached to points_center :param r: radius around points_center :return: """ sindex = points_neighbour.sindex pts_in_neighbour = [] for i, pt_center in points_center.iterrows(): nearest_index = list(sindex.intersection((pt

How do I use a geospatial query in the 2.1 MongoDB C# driver?

不羁岁月 提交于 2019-12-06 19:49:04
问题 I've been banging my head on this one for days. I have a very simple query I'm trying to run in C#, it looks like this in the shell. db.runCommand({geoNear: "items", near: {type: "Point", coordinates : [-111.283344899999, 47.4941836]}, spherical : true, distanceMultiplier: 3963.2, maxDistance : 25}); My collection looks like this { "_id" : ObjectId(), "Title" : "arst", "Description" : "<p>arst</p>", "Date" : new Date("11/29/2015 09:28:15"), "Location" : { "type" : "Point", "Coordinates" : [