Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All,

I am using vs2008,vb.net and Asp.net (3.5)
Read latitude and longitude from the image (GPS) using asp.net , vb.net .

Mukesh
Posted
Updated 16-Jul-12 21:51pm
v4
Comments
Sergey Alexandrovich Kryukov 18-May-12 17:44pm    
What stops you from using the code you reference?
--SA
Sandeep Mewara 6-Jun-12 6:53am    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.

This forum is for asking questions about code ONLY, not for posting code snippets you think other may find useful.

If you want to do that, clean up the code and reformat it so it's reable, then submit it as a tip/trick. You'll also have to explain how the code works before its acceptable.
 
Share this answer
 
VB
If FileUpload1.PostedFile.FileName <> "" Then

                        Dim img As FileUpload = CType(FileUpload1, FileUpload)
                        Dim imgByte As Byte() = Nothing
                        If img.HasFile AndAlso Not img.PostedFile Is Nothing Then
                            'To create a PostedFile
                            Dim File As HttpPostedFile = FileUpload1.PostedFile
                            'Create byte Array with file len
                            imgByte = New Byte(File.ContentLength - 1) {}
                            'force the control to load data in array
                            File.InputStream.Read(imgByte, 0, File.ContentLength)
                        End If

                        Dim imgStream1 As MemoryStream = New MemoryStream(imgByte)
                        selected_image = New System.Drawing.Bitmap(imgStream1)
                        property_ids = selected_image.PropertyIdList

                        For Each Me.scan_property In property_ids

                            counter = counter + 1
                            byte_property_id = selected_image.GetPropertyItem(scan_property).Value
                            prop_type = selected_image.GetPropertyItem(scan_property).Type
                            'MsgBox(scan_property.ToString)

                            If scan_property = 2 Then

                                'Latitude degrees minutes and seconds (rational)
                                degrees = System.BitConverter.ToInt32(byte_property_id, 0) / System.BitConverter.ToInt32(byte_property_id, 4)
                                minutes = System.BitConverter.ToInt32(byte_property_id, 8) / System.BitConverter.ToInt32(byte_property_id, 12)
                                seconds = System.BitConverter.ToInt32(byte_property_id, 16) / System.BitConverter.ToInt32(byte_property_id, 20)

                                lat_dd = degrees + (minutes / 60) + (seconds / 3600)
                                'MsgBox(degrees & " " & minutes & " " & seconds & vbCrLf & lat_dd)

                            ElseIf scan_property = 4 Then

                                'Longitude degrees minutes and seconds (rational)
                                degrees = System.BitConverter.ToInt32(byte_property_id, 0) / System.BitConverter.ToInt32(byte_property_id, 4)
                                minutes = System.BitConverter.ToInt32(byte_property_id, 8) / System.BitConverter.ToInt32(byte_property_id, 12)
                                seconds = System.BitConverter.ToInt32(byte_property_id, 16) / System.BitConverter.ToInt32(byte_property_id, 20)
                                long_dd = degrees + (minutes / 60) + (seconds / 3600)

                                'MsgBox(degrees & " " & minutes & " " & seconds & vbCrLf & lat_dd)

                            End If

                        Next scan_property
                        '----------------------------------------------------------------------------

read latitude, longitude and location from the image


Mukesh
 
Share this answer
 
Comments
AmitGajjar 17-Jul-12 4:10am    
Update your question using Improve question link. do not post answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900