google-maps-markers

How to attach a flexible marker on map something like Uber and Lyft?

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:09:41
How to attach a flexible marker on map something like Uber and Lyft ? am using Google maps v2. Basically, i want to display a marker on map while the position of the marker is changed upon moving the map. edited: Ok i solved my problem. first : add an imageview to the same layout and position equal to center. second: to get the coordinate of the center of the map use the following approach 1- get viewgroup ( FrameLayout ) in my case where the map fragment is located. FrameLayout myContainer = (FrameLayout) findViewById(R.id.content_frame); int mapHeight = myContainer.getHeight(); int mapWidth

Empty InfoWindow when Marker is clicked

試著忘記壹切 提交于 2019-11-28 00:08:27
问题 This is my code to add new Markers to my GoogleMap: MarkerOptions m = new MarkerOptions(); m.title(title); m.snippet(snippet); m.position(location); mMap.addMarker(m); mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker marker) { Toast.makeText(DemoActivity.this, "WindowClicked: "+ marker.getTitle() + ":" + marker.getSnippet(), Toast.LENGTH_SHORT).show(); } }); Now This works just fine when my title and snippet are in English. The

Google Maps API: markerwithlabel.js - Uncaught ReferenceError: google is not defined

孤街浪徒 提交于 2019-11-27 23:49:55
问题 I have read the docs and examples, but I it seems I cannot solve the initialization error ("Uncaught ReferenceError: google is not defined" + Uncaught ReferenceError: homeLatLng is not defined) when trying to include markerwithlabel.js file and it's reminds me to the "you cannot load something before the map is done" prob. What can I do? What was tried: <head> <script async defer src="https://maps.googleapis.com/maps/api/js?key=mykey&callback=initMap"></script> <script type="text/javascript"

Google Maps V3: Updating Markers Periodically

女生的网名这么多〃 提交于 2019-11-27 23:23:34
I've followed the PHP/MYSQL tutorial on Google Maps found here . I'd like the markers to be updated from the database every 5 seconds or so. It's my understanding I need to use Ajax to periodicity update the markers, but I'm struggling to understand where to add the function and where to use setTimeout() etc All the other examples I've found don't really explain what's going on, some helpful guidance would be terrific! This is my code (Same as Google example with some var changes): function load() { var map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng

Add marker on touched location using google map in android

牧云@^-^@ 提交于 2019-11-27 22:25:07
How do I add a marker on a particular location in the map? I saw this code that shows the coordinates of the touched location. And I want a marker to pop or be shown in that same location everytime it is touched. How do I do this? public boolean onTouchEvent(MotionEvent event, MapView mapView) { if (event.getAction() == 1) { GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Toast.makeText(getBaseContext(), p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_SHORT).show(); mapView.invalidate(); } return false; } You want to add an

Google Maps Multiple Custom Markers

徘徊边缘 提交于 2019-11-27 20:55:18
So I'm trying to learn how to make a google map. I have very little understanding of javascript but am trying to learn here. I referenced a code online and I got to the point where I sort of understand how to add locations, marker, and a infowindow but I'm trying to figure out how to add multiple custom icons for each marker. Thanks for the help. function initialize() { //add map, the type of map var map = new google.maps.Map(document.getElementById('map'), { zoom: 6, center: new google.maps.LatLng(37.7749295, -122.4194155), mapTypeId: google.maps.MapTypeId.ROADMAP }); //add locations var

Google maps auto-fit (auto center & autozoom) doesn't work

怎甘沉沦 提交于 2019-11-27 20:39:25
I have a problem with a map on which I've used the fitBounds map methods, which should give the proper zoom and center the map giving it a latlon array. here's the code: <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"> </script> <div id="map_canvas"> <script type="text/javascript"> var map; var bounds = new google.maps.LatLngBounds(null); function initialize() { var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); <?php foreach ($this->getProductCollection() as $_e):

How do you create a Marker with a custom icon for google maps API v3?

最后都变了- 提交于 2019-11-27 20:33:33
问题 I've been reading https://developers.google.com/maps/documentation/javascript/overlays for a while now and I can't seem to get a custom icon for my map working. Here is my javascript: var simplerweb = new google.maps.LatLng(55.977046,-3.197118); var marker; var map; function initialize() { var myOpts = { center: simplerweb, zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOpts); marker = new google.maps.Marker({ map:

Move GMSMarker on Google Map Like UBER

放肆的年华 提交于 2019-11-27 20:20:14
I am developing some navigation tasks on google map. I have to move markers as vehicles moves with turns as uber does in their app. I have tried different solutions as offered on @SO but It is not working as I need. I am getting angle with previous lat/long with current lat/long and animating mapwithBearing with that rotation Here is code [CATransaction begin]; [CATransaction setAnimationDuration:2.0]; NSDictionary *data = [[result objectForKey:@"returnData"] objectForKey:@"data"]; if (![data isEqual: [NSNull null]]) { driverLocationCoordinate = CLLocationCoordinate2DMake([[data objectForKey:@

Confine dragging of Google Maps V3 Marker to Polyline

自作多情 提交于 2019-11-27 20:14:40
I've created a Google Map and have drawn a polyline on it. I've then added a marker to the start of the polyine (same coords as the starting coords of the polyline). What I'd like to be able to do, is grab and drag the marker but have it "stick" to the polyline such that you can only drag it along the polyline and not away or to the side of it. Is it possible to confine a draggable marker to a path in GM V3? If not, can anyone think how this might be done? There's the possibility of snapping the marker to the nearest point on the path when the user drops it, but I'd prefer a smoother "drag