Hi All,<div><br></div><div>I'm trying to do a flickr mashup following the examples in the OpenLayers book ch11. I'm getting an access-control-allow-origin error when using the ProxyHost example script provided on the OpenLayers site. I've double checked and I'm pretty sure my url's are properly spelled. Any suggestions?<br clear="all">
<br></div><div><div>var map, layer;</div><div>function init_geoflik(){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>map = new OpenLayers.Map ("map", </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{controls:[ </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> new OpenLayers.Control.Navigation(),</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.PanZoomBar(),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.LayerSwitcher(),</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.Attribution(),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.ScaleLine()],</div><div> <span class="Apple-tab-span" style="white-space:pre">                </span>sphericalMercator: true,</div><div> <span class="Apple-tab-span" style="white-space:pre">                </span>maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),</div>
<div> <span class="Apple-tab-span" style="white-space:pre">                </span>maxResolution: 156543.0399,</div><div> <span class="Apple-tab-span" style="white-space:pre">                </span>numZoomLevels: 19,</div><div> <span class="Apple-tab-span" style="white-space:pre">                </span>units: 'm'</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>});</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var google_map = new OpenLayers.Layer.Google(</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>'Google Layer',</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>map.addLayer(google_map);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var vector_layer = new OpenLayers.Layer.Vector('Flickr Data',</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>projection: new OpenLayers.Projection('EPSG:4326'),</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>protocol: new OpenLayers.Protocol.HTTP({</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>url: '<a href="http://api.flickr.com/services/feeds/geo/">http://api.flickr.com/services/feeds/geo/</a>', params: {'format':'kml', 'tags':'graphitti'}, format: new OpenLayers.Format.KML({extractAttributes: true, extractStyles: true})}), strategies: [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster]});</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>map.addLayer(vector_layer);</div><div>OpenLayers.ProxyHost = '/cgi-bin/proxy.cgi?url=';</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var vector_style = new OpenLayers.Style({</div>
<div>'fillColor': '#669933',</div><div>'fillOpacity': .8,</div><div>'fontColor': '#f0f0f0',</div><div>'fontFamily': 'arial, sans-serif',</div><div>'fontSize': '.9em',</div>
<div>'fontWeight': 'bold',</div><div>'label': '${num_points}',</div><div>'pointRadius': '${point_radius}',</div><div>'strokeColor': '#aaee77',</div><div>'strokeWidth': 3</div>
<div>},</div><div>{</div><div>context: {</div><div>num_points: function(feature){ return feature.</div><div>attributes.count; },</div><div>point_radius: function(feature){</div><div>return 9 + (feature.attributes.count)</div>
<div>}</div><div>}</div><div>});</div><div>var vector_style_map = new OpenLayers.StyleMap({</div><div>'default': vector_style</div><div>});</div><div>var select_feature_control = new OpenLayers.Control.SelectFeature(</div>
<div>vector_layer,</div><div>{}</div><div>)</div><div>map.addControl(select_feature_control);</div><div>select_feature_control.activate();</div><div>vector_layer.styleMap = vector_style_map;</div><div>var vector_style_select = new OpenLayers.Style({</div>
<div>'fillColor': '#cdcdcd',</div><div>'fillOpacity': .9,</div><div>'fontColor': '#232323',</div><div>'strokeColor': '#ffffff'</div><div>})</div><div>var vector_style_map = new OpenLayers.StyleMap({</div>
<div>'default': vector_style,</div><div>'select': vector_style_select</div><div>});</div><div>vector_layer.events.register('featureselected', this, on_select_feature);</div><div>vector_layer.events.register('featureunselected', this, on_unselect_feature);</div>
<div> if( ! map.getCenter() ){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> if(vector_layer){</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> vector_layer.events.register('loadend', vector_layer, function(){map.zoomToExtent(vector_layer.getDataExtent())});</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div><div>map.setCenter(null, null);};}</div><div><br></div><div>function on_select_feature(event){</div><div>var info_div = document.getElementById('photo_info_wrapper');</div>
<div>info_div.innerHTML = '';</div><div>var cluster = event.feature.cluster;</div><div>for(var i=0; i<cluster.length; i++){</div><div>info_div.innerHTML += "<strong>"</div><div>+ cluster[i].<a href="http://attributes.name">attributes.name</a></div>
<div>+ "</strong><br />"</div><div>+ "<img src='" + cluster[i].style.externalGraphic + "'/>"</div><div>+ cluster[i].attributes.Snippet</div><div>+ "<br /><hr />";}}</div>
<div>function on_unselect_feature(event){</div><div>var info_div = document.getElementById('photo_info_wrapper');</div><div>info_div.innerHTML = '';</div><div>}</div><div><br></div><div><br></div>-- <br><br>
<div>Dept. of Anthropology</div><div>Washington University in St. Louis</div><div>Campus Box 1114</div><div>St. Louis, MO, 63130</div><div>(917) 370-3489</div><div><a href="mailto:nefremov@artsci.wustl.edu" target="_blank">nefremov@wustl.edu</a><br>
</div><br>
</div>