google-maps

Android MapView POI Caching Strategy

匆匆过客 提交于 2021-01-28 06:41:45
问题 I have an Android app that when launched, inflates a MapView, gets the user's location and then makes a request to my server to fetch all points of interest (POI) as JSON within some radius of their location and draws those points on the map. I want the user to be able to pan around the map and see more points of interest load as they go outside of that initial data load, just like Google maps. My initial thought is to handle the pan event and when panning stops, get the map center, and make

Google Maps. Multiple maps with multiple markers with content

廉价感情. 提交于 2021-01-28 06:21:48
问题 I have this code to call multiple maps in one page, it's calling everything using arrays to make the code as short is possible. from the question: Multiple googleMaps in one page with non sequential ID's var coords = [ {lat: 53.647143, lng: -2.317803, zoom: 10}, {lat: 53.259065, lng: -4.417487, zoom: 7} ]; var markers = []; var maps = []; function initMap() { for(var i = 0, length = coords.length; i < length; i++) { var point = coords[i]; var latlng = new google.maps.LatLng(point.lat, point

How to calculate on road distance between two points?

二次信任 提交于 2021-01-28 06:10:15
问题 In my android app I am planning to add delivery taxes for the products(X bucks per kilometer) so, how can i calculate the on road distance between two points ? Our products will be dispatched from a fixed location, but the user will give the destination location. Can anyone give a detailed approach for this? 回答1: you can use google map API for that. You will get response like this: { "destination_addresses" : [ "New York, NY, USA" ], "origin_addresses" : [ "Washington, DC, USA" ], "rows" : [

How to allow content security policy to run external javascript from google api?

落爺英雄遲暮 提交于 2021-01-28 06:00:35
问题 This is my current script-src content security policy for my app: script-src 'self' 'unsafe-inline' https://maps.googleapis.com https://maps.gstatic.com; trying to load the following external js code: https://maps.googleapis.com/maps/api/js?key=${GOOGLE_API_KEY}&libraries=places&language=he using unsafe-inline it works, but probably unsafe, so I want to remove it in my code, but then it doesn't allow the script to run. tried to add to script-src a value such as https://maps.googleapis.com/*

Google Map:onMapReadyCallback can not be applied to this activity

北慕城南 提交于 2021-01-28 05:01:57
问题 I am a beginner trying to use google maps, and I have followed the instructions given here: https://developers.google.com/maps/documentation/android-api/map?hl=zh-tw But I'm stuck at mapFragment.getMapAsync(this) and have been unable to find an answer. Here is the code: public class GoogleMapPage extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.googlemap); MapFragment mapFragment =

Why I need to tap twice a GMSMarker when it is overlapping a GMSOverlay to show its info window?

佐手、 提交于 2021-01-28 04:43:06
问题 I have an GMSOverlay in a GMSMapView, so I listen to taps into it with the method: func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) { // Overlay was tapped } Then I want a GMSMarker to be painted over the GMSOverlay, and I listen to taps into it with the method: func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { // Marker was tapped return false } Every time the listener of the marker is called, its info window hides (if it's shown) or shows (if it's hidden

How can I change Google Maps language to Hindi in my app?

本小妞迷上赌 提交于 2021-01-28 04:00:04
问题 I am using Google Maps in my Android app. I have implemented language localisation throughout my app. Therefore I want that whenever the user changes the app language Google Maps language also gets changed to Hindi. I tried the following method to change the language of Google Maps in my app. String languageToLoad = "hi"; Locale locale = new Locale(languageToLoad); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getResources().updateConfiguration

Using JSON files in Google Maps styling

懵懂的女人 提交于 2021-01-28 02:42:54
问题 I'm having a bit of a nightmare with this Google Maps custom styling wizard. Ok, I have my map and it loads fine, but I am trying to add my JSON file to custom style the thing and I get an error. Uncaught InvalidValueError: not a Feature or FeatureCollection Also the error seems to come from a file called main.js - but I have a file called main.js and it doesn't have this code in it. Here is my code in the head of my document. <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"><

Google Maps V3 -> Is it possible to trigger the on click event on a specific coordinate (lat, lng) programmatically

牧云@^-^@ 提交于 2021-01-28 01:48:09
问题 This question is related to my question here: Google Maps V3 -> Is it possible to get properties from Geojson using lat lng coordinates or other information from search box? Since it is possible to trigger a click event programmatically like this, I'm wondering if I can trigger a click event on a given lat/lng position in the same way? Example code: google.maps.event.trigger(marker, 'click'); Pseudo code of what I would like to do: google.maps.event.trigger(place.geometry.location, 'click');

Google Maps API V3 Tiles Not Rendering - Whats the Deal?

核能气质少年 提交于 2021-01-27 22:20:38
问题 I am trying to load a map that has a very zoomed in view, with a height of about 8500px and width of only about 400px. When the map loads, some of the top and bottom tiles do not show. If, after the map loads, I zoom out, and back in, it will display, but there are still issues with rendering things like labels and markers on the top and bottom sections. Here is the jsFiddle that recreates the problem (scroll down in the results) as well as the js for my map initialize function: function