이 정확하게 귀하의 질문에 있지만 대안에 대한 답변을하지 않습니다;
나는 안드로이드를 통해 xamarin을 사용하여 leaflet 및/또는 mapbox과 OpenStreetMaps를 사용 해왔다. 주유소 등을 걸러 낼 수 있는지 확실하지 않지만.
다음은 모바일지도를 렌더링하는 데 사용하는 코드입니다.
public class MainActivity : Activity//, ILocationListener
{
private WebView _webView;
private MonkeyWebViewClient _webViewClient;
private MonkeyWebChromeClient _webChromeClient;
...
protected override void OnCreate (Bundle bundle)
{
Log.Verbose (LogAppTag, "Init webview..");
_webView = FindViewById<WebView> (Resource.Id.webView1);
_webView.Settings.JavaScriptEnabled = true;
_webViewClient = new MonkeyWebViewClient (this);
_webChromeClient = new MonkeyWebChromeClient();
_webViewClient.OnLoadComplete += WebLoadComplete;
_webView.SetWebViewClient(_webViewClient);
_webView.SetWebChromeClient(_webChromeClient);
_webView.LoadUrl("file:///android_asset/Content/Map/Map.html");
...
void WebLoadComplete (object sender, EventArgs e)
{
Log.Verbose(Logging.AppTag, "WebLoadComplete()");
_webView.LoadUrl("javascript:SetLocation(" + _location.Latitude + "," + _location.Longitude + ");");
}
...
class MonkeyWebChromeClient : WebChromeClient {
public override bool OnJsAlert(WebView view, string url, string message, JsResult result)
{
// the built-in alert is pretty ugly, you could do something different here if you wanted to
return base.OnJsAlert(view, url, message, result);
}
}
class MonkeyWebViewClient : WebViewClient
{
public bool LoadingFinished { get; private set; }
public delegate void LoadCompleteHandler(object sender, EventArgs e);
public event LoadCompleteHandler OnLoadComplete;
Activity context;
public MonkeyWebViewClient(Activity context)
{
this.context = context;
}
public override bool ShouldOverrideUrlLoading(WebView view, string url)
{
view.LoadUrl (url);
return true;
}
public override void OnPageStarted (WebView view, string url, Android.Graphics.Bitmap favicon)
{
this.LoadingFinished = false;
base.OnPageStarted (view, url, favicon);
}
public override void OnPageFinished (WebView view, string url)
{
this.LoadingFinished = true;
var handler = OnLoadComplete;
if (handler != null) handler(this, EventArgs.Empty);
base.OnPageFinished (view, url);
}
}
여기에 webview에서로드하는 html 코드가 있습니다.
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- mapbox -->
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' />
<!-- mapbox -->
</head>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
<div id="map"></div>
<script src="JS/Map.js"></script>
</html>
그리고 C# 코드와 통신 할 수있는 JS 코드. 맵 박스 위에 새 맵을 만들고 raistlinthewiz.map-oukwofv3 부분을 변경하려고합니다.
// map code.
function SetLocation(lat, lng)
{
var latlng = new L.LatLng(parseFloat(lat), parseFloat(lng));
// mapbox
var map = L.mapbox.map('map', 'raistlinthewiz.map-oukwofv3').setView(latlng, 18);
L.mapbox.markerLayer({ // this feature is in the GeoJSON format: see geojson.org for the full specification
type: 'Feature',
geometry: {
type: 'Point', // coordinates here are in longitude, latitude order because x, y is the standard for GeoJSON and many formats
coordinates: [parseFloat(lng), parseFloat(lat)]
},
properties: { // one can customize markers by adding simplestyle properties http://mapbox.com/developers/simplestyle/
title: 'A Single Marker',
description: 'Just one of me',
'marker-size': 'large'
}
}).addTo(map);
}
바닐라 - 전단지를 사용하는 샘플도 제공 할 수 있습니다.
OpenStreetMap 지원은 어떻습니까? Google지도에 엄격히 구속되지 않은 경우 OpenStreetMap을 사용하는 샘플을 게시 할 수 있습니다. – HuseyinUslu
@HuseyinUslu 내 유일한 요구 사항은 내가 가장 가까운 주유소를 보여주고 사용자가 선택한 주유소에 대한 경로를 그려야한다는 것입니다. OpenStreetMap이 이러한 기능을 지원한다면 나는 당신의 도움에 기뻐할 것입니다. 고마워! –
통합 단계와 API 키를 확인하십시오. http://appliedcodelog.blogspot.in/2015/04/build-google-map-v2-in-xamarin-android에 도움이 될 수 있습니다.htaccess Admin Home English Language Content – Suchith