LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2012, 02:52 AM   #1
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Reading latitude longitude points from a BMP/PNG file?


Suppose there is a map file saved as a BMP.

Is it possible somehow to read the latitude longitude points from that BMP file?
 
Old 07-10-2012, 03:06 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
if you know where the data will be on the image then you can crop that part of the image and then pass it through an OCR library - such as tesseract.

If you don't it would be more problematic because you may have other pieces of data which once you have converted using ocr may look like valid lat long points.
 
1 members found this post helpful.
Old 07-10-2012, 03:19 AM   #3
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Thanks for helping.

I will be knowing the location of the points on the map, and that'll be an area
sized much smaller than a pea.
But, inside that area, I won't be able to tell the "exact" point.
Will that library help in that casE?
 
Old 07-10-2012, 03:24 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
You should be able to use it to convert the data from an image to true text and progress from there. I've not used the library in a while but the concept remains the same: convert from image to text; then validate the text; if it looks reasonable then use the result as your data.
 
1 members found this post helpful.
Old 07-11-2012, 09:38 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
If you know the type of projection of the map, it should be possible to calculate latitude and longitude corresponding to any pixel in the image based on the geometry of the mapping. It might be tricky to compute the mapping for many projection types. The field of cartography must have plenty of such software.
--- rod.
 
Old 07-11-2012, 10:00 AM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Well I was referring to this kind of BMP/PNG file:
http://maps.googleapis.com/maps/api/...4&sensor=false
 
Old 07-11-2012, 01:22 PM   #7
VisionIncision
Member
 
Registered: Dec 2011
Location: Wiltshire, UK
Distribution: Slackware, Gentoo
Posts: 130

Rep: Reputation: 3
Quote:
Originally Posted by theNbomr View Post
If you know the type of projection of the map, it should be possible to calculate latitude and longitude corresponding to any pixel in the image based on the geometry of the mapping. It might be tricky to compute the mapping for many projection types. The field of cartography must have plenty of such software.
--- rod.
If he is using a static image, e.g. in a world map application then this is how I would do it.
 
Old 07-12-2012, 10:22 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Anisha Kaul View Post
Thanks for helping.

I will be knowing the location of the points on the map, and that'll be an area sized much smaller than a pea.
But, inside that area, I won't be able to tell the "exact" point.
Will that library help in that casE?
Try this page:
http://www.movable-type.co.uk/scripts/latlong.html

I had to do this with a vector-type topological map in the past, and it was a bear. If you know the boundaries of the map section you're working with, you're in a better place, since from those, you can calculate the number of points in-between, and work out the position. The page I linked to has some Java examples of code to do what you're seeking, but there are other language implementations of those same formulas. Guessing you're wanting to do this on a web-page.
 
1 members found this post helpful.
Old 07-12-2012, 01:16 PM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by Anisha Kaul View Post
Well I was referring to this kind of BMP/PNG file:
http://maps.googleapis.com/maps/api/...4&sensor=false
If you're using Google's Map API anyway, then why can't you use it to get the latitude and longitude?

Last edited by dugan; 07-12-2012 at 01:17 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Converting a HTML file to a PNG file through Python script Aquarius_Girl Programming 12 02-02-2010 10:10 AM
bmp can't play any music file numen Linux - Software 2 12-09-2005 08:52 AM
bmp can't play music file numen Fedora 0 12-07-2005 01:27 AM
Webalizer: configure: error: png library not found... please install png. mikeshn Linux - Software 5 01-10-2005 02:28 PM
Image conversor bmp & png to jpeg Adony Linux - Software 2 06-19-2004 03:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration