标签: location

寻找2点之间距离的新方法

我使用以下代码来查找2点之间的距离:

CLLocation *location1 = [[CLLocation alloc] initWithLatitude:28.3636 longitude:-77.1212];

CLLocation *location2 = [[CLLocation alloc] initWithLatitude:42.353297 longitude:-71.578858];

float target = [location1 getDistanceFrom:location2];
Run Code Online (Sandbox Code Playgroud)

但现在Apple已弃用getDistanceFrom.

我应该尝试执行相同的任务?

iphone location distance

0
推荐指数
1
解决办法
1420
查看次数

0
推荐指数
1
解决办法
7365
查看次数

php header()在localhost中工作但不在live server上工作?

if ($num_rows == 0 && $num_rows2 == 0) {
    echo 'result1';
    header('Location:enter-work.php');
    die();
} else if ($num_rows >= 0 || $num_rows2 >= 0) {
    echo 'result2';
    header('Location:similar-work.php');
    die();
}
Run Code Online (Sandbox Code Playgroud)

我有上面的代码,我正在测试,并且每次使用此代码刷新页面时它都正确地回显示例文本'result1'或'result2',但它没有重定向到enter-work.php或类似的-work.php就像在我的localhost服务器上一样.在我的本地主机服务器上,我甚至可以将其链接到在线网站(即google.com).我在编写任何html之前输入了上面的代码 - 所以甚至在声明doctype之前.

不确定是什么导致了这个问题,需要一些帮助.

编辑:正如Pekka在他的评论中所提到的(在选定的答案上)问题是我在header()函数之前有回声和空格.

php location header

0
推荐指数
1
解决办法
4130
查看次数

在android中从纬度和经度获取位置的地址

我正在构建一个应用程序.现在我正在获取地图以及触摸位置的纬度和经度.我还想要与纬度和经度对应的触摸位置的地址.我怎样才能实现这一目标?

 public class MapViewEvents extends MapActivity {

 private TextView myLongitude, myLatitude;
 String result1;
 private Context context;
 private MapView myMapView;
 private MapController myMapController;
 private double la;
 private double lo;
@Override
protected void onCreate(Bundle icicle) {
    // TODO Auto-generated method stub
    super.onCreate(icicle);
    setContentView(R.layout.mymapview);

    myMapView = (MapView)findViewById(R.id.mapview);
    myMapController = myMapView.getController();  
    myMapView.setBuiltInZoomControls(true);

    myLongitude = (TextView)findViewById(R.id.longitude);
    myLatitude = (TextView)findViewById(R.id.latitude);

        la= RoamMeo_Config.Gpslatitude;
        lo=RoamMeo_Config.Gpslongitude;

        int latitude = (int)(la * 1000000);
        int longitude = (int)(lo * 1000000);

        GeoPoint initGeoPoint = new GeoPoint(latitude, longitude);
        CenterLocation(initGeoPoint);

        Button nxt_button = (Button) …
Run Code Online (Sandbox Code Playgroud)

android location google-maps street-address

0
推荐指数
1
解决办法
9265
查看次数

CLLocationManager - iPhone应用程序中的自定义位置管理器

我对这项技术很陌生,所以请帮助我.

我正在使用CLLocationManager来获取当前位置,我的应用程序有自定义设置,显示他已经允许当前位置的状态,即我们写时默认出现的消息提示

[self.locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

如果用户点击不允许该消息提示并返回到我的应用程序自定义设置并更改关闭按钮以获取位置,我可以获取用户的当前位置.

如何实现这个东西,请帮忙.

提前致谢

iphone location cllocationmanager ios

0
推荐指数
1
解决办法
6317
查看次数

System.Drawing.Point运算符错误

可能重复:
如何在向两个点添加两个点的同时使+运算符工作?

我的代码

position.Location = (e.Location + pic1.Location) - bild_posi.Location;
Run Code Online (Sandbox Code Playgroud)

错误如:

the operator "+" isnt compatible with "System.Drawing.Point + System.Drawing.Point"
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

c# location operators picturebox

0
推荐指数
1
解决办法
1136
查看次数

php表头重定向无法正常工作

试图在我的头命令中找到我的重定向不能正常工作.表单发送信息,但从不重定向到登录页面.我仍然用PHP代码在耳朵后面湿透,所以请对我的无知感到不满.HH

<?php
// Get email address
require_once 'config.php';
// Ensures no one loads page and does simple spam check
if( isset($_POST['name']) && empty($_POST['spam-check']) ) {    
    // Declare our $errors variable we will be using later to store any errors
    $error = '';    
    // Setup our basic variables
    $input_name = strip_tags($_POST['name']);
    $input_email = strip_tags($_POST['email']);
    $input_subject = strip_tags($_POST['subject']); 
    // We'll check and see if any of the required fields are empty
    if( strlen($input_name) < 2 ) $error['name'] = 'Please enter your name.'; …
Run Code Online (Sandbox Code Playgroud)

php forms redirect location header

0
推荐指数
1
解决办法
571
查看次数

C阵列 - 最大的数字和它的位置

我在数组中编写了一个5x6随机数的代码,如何在其中找到最大数字然后打印它的位置(x,y)?

#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main () {
 int array[5][6];
 srand(time(NULL));
 int x, y;
 for(x = 0; x < 5; x++) {
    for(y = 0; y < 6; y++) {
        array[x][y] = rand() % 31 + 10;
        printf("%d \t", array[x][y]);
   }
   printf("\n");
  }
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

c arrays location numbers

0
推荐指数
1
解决办法
240
查看次数

如何在AngularJS中将查询字符串附加到url?

我是棱角分明的新手.我有带输入文本框的搜索页面来搜索customerId,但我想添加一个功能,我可以根据url字符串进行搜索.

例如,我的网址是:

http://localhost:8080/#/search
Run Code Online (Sandbox Code Playgroud)

但我需要类似的东西

http://localhost:8080/#/search?ACC34ff 
Run Code Online (Sandbox Code Playgroud)

http:// localhost:8080 /#/ search?CustomerId以便我可以在url中基于customerId进行搜索

有人可以告诉我如何添加查询字符串?

app.config(['$routeProvider',
function($routeProvider) {
    $routeProvider
    .when('/home', {
        templateUrl: 'partials/home.html',
        controller: 'homePageCtrl',
        reloadOnSearch: true
    }).when('/features', {
        templateUrl: 'partials/features.html',
        controller: 'featuresCtrl',
        reloadOnSearch: false
    }).when('/search', {
        templateUrl: 'partials/search.html',
        controller: 'searchCtrl',
        reloadOnSearch: false
    }).otherwise({
        redirectTo: '/home'
    });
}]);
Run Code Online (Sandbox Code Playgroud)

控制器:

appControllers.controller('searchCtrl', ['$scope','$route','$filter', '$http', '$location','$window','$timeout',
    function($scope, $route, $filter, $http, $location, $window, $timeout) {

        $scope.searchCustomerFeatures = function () {

            if($scope.customerId != null) {

            $http.get('/getCustomerFeatures.do', {params: {'customerId': $scope.customerId}}).success(function (data) {

                $scope.featuresJson = angular.toJson(data, true);
                });
            }
        }
    }]); …
Run Code Online (Sandbox Code Playgroud)

javascript url location query-string angularjs

0
推荐指数
1
解决办法
7913
查看次数

navigator.getCurrentPosition()在Firefox或Safari中均不起作用

我似乎无法在Firefox 65或Safari 10上使用navigator.getLocation()

function getLocation(user_radius) {

var geo_options = {
enableHighAccuracy: true, 
maximumAge        : 30000, 
timeout           : 27000
};

function error(err) {
console.warn('Cannot load user location. Make sure you gave permission to share location');
}

document.body.style.position = "absolute";

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function (position) {

        lat0 = position.coords.latitude;
        long0 = position.coords.longitude;
        corefunction(user_radius);
    },error,geo_options);
} else {
    x.innerHTML = "Geolocation is not supported by this browser.";
}
}
Run Code Online (Sandbox Code Playgroud)

尽管Firefox要求访问位置,而Safari不要求访问位置,但它们都不会返回纬度或经度。Firefox和Safari日志:

*Cannot load user location. Make sure you gave.....*
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

是的,我授予了权限,是的,我都同时启用了定位服务。该代码可以在Opera,Chrome,IE和Edge中正常工作。

奇怪的是,即使有第三方页面,我也无法通过那些浏览器获取位置信息:

https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation https://developer.mozilla.org/zh-CN/docs/Web/API/Geolocation_API …

javascript browser location

0
推荐指数
1
解决办法
483
查看次数