[OpenLayers-Users] Simple Question

adityakumar529 adityakumar529 at gmail.com
Wed Jun 19 01:49:10 PDT 2013


Hi Juansre,
   I added my GeoJSON data in the following way.


var styleMap1 = new OpenLayers.StyleMap({ 
            "default": new OpenLayers.Style({ 
			  externalGraphic: '${getImageURL}',
               // fillColor: "${getColor}",
               // strokeWidth: 1,             
               pointRadius: 6,
               // fillColor: "red",
				//strokeColor:"${getColor}"               
            },
            {
                context: {
                    getImageURL : function (feature) {
                        return
feature.attributes.complaints.field_status_value
=='Resolved'?'http://www.ichangemycity.com/sites/all/themes/janaagraha/gmaps/assets/images/green.png':
                            
feature.attributes.complaints.field_status_value
=='Reported'?'http://www.ichangemycity.com/sites/all/themes/janaagraha/gmaps/assets/images/red.png':
							
'http://www.ichangemycity.com/sites/all/themes/janaagraha/gmaps/assets/images/blue.png';
                    
					} 
                }
            })
        }); 
		
var  a = new OpenLayers.Layer.Vector("GeoJSON", {
			styleMap: styleMap1,
						projection: epsg4326,
						strategies: [new OpenLayers.Strategy.Fixed()],
						protocol: new OpenLayers.Protocol.HTTP({
							url:"http://uat.ichangemycity.com/get_complaints?format=JSON",
							format: new OpenLayers.Format.GeoJSON()
						})
            });



Hope this will resolve your problem.
Thanks




-----
GIS Developer
India Urban Space Foundation
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Simple-Question-tp5061039p5061041.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list