Using Icon Fonts as Markers in Google Maps V3

I just had the same problem – decided to do a quick and dirty conversion and host on github. https://github.com/nathan-muir/fontawesome-markers You can manually include the JS file, or use npm install fontawesome-markers or bower install fontawesome-markers. Just include the javascript file fontawesome-markers.min.js and you can use them like so: new google.maps.Marker({ map: map, icon: { … Read more

Resize Google Maps marker icon image

If the original size is 100 x 100 and you want to scale it to 50 x 50, use scaledSize instead of Size. const icon = { url: “../res/sit_marron.png”, // url scaledSize: new google.maps.Size(50, 50), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 0) // anchor }; const marker = new google.maps.Marker({ … Read more

Selecting last element in JavaScript array [duplicate]

How to access last element of an array It looks like that: var my_array = /* some array here */; var last_element = my_array[my_array.length – 1]; Which in your case looks like this: var array1 = loc[‘f096012e-2497-485d-8adb-7ec0b9352c52’]; var last_element = array1[array1.length – 1]; or, in longer version, without creating new variables: loc[‘f096012e-2497-485d-8adb-7ec0b9352c52’][loc[‘f096012e-2497-485d-8adb-7ec0b9352c52’].length – 1]; How … Read more

How to show multiple markers on MapFragment in Google Map API v2?

I do it like this to show car positions on the map with markers of different colors: private void addMarkersToMap() { mMap.clear(); for (int i = 0; i < Cars.size(); i++) { LatLng ll = new LatLng(Cars.get(i).getPos().getLat(), Cars.get(i).getPos().getLon()); BitmapDescriptor bitmapMarker; switch (Cars.get(i).getState()) { case 0: bitmapMarker = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED); Log.i(TAG, “RED”); break; case 1: bitmapMarker = … Read more

Google Maps API – Getting closest points to zipcode

The usual solution is to use the google.maps.geometry.spherical library computeDistanceBetween(from:LatLng, to:LatLng, radius?:number) method to reduce the number to about 10, then use the distance matrix return the driving distance to those locations so the results can be sorted by driving distance (actual travel distance), and reduced to the closest 3 to 5 locations by actual … Read more

Draw path between two points using Google Maps Android API v2

First of all we will get source and destination points between which we have to draw route. Then we will pass these attribute to below function. public String makeURL (double sourcelat, double sourcelog, double destlat, double destlog ){ StringBuilder urlString = new StringBuilder(); urlString.append(“http://maps.googleapis.com/maps/api/directions/json”); urlString.append(“?origin=”);// from urlString.append(Double.toString(sourcelat)); urlString.append(“,”); urlString.append(Double.toString( sourcelog)); urlString.append(“&destination=”);// to urlString.append(Double.toString( destlat)); urlString.append(“,”); … Read more

How to create a custom-shaped bitmap marker with Android map API v2 [duplicate]

In the Google Maps API v2 Demo there is a MarkerDemoActivity class in which you can see how a custom Image is set to a GoogleMap. // Uses a custom icon. mSydney = mMap.addMarker(new MarkerOptions() .position(SYDNEY) .title(“Sydney”) .snippet(“Population: 4,627,300”) .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow))); As this just replaces the marker with an image you might want to use a … Read more