[OpenLayers-Users] Adding a custom marker on map by clicking.

Alexandre Dube adube at mapgears.com
Thu Apr 15 13:27:34 EDT 2010


Hi Ghulam,

Subhani Minhas wrote:
>
> 1. Specify marker's location.
> 2. Custom Marker icon
>
  Here's a really good example for you to start from :
  
http://dev.openlayers.org/releases/OpenLayers-2.8/examples/styles-unique.html

  In it, you'll be able to find what you need for 1) and 2).  Please 
note that the markers in the example are OpenLayers.Feature.Vector 
object, and not OpenLayers.Marker objects.

> 3. Ability to show markers text without clicking on it at all times.
>
  You'll be able to use a SelectFeature control with 'hover': true 
property in order to have your text (or popup) open when the feature is 
hovered.  See this example.
  
http://dev.openlayers.org/releases/OpenLayers-2.8/examples/highlight-feature.html

> 4. Ability to specify markers zoom levels between which it should be 
> visible.
>
That's should be your hardest point to accomplish in my opinion.  You 
should finish by this one.  I'm not sure what could be the best way to 
accomplish this.  I'll let others response.


> 5. Ability to hide and show whole markers layer.
>
  Can be done with the layerSwitcher :
  
http://dev.openlayers.org/releases/OpenLayers-2.8/examples/layerswitcher.html


> 6. Ability to export the marker layer to kml.
>
Here's an demo doing it (last button in toolbar, you need to draw a 
feature first)
  
http://dev.geoext.org/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html

Here's the lib use for kml exportation
  http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/data/Export.js


Hope this helps,

-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list