coordinates

Convert lat/lon to pixels and back

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-06 15:19:07
问题 I'm using google maps in my application, and I have a webserver with a databse filled with lat/lon values. I want to mark them on the map, but I also want to cluster them together if they are within a certain pixel-distance of eachother. I figure if I retrieve all my points from the database, I should be able to do something like this (pseudocode): clusters[]; while(count(points)) { cluster[]; point = points.pop(); boundingbox = pixelsToBB(point, pixeldistance, zoomlevel); query = "select *

Calculate distance between two x/y coordinates?

对着背影说爱祢 提交于 2021-02-06 07:56:53
问题 I would like to calculate the distance between two x/y coordinates on the surface of a torus. So, this is a normal grid that has the property that its corners and sides are 'connected'. For example, on a grid of 500x500, the point at (499, 499) is adjacent to (0, 0) and the distance between e.g. (0,0) and (0,495) should then be 5. Is there any good mathematical way of calculating this? 回答1: So you are looking for the Euclidean distance on the two-dimensional surface of a torus, I gather. sqrt

get Coordinates of matplotlib plot figure python with mouse click

£可爱£侵袭症+ 提交于 2021-02-05 05:49:26
问题 I have been trying to get the mouse x,y coordinates to variables according to matplotlib plot scale not pixels but it only returns me the integer components like 0.0 or 1.0 I want to return the accurate number like 0.1245 here is my code import matplotlib import Tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure import numpy as np import matplotlib.pyplot as plt def onclick(self,event): ix, iy = float

How to get 3D coordinates from distance, azimuth and elevation

青春壹個敷衍的年華 提交于 2021-01-29 17:56:57
问题 I'm working in a 3D environment (a 100x100x100 virtual cube) where each point is defined by its x, y and z position. We have two points: A with position x:20 y:35 z:40 and B x:50 y:40 z:85. Using this algo (https://gis.stackexchange.com/questions/108547/how-to-calculate-distance-azimuth-and-dip-from-two-xyz-coordinates) I'm able to find the distance, the azimuth and the elevation of B seen from A. let ax = 20; let ay = 35; let az = 40; let bx = 50; let by = 40; let bz = 85; let dx = bx-ax;

Is there an easy way to create square buffers around point and if they intersect, merge them?

99封情书 提交于 2021-01-29 13:58:04
问题 I am trying to create square buffers around given points, I am able to create circular buffers but not square ones. from shapely.ops import transform from shapely.geometry import Point local_azimuthal_projection = "+proj=aeqd +R=6371000 +units=m +lat_0={} +lon_0={}".format(lat, lon) wgs84_to_aeqd = partial( pyproj.transform, pyproj.Proj('+proj=longlat +datum=WGS84 +no_defs'), pyproj.Proj(local_azimuthal_projection), ) aeqd_to_wgs84 = partial( pyproj.transform, pyproj.Proj(local_azimuthal

What format are ATOC master stations file “Eastings” and “Northings” in?

故事扮演 提交于 2021-01-29 07:30:02
问题 The Problem I have downloaded the Master Stations Names File from the UK's Rail Delivery group. I'm trying to map the dataset and would like to extract the locations. I tried using pyproj in my Python script, but the results are wrong. The "Eastings" and "Northings" they provide don't seem to fit the National Grid. For example: York station is given as "14596 64517". If these were epsg:27700, they would translate to -7.420284219986337 50.35401717940486, which is somewhere off the coast of

AstroPy SkyCoord extremely slow, how to resovle it?

穿精又带淫゛_ 提交于 2021-01-28 23:34:24
问题 I am using AstroPy SkyCoord to do conversion from equatorial coordinates to galactic coordinates with millions data, it is extremely slow. Anyone has idea to speed it up, otherwise it takes forever to run the whole dataset. The code is below: from astropy import units as u from astropy.coordinates import SkyCoord import numpy as np ra1 = np.loadtxt('data.txt',usecols=(0,)) dec1 = np.loadtxt('data.txt',usecols=(1,)) size = len(ra1) for i in range(size): ra = ra1[i] dec = dec1[i] c = SkyCoord

Click image 1 time, get position and destroy window OpenCv

穿精又带淫゛_ 提交于 2021-01-28 09:50:57
问题 Is there a simple way to open an image using OpenCv, and keep it open until it is clicked, then return the pixel coordinate and destroy the image, almost like using WaitKey() just with a return, and click as trigger? 回答1: This should do what you want: #!/usr/bin/env python3 import cv2 import numpy as np def onClick(event,x,y,flags,param): """Called whenever user left clicks""" global Running if event == cv2.EVENT_LBUTTONDOWN: print(f'I saw you click at {x},{y}') Running = False # Create

Expand list of coordinates to get all combinations within a group in R

懵懂的女人 提交于 2021-01-28 09:22:28
问题 I have a DF with about 1 million records. Each record includes latitude and longitude, and the records are grouped as in the example data (except with much larger groups) data.frame(Latitude=c(-30.25,-30.89,-30.48,-30.10), Longitude=c(116.321,116.98,116.78,116.38), grp=c('a','a','b','b')) Within each group I need to find the maximum distance between any two sets of coordinates. Once I have all combinations of coordinates in a DF with I can calculate distances no problems, but can not

How to create grid for coordinates for Prediction in R

一曲冷凌霜 提交于 2021-01-28 09:16:38
问题 I'm using Gaussian Process model for prediction, and I'm now at the point where I need to use Grid file based on the coordinates I have in my data but I don't have one and I don't know how to create it. I followed the post on this link , but it shows the grid on Pennsylvania not Chicago where my data coordinates located! So I'm confused which will be the ideal way to create grid file including the other columns in the data. station <- data.frame(lat = c(41.997946, 41.960669, 41.960669, 41