FlickrNet.Flickr.PhotosGeoSetLocation C# (CSharp) Méthode

PhotosGeoSetLocation() public méthode

Sets the geo location for a photo.
public PhotosGeoSetLocation ( string photoId, double latitude, double longitude ) : void
photoId string The ID of the photo to set to location for.
latitude double The latitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.
longitude double The longitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.
Résultat void
        public void PhotosGeoSetLocation(string photoId, double latitude, double longitude)
        {
            PhotosGeoSetLocation(photoId, latitude, longitude, GeoAccuracy.None);
        }

Same methods

Flickr::PhotosGeoSetLocation ( string photoId, double latitude, double longitude, GeoAccuracy accuracy ) : void

Usage Example

        public string Upload(WitnessKingTidesApiInputModel model)
        {
            string flickrId = string.Empty;
            model.FileName = Guid.NewGuid().ToString() + ".jpg";

            var flickr = new Flickr(FlickrApiKey, FlickrApiSecret);
            flickr.OAuthAccessToken = FlickrOAuthKey;
            flickr.OAuthAccessTokenSecret = FlickrOAuthSecret;

            var path = Path.Combine(AppDataDirectory, model.FileName);
            using (var stream = File.OpenWrite(path))
            {
                stream.Write(model.Photo, 0, model.Photo.Length);
            }

            //TODO: We should probably fill the title here. Otherwise default flickr captions will be gibberish guids
            flickrId = flickr.UploadPicture(path, null, model.Description, null, true, false, false);

            //TODO: Should probably try/catch this section here. Failure to set location and/or delete the temp file should
            //not signal a failed upload.

            //TODO: Need to check if coordinates can be embedded in EXIF and extracted by Flickr. If so we can probably
            //skip this and embed the coordinates client-side.
            flickr.PhotosGeoSetLocation(flickrId, Convert.ToDouble(model.Latitude), Convert.ToDouble(model.Longitude));

            File.Delete(path);

            return flickrId;
        }
Flickr