is it possible to change labels for markers used in MarkerClusterer project?
I want them to display percents instead of number of grouped markers.
Thanks
It seems to be hardcoded to sum up the number of markers it is aggregating. You could try to override this method or modify the script per its license.
From the ClusterIcon.prototype.setSums method:
this.text_ = sums.text;
All you have to do is define your own calculator function.
See the documentation for MarkerClustererPlus here:
http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/docs/reference.html
Related
In leaflet there is a an extension called : Leaflet.markercluster
In this extension, there is a function called markerClusterGroup that clusters and returns the count of multiple Markers (points).
see example : Here.
In my example I'm doing the same thing for my polygons centroids, that I calculated using turf. Each of my polygon has an attribute "Inhabitants" which represents the total inhabitants in the polygon. (this looks like the example i'm working on)
The method markerClusterGroup returns the count of centroids in my example. Can I modify the method to modify the returned value into an aggregation of inhabitants ? If no, is there any library you know of capable of aggregating polygons on a specific attribute ?
Have a look at the "Customising the clustered markers" section of the plugin Readme page.
It shows how the default cluster icon is generated. From there you can modify it to sum your child centroid markers property instead of just the count of child markers.
Is it possible to have multiple data layers using Google Maps API? The only existing related question I could find was this.
Here's my problem.
I want to have a data layer for showcasing polygons on map that are being drawn by the user. At the same time I want to have another data layer that displays polygons that already exist in a database.
I figured I would do this by creating 2 data layers:
drawLayer = new google.maps.Data();
savedLayer = new google.maps.Data();
But when I initialize the drawing tools using drawLayer.setControls(['Polygon']), it doesn't work. If I replace the drawLayer with map.data, then the drawing tools works fine. Why is that?
JSFiddle: http://jsfiddle.net/pjaLdz6w/
In your fiddle you aren't declaring drawLayer as a google.maps.Data object. But even if you do, you still need to give it a map attribute:
drawLayer = new google.maps.Data({map:map});
JSFiddle: http://jsfiddle.net/jbyd815y/
I am new to use this API.
Basically I am developing a widget that calculate freight between two places, so i just need to compute distance only there is no need of showing Map.
If any one has simple explanation please share with me.
I have gone through this link but not able to identify which part of code i need to use for finding distance only.
you can use Geometry computeDistanceBetween()
var placeA = new google.maps.LatLng(-33.873, 151.13);
var placeB = new google.maps.LatLng(-33.92, 151.05);
console.log(google.maps.geometry.spherical.computeDistanceBetween(placeA, placeB));
Reference: https://developers.google.com/maps/documentation/javascript/geometry#SphericalGeometry
Anybody know how to add|remove custom markers from series in AnyChart JS?
I cant find it in documentation.
I believe you mean series markers. To turn them on and off use markers() method, available for all series except the markers series itself.
Example: http://jsfiddle.net/85Lbeu8p/1/
var markers = series.markers();
markers.enabled(true);
markers.fill('gold');
Method reference: https://api.anychart.com/7.8.0/anychart.core.radar.series.Line#markers
Is there any way to create custom dynamic icons for the markers?
What I want to create is a list of points and put a number "n" within markers specifying it's the n-th element.
Yes. You can either use custom icons with Numeric Markers or the built-in numbering system on Google has for markers.
Assuming the last option (not using custom markers), your marker definition code would look like:
var NUMBER_SHOWN='34';
var ICON_COLOR = 'ff6600';
var ICON_TEXT_COLOR = '000000';
var marker = new google.maps.Marker({
position: [LatLong Obj],
map: [Map Obj],
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+NUMBER_SHOWN+'|'+ICON_COLOR+'|'+ICON_TEXT_COLOR
});
I believe this only works for two-digit number, though I'm not sure.
EDIT
Geocodezip has correctly pointed out that the second approach has now been deprecated, so it looks like you're stuck using the first approach (using google's custom numbered-icons). Have a look at Daniel Vassallo's answer here on how to use it. If none of the markers fit your needs (colors, look, etc) you can create your own custom markers for each of the numbers (if you know how, you can write a server-side script that you can pass GET vars to and have it build the icon for you using GD etc, but you can also just build all the icons by hand)