我尝试了this链接,但我无法找到以下类。
GoogleMapPlaceClass ;
GeoCodeJSONClass ;
我要做的是使用自动填充搜索某个地方,当我完成地名后,必须在移动设备屏幕上的Google地图上看到该标记。
有人可以帮助我或告诉我在哪里可以找到这门课程吗?
由于
答案 0 :(得分:1)
我花了一些时间再次回到这个问题,我意识到从Google MAP API发送的数据是json格式的,我正等着有人来上课。我发现我可以将String json数据转换为免费在线的类对象。
所以我将书面数据粘贴到jsonToCsharp,我得到了所需的课程。下面我发布了类结构,以便任何人都可以在Xamerin Andriod或任何其他平台上将其用于Google MAP API自动完成。
GoogleMapPlaceClass&类GeoCodeJSONClass。
public class MatchedSubstring
{
public int length { get; set; }
public int offset { get; set; }
}
public class MainTextMatchedSubstring
{
public int length { get; set; }
public int offset { get; set; }
}
public class StructuredFormatting
{
public string main_text { get; set; }
public List<MainTextMatchedSubstring> main_text_matched_substrings { get; set; }
public string secondary_text { get; set; }
}
public class Term
{
public int offset { get; set; }
public string value { get; set; }
}
public class Prediction
{
public string description { get; set; }
public string id { get; set; }
public List<MatchedSubstring> matched_substrings { get; set; }
public string place_id { get; set; }
public string reference { get; set; }
public StructuredFormatting structured_formatting { get; set; }
public List<Term> terms { get; set; }
public List<string> types { get; set; }
}
public class GoogleMapPlaceClass
{
public List<Prediction> predictions { get; set; }
public string status { get; set; }
}
public class AddressComponent
{
public string long_name { get; set; }
public string short_name { get; set; }
public List<string> types { get; set; }
}
public class Northeast
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Southwest
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Bounds
{
public Northeast northeast { get; set; }
public Southwest southwest { get; set; }
}
public class Location
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Northeast2
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Southwest2
{
public double lat { get; set; }
public double lng { get; set; }
}
public class Viewport
{
public Northeast2 northeast { get; set; }
public Southwest2 southwest { get; set; }
}
public class Geometry
{
public Bounds bounds { get; set; }
public Location location { get; set; }
public string location_type { get; set; }
public Viewport viewport { get; set; }
}
public class Result
{
public List<AddressComponent> address_components { get; set; }
public string formatted_address { get; set; }
public Geometry geometry { get; set; }
public string place_id { get; set; }
public List<string> types { get; set; }
}
public class GeoCodeJSONClass
{
public List<Result> results { get; set; }
public string status { get; set; }
}
link of how to implement Autocomplete with google map api with google map in Xamarin android 谢谢,