Geolocation photo reader1/25/2024 ![]() Reading EXIF data is easy using this library. There are not many graphic libraries available for ASP.NET Core but if we need only EXIF data then we have some options.After trying some libraries I decided to go with ExifLib.Standard as it was minimalistic and performed well. My favorite beer barrel in Krakow located on map. Thanks to extension methods I created before the code in controller action is clean and minimal.Īnd here’s the end result. Using ( var reader = new ExifReader( "my-photo.jpg")) public class PhotoCoordinatesModelĪnd here is my demo controller action that reads EXIF data. This model must carry coordinates – if available – and also error information if something went wrong when reading EXIF data. To get data to browser we need a model for it. These methods are actually simple but it’s the good task for students to work these out. Return coordinates + coordinates / 60f + coordinates / 3600f Private static double ToDoubleCoordinates( double coordinates) If (reader.GetTagValue(type, out double coordinates)) Private static double? GetCoordinate( this ExifReader reader, ExifTags type) Return reader.GetCoordinate( ExifTags.GPSLongitude) Public static double? GetLongitude( this ExifReader reader) Return reader.GetCoordinate( ExifTags.GPSLatitude) Public static double? GetLatitude( this ExifReader reader) LatitudeReal = latitude + latitude / 60 + latitude / 3600īased on this I developed some extension methods to make reading of coordinates easier. Latitude can be transformed to real number using the following calculation: First number is degree, second one is minutes and third one seconds. Getting components of coordinates to real number is easy. Maps used on web pages usually need coordinates as real numbers. This is not shortcut done by library developer but this is how devices save coordinates.įor me this information was enough to get done with what I was up to. Getting GPS coordinates is a little tricky as coordinates are given back as an array of doubles containing degree, minute and second. Some libraries got extremely slow with photos bigger than 3 MB but ExifLib.Standard seems survive well. Reader.GetTagValue( ExifTags.DateTimeDigitized, out DateTime photoDate) īest thing about ExifLib.Standard – it works reasonably fast also with bigger photos (I tried few ones that are ~7 MB). Reader.GetTagValue( ExifTags.DigitalZoomRatio, out double brightness) using ( var reader = new ExifReader( "my-image.jpg")) Here is the sample how to read some EXIF fields. For this demo I decided to use some library that deals only with EXIF data, My choice was NuGet package called ’s simple to use, kind of primitive and basic, but it works well and does its job. There are some libraries available for ASP.NET Core for reading EXIF data from photos. It’s great but be aware – not all people may use this information in good purposes. Most of modern devices used to take photos save meta information in EXIF format to photos. Wikipedia defines EXIF (Exchangeable image file format) as a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. This blog post describes my experiment on getting GPS coordinates from EXIF data in ASP.NET Core application. I took my favorite photo of beer kiosk in Krakow and displayed location of this kiosk on map. To use additional filters, the user needs to use the python package opencv-python.During one of my ASP.NET Core classes I made demo about how to read GPS coordinates from photo and display location on a map. The new version of Import photos gives the ability to the user to use several basic filters on the image and save the picture. Mac users please refer to the Read Me file for further guidance. *.qgz) in order to be able to view the pictures. When the user saves a project and wants to reopen it, the folder with the pictures should stay at the original file location or moved at the same location of the project (e.g. The user can create one of the following file types: GeoJSON, SHP, GPKG, CSV, KML, TAB. It has two buttons the one is to import geotagged photos, and the other one is to be able to click on a point and display the photo along with information regarding the date time and altitude. The plug-in doesn’t need any third party applications to work. Then a layer will be created which it will contain the name of the picture, its directory, the date and time taken, altitude, longitude, latitude, azimuth, north, camera maker and model, title, user comment and relative path. The user is able to select a folder with photos and only the geo-tagged photos will be taken. This tool can be used to import Geo-Tagged photos (jpg or jpeg) as points to QGIS.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |