天道酬勤,学无止境

google-maps

使用 LatLng 放置标记时出现奇怪的异常(Weird Exception when placing a marker with LatLng)

问题 我有这个代码应该使用 LatLng 在地图上放置一个标记 ... geocoder = Geocoder.create(); myOptions = MapOptions.create(); myOptions.setZoom(18); myOptions.setMapTypeId(MapTypeId.HYBRID); myOptions.setMapMaker(true); map = GoogleMap.create( Document.get().getElementById("map_canvas"),myOptions); location = LatLng.create(45.48592686713835,-73.49009937672122); map.setCenter(location.getGeometry().getLocation()); marker = Marker.create(); marker.setMap(map); marker.setPosition(location.getGeometry().getLocation()); location = LatLng.create(45.48592686713835,-73.49009937672122); map.setCenter(location.getGeometry()

2021-10-27 04:02:31    分类:技术分享    google-maps   gwt   exception

如何在空对象引用上修复“void android.widget.TextView.setText(java.lang.CharSequence)”?(How can I fix 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference?)

问题 我是安卓新手。 我目前正在开发一个应用程序,它在地图上显示多个位置,其标记位置取自我已经设置的中央数据库,我知道如何解决我的问题。 这是我的 MainActivity.java 代码 package com.example.defiblocator; import android.Manifest; import android.content.pm.PackageManager; import android.location.Location; import android.os.Build; import android.os.Bundle; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentActivity; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location

2021-10-27 03:55:00    分类:技术分享    java   android   google-maps

Marker customization and direction API

I am using Google Maps to display direction in my application. I would like to customize the markers to display more text than the default which shows only the position name i.e the city,state and in others zip code. My idea is to add customized text on the marker bubble. Here is my code in what I have tried so far. Note: I have tried to add markers but are not working. And also data to populate the map is obtained using json from db. I have posted sample result after the code. Code: var directionDisplay; var directionsService = new google.maps.DirectionsService(); var map; function initialize

2021-10-27 03:47:14    分类:问答    json   web-services   google-maps   google-maps-api-3

无法使用 Google 地图 javascript api v3 在 Google 地图上设置多个标记(Not able to set multiple markers on the Google maps using Google map javascript api v3)

问题 我想在地图上放置多个标记,但我得到的地图没有设置标记。 <script type="text/javascript"> var map; var i; window.onload=function() { var mapOptions = { zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP, center: new google.maps.LatLng(59.32522, 18.07002) }; map = new google.maps.Map(document.getElementById("map"),mapOptions); var bounds = new google.maps.LatLngBounds(); var places =[]; places.push(google.maps.LatLng(40.756,-73.986)); places.push(google.maps.LatLng(59.32522, 18.07002)); places.push(google.maps.LatLng(37.775,-122.419)); places.push(google.maps.LatLng(47.620,-122.347)); places.push(google.maps.LatLng(-22

2021-10-27 03:46:14    分类:技术分享    javascript   google-maps   google-maps-api-3   latitude-longitude

Google Map inside a fragment with custom layout

What is my best option to get google map in a fragment with custom lay out? I am trying to use GoogleMapsV2 for one of the fragment(tab). The fragment would have some buttons and the google map in the background with markers. So the view would look some thing like http://www.androidtapp.com/wp-content/uploads/2009/08/CardioTrainer-Map.jpg (Mine would be lot simpler than that though) After googling ,overflowing the stack extensively and experimenting this is what I understood 1.I can use SupportMapFragment in my fragment (I tried it works. But too bad I am not able to get my custom buttons) 2.I

2021-10-27 03:28:12    分类:问答    java   android   google-maps   android-fragments

使用 PHP 和 MYSQL 不显示标记聚类(Marker Clustering Not Showing using PHP and MYSQL)

问题 我已经从谷歌地图 API 文档(使用 MySQL 和 PHP 与谷歌地图)复制了这段代码。 标记正在显示,但我无法让标记聚类工作。 我有 1000 多个标记,而 google 给出的示例看起来仅适用于几个标记。 我的地图标记太多,很难点击正确的标记。 我已将示例复制到小提琴中。 未设置 API 密钥,但代码在我的项目中相同。 var customLabel = { restaurant: { label: 'R' }, bar: { label: 'B' } }; function initMap() { var map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(-33.863276, 151.207977), zoom: 12 }); var infoWindow = new google.maps.InfoWindow; // Change this depending on the name of your PHP or XML file downloadUrl('https://storage.googleapis.com/mapsdevsite/json/mapmarkers2.xml', function(data) { var

2021-10-27 03:26:34    分类:技术分享    mysql   google-maps   google-maps-markers   marker   markerclusterer

404 Not Found error for all the Google Maps API V3 libraries

I am getting 404 Not Found error for all the Google Maps API libraries. e.g. https://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/main.js The map works, when I build it through code but map does not load when I access the hosted website.

2021-10-27 03:09:57    分类:问答    javascript   api   google-maps   google-maps-api-3

地图类型 GoogleMap.MAP_TYPE_NONE 的谷歌地图背景颜色(Google map Background color for Map type GoogleMap.MAP_TYPE_NONE)

问题 我已将我的平面图的地面叠加层添加到 Google 地图中。 它完美加载。 代码如下所示。 override fun onMapReady(map: GoogleMap) { mMap = map; mMap.setOnGroundOverlayClickListener(this); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(DEFAULT_LAT_LNG, 1F)); mMap.setMapType(GoogleMap.MAP_TYPE_NONE); mGroundOverlay = mMap.addGroundOverlay(GroundOverlayOptions() .image(BitmapDescriptorFactory.fromBitmap(bitmap)).anchor(0F, 1F) .position(DEFAULT_LAT_LNG, floorPlanWidth.toFloat(), floorPlanHeight.toFloat())); mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mGroundOverlay.getBounds(), 0)) } 这将产生如下所附的 UI。 我在这里有两个问题:

2021-10-27 03:04:47    分类:技术分享    android   google-maps   android-mapview   android-maps-utils

Radius Search From Database

I have a database of addresses for Accounts in Australia. I need to build a solution whereby the user can select a postcode or suburb and Google Maps queries the database to find accounts within a radius of 50kms from the postcode / suburb and displays markers on the map for each account that falls within these boundries. Can somebody please help me with this? Thanks,

2021-10-27 02:59:04    分类:问答    google-maps   google-maps-api-3

Convert lat,lng into Address and show on infoWindow google map api

I have list of lat, lng values in object var path = [{"lat":"12.9247903824","lng":"77.5806503296"},{"lat":"10.9974470139","lng":"76.9459457397"}] Here i have to convert latlng into address and have to show marker and infowindow. Address have to be shown in info window I have tried this one, i have getting address and multiple markers but i not able to show address on info windows.. last infowindow only showing address for (var i = 0; i < path.length; i++) { var pos = new google.maps.LatLng(path[i]["lat"], path[i]["lng"]); var marker = new google.maps.Marker({ position: pos, map: map })

2021-10-27 02:23:24    分类:问答    google-maps   google-maps-api-3