I have an extjs line chart and my markerconfig is circle but at some point I want to change it with a different marker shape like a line or a cross. How I can change a shape for a single marker dynamically and keep rest marker as they are ? I know that we could change attribute properties of a marker but here I want to change the shape.
Related
I am using Bing map version 8, earlier with version 7 used entities, now we use layers and create a new layer and add pushpins to that layer and then add the layer to the map.
But, in a situation when an sea port icon is there and a pushpin emerges very close to it, it hides the icon and pushpin stands visible.I want both icon and pin to stay visible. Please help.
var pinLayer = new Microsoft.Maps.Layer();
//Created pins
pinLayer.add(pin); //added the pin to layer
//
map.layers.insert(pinLayer); //Added the layer to map
Earlier in v7 (using entities)-
Now in V8, the same icon of airport is not visible. I want it to show up.
Are you talking about the airport icon that is automatically added by Bing Maps? If so, this is to be expected as it is a map label which is lower priority than your data. Bing Maps uses vector labels and label collision to hide map labels which are overlapped by pushpins to keep the map view nice and clean. If you would prefer to disable the vector labels simply add the following map option when loading: liteMode: true
You can find out more about vector labels in Bing Maps V8 here: https://msdn.microsoft.com/en-us/library/mt750538.aspx
I draw circles and polygons on Google maps using DrawingManager. I tried to remove a circle/polygon by using the below code.
selectedShape.setMap(null);
Here selectedShape is either circle or polygon.
But it just hides the shape from the view. Internally that shape present in DOM.
For example: I have drawn 2 circles and 2 polygons. Now the total of shapes is 4. If I remove a circle or polygon, the count is still 4. It's not removed from DOM. Just hidden.
I want to completely remove a selected shape out of many shapes.
Has you can read from the documentation:
https://developers.google.com/maps/documentation/javascript/shapes#circle_remove
The .setMap(null) does not delete the circle. It simply removes the circle from the map. If instead you wish to delete the circle, you should remove it from the map, and then set the circle itself to null.
I'm using jQplot to draw the line which gets input to X-axis as Date and Y-axis as Percentage Value. I want to show the marker only to appear on the end of the line. like attached image below.
I wonder is there any option to show only the last marker in Jqplot. I know how to hide all the marker {showMarker:false}.
Is there an easy way to change the google map marker icon but only if they are exactly on same location ? For example, all my markers are blue, but at the coord 48.2, 67.5 are placed 2 markers, so I want them red.
ps : I use Overlapping Marker Spiderfier if it can help.
If you're using Overlapping Marker Spiderfier then you must be keeping an array of markers correct?
The simplest way would be to loop through the array each time you create a new marker and check the coordinates. If they match then swap the icon of both to the new colour.
Information on changing the icon itself can be found at: Adding custom google map marker / pin (color), there's a few options there.
I have this map, which I show some red markers over and whenever a location is chosen from a list the current marker is painted blue and the map centers around it.
I achieve this by having 2 layers - one for the red markers which is drawn at the beginning and one which is redrawn whenever a point is chosen from the list.
I would like to define that the red marker layer will always appear above the blue marker layer. Effectively hiding the "current marker" indication. (The reason for this is complicated)
This link is to a page that works the way I don't want. The blue layer is on top of the red layer.
I tried to reverse the order by defining the graphicZIndex property for both the vector and in the layers.addFeature function.
I'm obviously doing something wrong and maybe someone can point me to what it is.
The way I define the z-axis:
currentPointLayer = new OpenLayers.Layer.Vector("Selected Point Layer", {
style : {
externalGraphic : 'marker-blue.png',
graphicHeight : 15,
graphicWidth : 15,
graphicZIndex : 1
},
rendererOptions: { zIndexing: true }
});
Again, I want to hide the blue marker behind the red markers layer.
You can either change the order of your layers as ilia choly stated.
Or, if you want to use zIndexing, you have to put all features into one layer, because zIndexing is only done within a single layer.
Have a look at this simple example about styling, that also uses zIndexing. It randomly creates some points in the map. If you zoom out, chances are good that two circles overlap and if you hoover over one, it will be highlighted and put on top.
So you want highlight a marker with different color whenever a point is selected? Managing it with 2 layers is really an overkill. You should be able to define a vector layer with style like this:
var currentPointLayer = new OpenLayers.Layer.Vector("Selected Point Layer", {
styleMap: new OpenLayers.StyleMap({
externalGraphic : '${markerUrl}',
pointRadius: 20
})});
map.addLayer(currentPointLayer);
Then you have to set attribute 'markerUrl' of every feature(i.e. feature.attributes.markerUrl) to 'marker-red.png' - that would be initial state of all features.
Then whenever feature is selected you change markerUrl attribute of selected feature to 'marker-blue.png' and(important) call
currentPointLayer.redraw();
Obviously you'll also have to set previously selected feature to 'marker-red.png' when new feature is selected.
in your init_map() function you're adding the red marker layer before the blue ones. Try switching them.
preparePointsOnMap(map, points); //red marker
if (!map.getCenter()) {
map_set_center(lon, lat, mZoom); //blue marker
}