location

How to convert a map location (lat, lng) pair to a screen position (x, y) pair in mapbox

可紊 提交于 2019-12-07 12:18:49
问题 I am using mapbox javascript API to do some cool stuff on a map. Now I have a map location (latitude, longitude) pair and I want to set the view to this location then use javascript to simulate a click at this location. The problem is that I need to find out the screen position (x, y) pair of this location after setting the view. But how do I do that? It seems there is an API L.ICRS. I tried but it returned NaN for both x and y -- please check my example javascript codes below. var latlng =

Getting the location periodically and plotting markers to map

大城市里の小女人 提交于 2019-12-07 11:52:50
问题 I'm looking to create an app in android that basically tracks a phones location and periodically adds a marker to the google maps api so that a route can be displayed, the problem I have is that I don't know how to get the location periodically and in the background. Here is my code: public class MapsActivity extends FragmentActivity implements LocationListener { private GoogleMap mMap; // Might be null if Google Play services APK is not available. Button btnCurrent, btnPrevious; ArrayList

一些NGINX配置

廉价感情. 提交于 2019-12-07 11:38:30
nginx配置 开年第一篇, 梳理笔记本中.... 没啥, 一些用到以及后面可能用到的 nginx 配置, 记录一下, 备查备用 ps. 之前一篇 nginx基础笔记 使用独立目录, 然后include具体配置 目录 nginx.conf site/ a.conf b.conf nginx.conf http { ....... include /etc/nginx/conf.d/*.conf; include sites/*.conf; } gzip on 加到 http 模块中, 开启 gzip , 注意 gzip_types 配置得是压缩的资源类型 nginx.conf http { ..... gzip on; gzip_min_length 1k; gzip_comp_level 5; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css application/javascript text/javascript application/x-javascript text/xml application/xml application/xml+rss application/json image/x-icon image/png image/jpg

Nginx 常用基础模块

痞子三分冷 提交于 2019-12-07 11:36:28
文章目录 Nginx 常用基础模块 Nginx日志管理 nginx日志切割 Nginx目录索引 Nginx状态监控 Nginx访问控制 Nginx访问限制 Nginx 请求限制配置实战 Nginx Location Nginx 常用基础模块 Nginx日志管理 Nginx有非常灵活的日志记录模式,每个级别的配置可以有各自独立的访问日志。日志格式通过log_format命令定义格式。 log_format详解 在nginx默认的配置文件中,log_format已经将日志格式定死,但是我们可不可以修改呢? 1.log_format的作用是定义日志格式语法 配置语法: 包括: error.log access.log Syntax: log_format name [escape=default|json] string ...; Default: log_format combined "..."; Context: http 2.nginx默认日志格式语法如下: log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 3

nginx基础配置篇

牧云@^-^@ 提交于 2019-12-07 11:35:13
序言 nginx是非常流行的一个http反向代理服务器,虽然不是专业的运营人员,但作为开发人员,掌握一些基本的用法也是蛮必要的,本篇记录nginx的一些基本配置。 调整工作进程数 nginx启动会创建主进程和工作进程,默认只会创建一个工作进程用于处理连接(底层使用epoll等事件处理模型),如果是多核服务器,建议把工作进程的数量设置为cpu的核数,如8核cpu可以如下设置: worker_processes 8; 基本资源访问 1) 最常见的nginx用法就是把它当作一个静态资源服务器,先看一个最简单的例子: 在本机hosts文件中如下配置: 127.0.0.1 static.test.com nginx.conf配置server: server { listen static.test.com; root D:/learn/static; } 然后访问 http://static.test.com/hello.js 即可以访问到 D:/learn/static/hello.js。 2) 我们也可以配置多个域名同时访问同一个资源 在hosts中添加如下映射:127.0.0.1 static2.test.com nginx.conf配置server: server { listen 80; server_name static.test.com static2.test.com;

iOS 8 - Can't get current location, Error Domain=kCLErrorDomain Code=0

◇◆丶佛笑我妖孽 提交于 2019-12-07 11:12:14
问题 I've problem with getting my current location. I still getting error: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)" I already did everything that I found here: Reset content and settings in iOS Simulator (map application in simulator shows correct location). In Xcode at Product>Scheme>Edit I unmarked Allow Location Simulation (when I mark it,It simulate e.g. London). I have added NSLocationWhenInUseUsageDescription to Info.plist file in my

Getting current location in Android Studio app

走远了吗. 提交于 2019-12-07 10:26:35
问题 I am developing my first Android app which should get the latitude and longitude of an android device and send it via a web service to a template document. I followed the guide of getting the location from http://developer.android.com/training/location/retrieve-current.html. This is the code from my .java class: import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.Location; import android.location.LocationManager;

How get the current latitud and longitud without use getLastKnownLocation method in Android?

社会主义新天地 提交于 2019-12-07 09:48:42
问题 I am trying to get the current position of the phone, for this I use the GPSTracker tutorial, the problem is always use the method getLastKnownLocation and return older position. if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location !=

get the current location (gps/wifi)

可紊 提交于 2019-12-07 09:28:19
问题 I'm trying to get my location using it like this: LocationManager myLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); String provider = myLocationManager.getBestProvider(criteria,true); if (provider != null) { //there is a provider

Getting Android Location and return “unknown” or null when providers are unavailable

我们两清 提交于 2019-12-07 07:43:29
I'm using this script by Fedor but I want a little difference: When both GPS and Network Provider is unavailable, I want to app to return null or "unknown" string. I modified the script, but when I run, it force closes, the logcat says: I have the following codes: MyLocation.java package com.example.GetALocation2; import java.util.Timer; import java.util.TimerTask; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; public class MyLocation { Timer timer1; LocationManager