coordinates

GPS location on iOS and Android

一世执手 提交于 2019-12-01 14:22:32
I have limited experience programming Android apps and none at all for iOS. Part of a future project of mine is to make my app be able to record the current location using GPS possibly on both Android and iOS. Can the GPS coordinates be taken in "Universal Transverse Mercator" format like in Google Earth for both platforms? If not, is there some way to calculate the coordinates to this format? EDIT: Any chance anyone would know what format the functions in their respective APIs return? The API will provide a location object (class Location for Android and CLLocation for iOS). Both API have

from list of tuples, get tuple closest to a given value

落花浮王杯 提交于 2019-12-01 13:41:41
Given a list of tuples containing coordinates, I want to find which coordinate is the closest to a coordinate I give in input: cooList = [(11.6702634, 72.313323), (31.67342698, 78.465323)] coordinate = (11.6702698, 78.113323) takenearest(myList, myNumber) ... (11.6702634, 72.313323) Please let me know... For your data cooList = [(11.6702634, 72.313323), (31.67342698, 78.465323)] coordinate = (11.6702698, 78.113323) the shortest Pythonic answer is: nearest = min(cooList, key=lambda x: distance(x, coordinate)) with a function distance(a, b) returning the distance between the points a and b as a

Getting magnetic field values in global coordinates

半腔热情 提交于 2019-12-01 13:14:29
For an Android application, I need to get magnetic field measurements across the axis of global (world's) coordinate system. Here is how I'm going (guessing) to implement this. Please, correct me if necessary. Also, please, note that the question is about algorithmic part of the task, and not about Android APIs for sensors - I have an experience with the latter. First step is to obtain TYPE_MAGNETIC_FIELD sensor data ( M ) and TYPE_ACCELEROMETER sensor data ( G ). The second is supposed to be used according to Android's documentation, but I'm not sure if it shouldn't be TYPE_GRAVITY instead

Coordinate Algorithm - Rotate around the center

强颜欢笑 提交于 2019-12-01 13:12:35
By looking at this image I think you will understand my problem pretty well: (image removed - url no longer valid, returns advertising now) So basically I want a function that takes an object as parameter and gives this object the correct coordinates based on how many objects I've added before. Let's say I would add all these objects to an array: objectArray[] Each time I add a new object: objectArray.add(object) The object.x and object.y coordinates will be set based on some algorithm: object.x = ? object.y = ? (I'm working in Java) Thanks for any help. Here's the closed-form solution that

Create buffer and count points in R

拜拜、爱过 提交于 2019-12-01 12:49:56
问题 I asked this question previously but did not get a response, so I'll try and do a better job this time around! I want to analyze spatial density of gas station points using R. I need to create a buffer (let's say 1,000m) around the gas stations and count the number of gas stations within the buffer. I'll then need to play around with buffer distances to see what's a reasonable buffer to see something interesting. I won't post the entire shape file because it's fairly messy, but this is what

Shape connectors in Visio

橙三吉。 提交于 2019-12-01 12:37:56
I'm writing an Add-In to Visio 2010 in Studio 2010 on C#. I need to read a diagram currently opened in Visio. I know how to read shapes of the diagram. The question is if I have a shape object, which properties can give me coordinates of the shape on the page and other shapes (if any), the current one is connected with, if I have a connector object, which properties can give me shapes it connects and direction of the connection. Connections in Visio are handled through Connect objects. Each shape has a collection of incoming connect objects and outgoing connect objects. Their names are

How do I get the mouse coordinates using mousedown in d3?

不想你离开。 提交于 2019-12-01 12:29:58
问题 I am trying to create a graph in D3 where you can draw a square to zoom in. Right now, I am trying to get the mousedown function to work. I need to be able to click anywhere in the graph and get the coordinates. This is what I have now: svg.on("mousedown", mousedown) function mousedown() { console.log(event.clientX); } I know this is not correct, but I can't seem to find how I can access the mouse's coordinates. 回答1: firstly, you need to set up the click event properly. svg.on('mousedown',

Barycentric coordinates of a tetrahedron

∥☆過路亽.° 提交于 2019-12-01 12:22:33
I would like to ask for help regarding barycentric coordinates of a tetrahedron: Following an approach I found here: http://www.cdsimpson.net/2014/10/barycentric-coordinates.html i implemented a C++ function for finding barycentric coordinates of a point in a tetrahedron: float ScTP(const Vec &a, const Vec &b, const Vec &c) { // computes scalar triple product return Dot(a, Cross(b, c)); } Vec4f bary_tet(Vec3f a, Vec3f b, Vec3f c, Vec3f d, Vec3f p) { float va, vb, vc, vd, v; Vec3f vap = p - a; Vec3f vbp = p - b; Vec3f vcp = p - c; Vec3f vdp = p - d; Vec3f vab = b - a; Vec3f vac = c - a; Vec3f

Convert Scene's (x, y) to screen's (x, y)

限于喜欢 提交于 2019-12-01 12:17:35
问题 I have an application built with SceneKit that is currently displaying several nodes. I can figure out which node is pressed and want to use that to make a label appear below the Node that was touched. Now, when I set the label's center the following way... nameLabel.center = CGPointMake(CGFloat(result.node.position.x), CGFloat(result.node.position.y+20) …it appears in the upper left corner since the node is on (1, 0) . What I figured is that the sceneView's (0, 0) is in the center of the

CLLocationManager didUpdateLocations not being called

China☆狼群 提交于 2019-12-01 11:10:51
I am in the process of learning iOS 8 app development with Swift. I have followed a tutorial on Treehouse that walks you through building a weather app in Swift and iOS 8. As an improvement to the app, the author/tutor suggests using CLLocationManager to get the location of the device to feed into the weather API instead of the hard coded latitude and longitude values. So having read various tutorial online, I have gone ahead and attempted to implement this suggested improvement. I have placed the code responsible for getting the location coordinates inside the AppDelegate.swift file.