php怎么做高德地图公安电子围栏布控系统开发

* 高德地图画电子围栏
* $key 需要填写
function DrFence($radius,$c_lon,$c_lat){
$curl = new Curl\Curl();
$url = 'http://restapi.amap.com/v3/assi...
可以新开issue。。。
关于代码发布
发布静态资源看你们自己的部署方案吧。一般是公司内撘一个ci系统,比如jenkins,然后在上面安装运维提供的部署脚本,然后配置gi...
关于APP定位问题是我们再开发中经常遇到的问题。
一般遇到这种问题我们都会去看百度地图,高德地图,或者其他地图上给的解决方案。
但是,你有没有想过自己如果有一天要换...
就在昨天公司迎来了历史性的一刻,代码从私有的SVN 服务器上,搬家到公有云代码管理平台Coding上。
本来以为这是一件很简单的事情,但是却迎来了我噩梦的开始。
第一步:把...
element ★13489 - 饿了么出品的Vue2的web UI工具套件
Vux ★8133 - 基于Vue和WeUI的...
今天的中国,无论你走到哪里,几乎都能看见&奢华&这两个字。每一本时尚生活杂志都在不厌其烦地告诉你有关奢华的故事,每一个商品广告都试图让你感到它要卖的商品有多奢华...
摘要:本文尝试一步步还原HTTPS的设计过程,以理解为什么HTTPS最终会是这副模样。但是这并不代表HTTPS的真实设计过程。在阅读本文时,你可以尝试放下已有的对HTTPS的理解,...
&REST是目前业界相当火热的术语,似乎发布的API不带个REST前缀,你都不好意思和别人打招呼了。 然而大部分号称REST的API实际上并没有达到Richardson成熟度模型的第三个级...
有事扫我↓↓GIS+LBS+Flex+Android+ArcGIS
给定坐标点,判断是否在某区域范围内 地理围栏算法
地图平台:leaflet
index.html
&!DOCTYPE html&
&title&Leaflet 快速开始指南示例&/title&
&meta charset="utf-8" /&
&link rel="stylesheet" href="css/leaflet.css" /&
&div id="map" style="width: 1024 height: 768px"&&/div&
&script src="js/leaflet.js"&&/script&
&script type="text/javascript" src="js/jquery-2.0.3.min.js"&&/script&
&script type="text/javascript" src="js/isPointInPolygon.js"&&/script&
var map = L.map('map').setView([24, 110], 5);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6IjZjNmRjNzk3ZmE2MTcwOTEwMGY0MzU3YjUzOWFmNWZhIn0.Y8bhBaUMqFiPrDRW9hieoQ', {
maxZoom: 18,
attribution: 'Map data & &a href="http://openstreetmap.org"&OpenStreetMap&/a& contributors, ' +
'&a href="http://creativecommons.org/licenses/by-sa/2.0/"&CC-BY-SA&/a&, ' +
'Imagery (C) &a href="http://mapbox.com"&Mapbox&/a&',
id: 'mapbox.streets'
}).addTo(map);
L.marker([24, 100]).addTo(map)
.bindPopup("&b&Hello world!&/b&&br /&我是一个冒泡窗").openPopup();
L.circle([24, 100], 500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(map).bindPopup("我是一个圆");
L.polygon([{
}]).addTo(map);
var popup = L.popup();
function points() {
var points = [{
function onMapClick(e) {
.setLatLng(e.latlng)
.setContent("你刚点击的坐标是 " + e.latlng.toString())
.openOn(map);
/*var hh = IsPtInPoly(119.94, points());*/
var hh = IsPtInPoly(e.latlng.lng,e.latlng.lat, points());
alert(hh);
map.on('click', onMapClick);
&/html&isPointInPolygon.js
function IsPtInPoly(ALon, ALat, APoints) {
var iSum = 0,
var dLon1, dLon2, dLat1, dLat2, dL
if (APoints.length & 3)
iCount = APoints.
for (var i = 0; i & iC i++) {
if (i == iCount - 1) {
dLon1 = APoints[i].
dLat1 = APoints[i].
dLon2 = APoints[0].
dLat2 = APoints[0].
dLon1 = APoints[i].
dLat1 = APoints[i].
dLon2 = APoints[i + 1].
dLat2 = APoints[i + 1].
//以下语句判断A点是否在边的两端点的水平平行线之间,在则可能有交点,开始判断交点是否在左射线上
if (((ALat &= dLat1) && (ALat & dLat2)) || ((ALat &= dLat2) && (ALat & dLat1))) {
if (Math.abs(dLat1 - dLat2) & 0) {
//得到 A点向左射线与边的交点的x坐标:
dLon = dLon1 - ((dLon1 - dLon2) * (dLat1 - ALat)) / (dLat1 - dLat2);
if (dLon & ALon)
if (iSum % 2 != 0)
没有更多推荐了,有时会忘了代码能来创造什么,就像有时会忘了自己还有多远的路。
安卓开发笔记①:利用高德地图API进行定位、开发电子围栏、天气预报、轨迹记录、搜索周边(位置)
本文只是开发小笔记(关键步骤详见其它略讲),有任何不懂的问题可以留言,我必为大家解答以及分享更有用的经验。
高德地图开发时需要导入的包在下面的网盘链接中:(由于高德地图api更新得太快,官网上最新的包使用起来没有之前的方便,所以以下提供最全面的原始包)
链接:http://pan.baidu.com/s/1eR8Nchc 密码:be1v
其中armeabi这个文件夹和其他4个jar是必要导入的,另外两个文件夹确保兼容性。
①首先登陆高德lbs开放平台获取Key,下面是官方详细教程:
http://lbs.amap.com/dev/ticket#/faqcat/1
(本人使用的是eclipse,所以获取安全码SHA1的方法为Windows-&preferences-&android-&build,如下图所示的SHA1 fingerprint)
然后你要设置你所开发的app的包,即在下面的Package中输入你的app包名(这点不能输错)
②申请到key之后,修改安卓项目的AndroidManifest.xml文件,即获取相关的权限和导入key(才能正常启动高德地图)
11个&uses-permission....&就是相关权限的设置,把代码写进去
还有加一个&meta-data....&把你的key导入进去,需要记住android:name="com.amap.api.v2.apikey"
下面的代码都是调试所用,所有信息都将在logcat栏目里面显示。
③进行定位:
package (你的包名);
import com.amap.api.location.AMapL
import com.amap.api.location.AMapLocationL
import com.amap.api.location.LocationManagerP
import com.amap.api.location.LocationProviderP
import com.amap.api.maps.model.MyLocationS
import android.app.A
import android.location.L
import android.os.B
import android.util.L
import android.view.M
import android.view.MenuI
public class MainActivity extends Activity implements AMapLocationListener {
LocationManagerProxy mLocationManagerP
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLocationManagerProxy=LocationManagerProxy.getInstance(this);
mLocationManagerProxy.requestLocationData(LocationProviderProxy.AMapNetwork, 2000, 15, this);
public boolean onCreateOptionsMenu(Menu menu) {
// I this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return super.onOptionsItemSelected(item);
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
mLocationManagerProxy.destroy();
public void onLocationChanged(AMapLocation arg0) {
// TODO Auto-generated method stub
if(arg0!=null&&arg0.getAMapException().getErrorCode()==0){
Log.i("helloworld", arg0.toString());
}④开发电子围栏(也就是设置一个点,可以设置半径,可以监控自己的位置是在圈内还是圈外)
package (你的包名);
import com.amap.api.maps.AMap.OnMapClickL
import com.amap.api.location.AMapL
import com.amap.api.location.AMapLocationL
import com.amap.api.location.LocationManagerP
import com.amap.api.maps.MapV
import com.amap.api.maps.model.CircleO
import com.amap.api.maps.model.LatL
import android.app.A
import android.app.PendingI
import android.content.BroadcastR
import android.content.C
import android.content.I
import android.content.IntentF
import android.location.L
import android.location.LocationM
import android.os.B
import android.util.L
public class GeoFenceActivity extends Activity implements OnMapClickListener,AMapLocationListener{
LocationManagerProxy mLocationManagerP
MapView mapV
String GEOFENCE_BROADCAST_ACTION="com.example.helloworld";
PendingIntent mPendingI
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLocationManagerProxy=LocationManagerProxy.getInstance(this);
mapView=(MapView)findViewById(R.id.main_mapView);
mapView.onCreate(savedInstanceState);
mapView.getMap().setOnMapClickListener(this);
Intent intent=new Intent(GEOFENCE_BROADCAST_ACTION);
mPendingIntent=PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);
IntentFilter intentfilter=new IntentFilter();
intentfilter.addAction(GEOFENCE_BROADCAST_ACTION);
this.registerReceiver(mGeoFenceReceiver, intentfilter);
mLocationManagerProxy.requestLocationData(LocationManager.GPS_PROVIDER,2000,15, this);
private BroadcastReceiver mGeoFenceReceiver=new BroadcastReceiver(){
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.e("helloworld", "收到广播");
int i= intent.getIntExtra("status", -1);
Log.e("helloworld", "在地理围栏内部");
Log.e("helloworld", "在地理围栏外部");
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
mapView.onResume();
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
public void onMapClick(LatLng arg0) {
// TODO Auto-generated method stub
Log.e("helloworld", "lat ="+arg0.latitude);
Log.e("helloworld", "lon ="+arg0.longitude);
mapView.getMap().addCircle(new CircleOptions().center(arg0).radius(1000));
mLocationManagerProxy.addGeoFenceAlert(arg0.latitude, arg0.longitude, *60*30, mPendingIntent);
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
public void onLocationChanged(AMapLocation arg0) {
// TODO Auto-generated method stub
⑤天气预报(现在或未来的):
package (你的包名);
import java.util.L
import com.amap.api.location.AMapLocalDayWeatherF
import com.amap.api.location.AMapLocalWeatherF
import com.amap.api.location.AMapLocalWeatherL
import com.amap.api.location.AMapLocalWeatherL
import com.amap.api.location.LocationManagerP
import android.app.A
import android.os.B
import android.util.L
public class WeatherActivity extends Activity implements AMapLocalWeatherListener{
LocationManagerProxy mLocationManagerP
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLocationManagerProxy=LocationManagerProxy.getInstance(this);
mLocationManagerProxy.requestWeatherUpdates(LocationManagerProxy.WEATHER_TYPE_FORECAST,this);
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
public void onWeatherForecaseSearched(AMapLocalWeatherForecast arg0) {
// TODO Auto-generated method stub
//未来天气
List&AMapLocalDayWeatherForecast& list=arg0.getWeatherForecast();
for(int i=0;i&list.size();i++){
AMapLocalDayWeatherForecast dayweather=list.get(i);
Log.i("helloworld", "城市"+dayweather.getCity());
Log.i("helloworld", "时间"+dayweather.getDate());
Log.i("helloworld", "温度"+dayweather.getDayTemp());
Log.i("helloworld", "风力"+dayweather.getDayWindPower());
public void onWeatherLiveSearched(AMapLocalWeatherLive arg0) {
// TODO Auto-generated method stub
//当天天气
Log.i("helloworld", "城市"+arg0.getCity());
Log.i("helloworld", "湿度"+arg0.getHumidity());
Log.i("helloworld", "风力"+arg0.getWindPower());
⑥轨迹记录(这里是有模拟轨迹数据,如果是真正的设备的话可以把每次定位的数据放入容器中再读取轨迹)
package com.example.
import java.util.ArrayL
import java.util.L
import com.amap.api.location.AMapL
import com.amap.api.location.AMapLocationL
import com.amap.api.maps.AMap.OnMapLoadedL
import com.amap.api.maps.MapV
import com.amap.api.maps.model.LatL
import com.amap.api.maps.model.PolygonO
import android.app.A
import android.location.L
import android.os.B
import android.os.T
public class TrackActivity extends Activity implements OnMapLoadedListener{
double Trace[]={
40.41,116.81,
40..441789,
40.,116.441780,
40..441768,
40..44175,
40..441722,
List&LatLng&
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapview=(MapView)findViewById(R.id.main_mapView);
mapview.onCreate(savedInstanceState);
mapview.getMap().setOnMapLoadedListener(this);
list=new ArrayList&LatLng&();
for(int i=0;i&Trace.length-1;i++){
LatLng latlng=new LatLng(Trace[i], Trace[++i]);
list.add(latlng);
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
mapview.onResume();
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
public void onMapLoaded() {
// TODO Auto-generated method stub
mapview.getMap().addPolygon(new PolygonOptions().addAll(list));
⑦搜索周边位置(以下例子是将搜索范围确定在“杨小贤”,“餐饮”,“广州市”)并且是以自己所在大学城位置为中心半径为200000m范围内搜索:package (你的包名);
import java.util.L
import com.amap.api.location.AMapL
import com.amap.api.location.AMapLocationL
import com.amap.api.location.LocationManagerP
import com.amap.api.location.LocationProviderP
import com.amap.api.maps.MapV
import com.amap.api.services.core.LatLonP
import com.amap.api.services.core.PoiI
import com.amap.api.services.poisearch.PoiItemD
import com.amap.api.services.poisearch.PoiR
import com.amap.api.services.poisearch.PoiS
import com.amap.api.services.poisearch.PoiSearch.OnPoiSearchL
import com.amap.api.services.poisearch.PoiSearch.SearchB
import android.app.A
import android.location.L
import android.os.B
import android.util.L
import android.view.V
import android.view.View.OnClickL
import android.widget.B
public class SearchActivity extends Activity implements AMapLocationListener,OnPoiSearchListener,OnClickListener {
LocationManagerProxy mLocationManagerP
MapView mapV
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView=(MapView)findViewById(R.id.main_mapView);
mapView.onCreate(savedInstanceState);
mLocationManagerProxy=LocationManagerProxy.getInstance(this);
mLocationManagerProxy.requestLocationData(LocationProviderProxy.AMapNetwork, 2000, 15, this);
Button button=(Button)findViewById(R.id.button);
button.setOnClickListener(this);
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
public void onLocationChanged(AMapLocation arg0) {
// TODO Auto-generated method stub
location=arg0;
Log.e("helloworld", arg0.toString());
public void onPoiItemDetailSearched(PoiItemDetail arg0, int arg1) {
// TODO Auto-generated method stub
public void onPoiSearched(PoiResult arg0, int arg1) {
// TODO Auto-generated method stub
if(arg1==0){
List&PoiItem&list=arg0.getPois();
for(int i=0;i&list.size();i++){
PoiItem item=list.get(i);
Log.e("helloworld", item.toString());
public void search(){
PoiSearch.Query query=new PoiSearch.Query("杨小贤", "餐饮", "广州市");
query.setPageSize(10);//每页显示多少个poiitem
query.setPageNum(0);
PoiSearch poiSearch=new PoiSearch(this, query);
poiSearch.setOnPoiSearchListener(this);
LatLonPoint poinot=new LatLonPoint(location.getLatitude(), location.getLongitude());
poiSearch.setBound(new SearchBound(poinot, 200000, true));
poiSearch.searchPOIAsyn();
public void onClick(View v) {
// TODO Auto-generated method stub
没有更多推荐了,想用java 做一个平台,能够调用百度或高德地图并在地图上设置电子围栏_百度知道
想用java 做一个平台,能够调用百度或高德地图并在地图上设置电子围栏
,能够判断汽车的出栏和入栏,显示实时定位位置和轨迹回放,想要源代码,谢谢啦
我有更好的答案
亲,您的这个问题可以到这个网址创建工单哦:
采纳率:89%
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。地理围栏实现
[问题点数:40分]
本版专家分:0
结帖率 66.67%
CSDN今日推荐
匿名用户不能发表回复!|
其他相关推荐

我要回帖

更多关于 高德地图2017手机导航 的文章

 

随机推荐