Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2006, 01:04 AM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Plotting Latitude/longitude coordinates

I am working on a project in which i have to plot the lat/long coordinates on a particular area on the map.The map is a jpeg image loaded in a picture box on a form.The lat/long are in database(around 500 records) each point has to be displayed on the map.What is the best way to do it.

 
Old June 12th, 2006, 05:09 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

check this link
http://www.geocities.com/raghavendra...re_Lat_Lon.zip
it has a sample map loaded to picture control and click the "draw points"
button, it will draw 10 point on map. look the source and change the
no. of points value and get the Lat and Long from DB and set to the top
and left of the shape.

I guess i understood your problem. if not, please explain in better
way, so it will help in tihinking better.

hope this helps.


With Regards,
Raghavendra Mudugal
 
Old June 12th, 2006, 09:14 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, Raghavendra thanx for the reply.I got the basic idea.But how do i set the reference of the map area(for eg:long between 98deg E-110degE and lat 20degN-10deg N). Secondly, how is each lat/long co-ordinate plotted with respect to the top and left of the picture.?

 
Old June 12th, 2006, 10:30 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I dont know much about Lat and Long, all i can say is...

when you have the map loaded to the picture control, you have only two options
1. picture control's CurrentX and CurrentY
2. shape control (those red square points) Left and Top.

All you have to do is to convert those lat and long values to the X and Y
value by any formaula or to which you have any Idea.

Just by "ong between 98deg E-110degE and lat 20degN-10deg N", picture control
or shape control is not going to understand what it is. So you have to use
formula to make those controls understand where to draw them on which X and Y.

About the formula or way to convert the lat and long points to X and Y, i have
to study.

well, i guess i am not more helpful. You have to wait here, so that some expert
will post is code, which will help you going further with your situation.

hope this helps.


With Regards,
Raghavendra Mudugal
 
Old June 12th, 2006, 11:10 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx raghav, you are really trying to help. What i have done is divided the map into a grid, 12 degrees (longitude) and 8degrees(for latitude). So now my map is from 96degE to 108degE(longitude) and 10degN to 18 deg N. I have then calculated how many pixels each degree corresponds to on the map by picture scalewidth/12 for longitude and scaleheight/8 for latitude. Now i have to plot 97.5 degE 14deg N(as one record of the database) so i want to know how this value will be referenced with respect to the top left of the picture box.I am somehow missing a crucial calculation because the plot is going out of the map area and not being displayed.Hope you have now understood my problem.And thanx once again for the response. Bye

 
Old June 12th, 2006, 11:24 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Please set the Top and Left of the Shape control where I am adding on the picture.
DO NOT SET THE TOP OR LEFT OF THE PICTURE CONTROL.

you have to set all to the shape control which are added dynamically to the respective X and Y (lat and Long) from the DB TOP=Y and LEFT=X.

SO each point you add, it will be having its onw X and Y, so they never over-lap.
And also, make sure that MAX value of X and Y are not crossing the picture's
width and height, In such case, you have to give the scrolling function on the
picture.

hope this helps.


With Regards,
Raghavendra Mudugal
 
Old June 12th, 2006, 11:54 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Raghav, well i did not exactly get what you mean.Could you please ammend your code (http://www.geocities.com/raghavendra...re_Lat_Lon.zip) to plot the values that i have mentioned above,by dividing your map in the required grid covering 12 deg of long and 8 degrees of lat.

 
Old June 13th, 2006, 12:12 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

just send me your db sample and vb work to me what you have done till now, let
me look into it and send you back the updated work.

zip the file and upload the files to geocities or your any file server, so I can
download from there.

hope this helps


With Regards,
Raghavendra Mudugal
 
Old June 13th, 2006, 01:30 AM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Raghav, i seem to be having some trouble uploading my code.Can you just ammend your code with your suggestion i may then be able to get abetter picture. Thanx Bye.

 
Old June 13th, 2006, 04:02 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

what the suggestion i said, i already commented in my code. I said the same thing
what the code i sent. nothing more.

well, then sorry, i cant be more helpful.



With Regards,
Raghavendra Mudugal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Easting/Northing to Latitude/Longitude elwappo C# 6 November 21st, 2008 06:41 AM
Plotting points for math program chroniclemaster1 C# 2005 2 May 13th, 2008 09:05 PM
How to Plotting on a map by GPS? goreng C# 0 December 18th, 2006 09:13 AM
GPS, Plotting on a map goldablasha C# 0 October 20th, 2005 07:34 PM
Plotting co-ordinates nishantpandit VS.NET 2002/2003 4 April 20th, 2004 02:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.