Hello Arnd, thanks for your reply :).  I used your suggestions and now I do
get something appearing on the map, but instead of getting the photos on
Tibet, where my map is centered, they appear clustered right below Africa
:-/.  This is my code with the additions thanks for taking some time to view
it.

alert(map.getExtent());
                
                var ext = map.getExtent().transform(new
OpenLayers.Projection("EPSG:900913"), new
OpenLayers.Projection("EPSG:4326"));
                alert(ext);
                var minx = ext.left;
                var miny = ext.bottom;
                var maxx = ext.right;
                var maxy = ext.top;
                
                var url = "http://www.panoramio.com/map/get_panoramas.php";;
                var parameters = {
                   order:'popularity',
                   set:'full',
                   from:0,
                   to:20,
                   minx: minx, //84.05,
                   miny: miny, //31.36,
                   maxx: maxx, //91.89,
                   maxy: maxy, //32.30,
                   size:'thumbnail'
                }//end parameters

                OpenLayers.loadURL(url, parameters, this, displayPhotos);

                function displayPhotos(response) {
                        var json = new OpenLayers.Format.JSON();
                        var panoramio = json.read(response.responseText);
                        var features = new Array(panoramio.photos.length);

                        for (var i = 0; i < panoramio.photos.length; i++)
                        {
                                var upload_date = 
panoramio.photos[i].upload_date;
                                var owner_name = panoramio.photos[i].owner_name;
                                var photo_id = panoramio.photos[i].photo_id;
                                var longitude =panoramio.photos[i].longitude;
                                var latitude = panoramio.photos[i].latitude;
                                var pheight = panoramio.photos[i].height;
                                var pwidth = panoramio.photos[i].width;
                                var photo_title = 
panoramio.photos[i].photo_title;
                                var owner_url = panoramio.photos[i].owner_url;
                                var owner_id = panoramio.photos[i].owner_id;
                                var photo_file_url = 
panoramio.photos[i].photo_file_url;
                                var photo_url = panoramio.photos[i].photo_url;


                                var fpoint = new
OpenLayers.Geometry.Point(longitude,latitude);

                                var attributes = {
                                           'upload_date' : upload_date,
                                           'owner_name':owner_name,
                                           'photo_id':photo_id,
                                           'longitude':longitude,
                                           'latitude':latitude,
                                           'pheight':pheight,
                                           'pwidth':pwidth,
                                           'pheight':pheight,
                                           'photo_title':photo_title,
                                           'owner_url':owner_url,
                                           'owner_id':owner_id,
                                           'photo_file_url':photo_file_url,
                                           'photo_url':photo_url
                                }//end attributes

                                features[i] = new
OpenLayers.Feature.Vector(fpoint,attributes);

                        }//end for

                        var panoramio_style2 = new
OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({
                                pointRadius: 15,
                                fillColor: "red",
                                fillOpacity: 1,
                                strokeColor: "black",
                                externalGraphic: "${photo_file_url}"
                        }, OpenLayers.Feature.Vector.style["default"]));

                        var vectorPano = new OpenLayers.Layer.Vector("Panoramio
Photos", {
                                projection: new 
OpenLayers.Projection("EPSG:4326"),
                                styleMap: panoramio_style2
                        });

                        vectorPano.addFeatures(features);
                        //vectorPano.transform(new 
OpenLayers.Projection("EPSG:4326"),
new OpenLayers.Projection("EPSG:900913"));
                        map.addLayer(vectorPano);
                                        
                }//end displayPhotos
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Adding-Panoramio-Photos-To-An-OpenLayers-Map-tp5744518p5745430.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to