Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Latitude/Longitude values to x,y on a map

Status
Not open for further replies.

sdaver

Programmer
Feb 14, 2006
11
US
Hi, desperate for some help.

I need to place red dots on a map of a state in the US. The dots represent the locations of several businesses, universities and cities on a map of the State.This data is kept in a database and will change frequently and without warning.

I only have the the latitude and longitude of these businesses/companies/cities. I need to convert the latitude/longitude to x,y coordinates on the map. Once I have the x,y coordinates, I will have to plot them on the map, which should not be difficult.

I know the longitude/latitude of the 4 corners of this map.

I would really appreciate a quick reply.

Thx
SD
 
Is this done server-side or client-side? What programming language will you use?

I'd say that it's a matter of calculating based on the latitude and longitude of pixel 0,0 on the graphic (upper left corner) and the pixel coordinate at the bottom right.

Figure out the number of degrees longitude the picture is wide, and each pixel is equal to the graphic width divided by the number of degrees. For example, if the graphic is 600 pixels wide, and covers 100 degrees of longitude, each pixel would represent 10 minutes of longitude, or 1/6 of a degree. Depending on what the map was of, you'd have to adjust the negative or positive progression from left to right in the graphic.

Lee
 
This will be done server-side, I am using PHP and MySQL, I shall try the cal. as you said trollacious.

And Chris, I am not supposed to use a third party tool, so have to re-invent the wheel I guess....

Thanks for your suggestions...
 
I am not supposed to use a third party tool, so have to re-invent the wheel I guess

That's progressive web design for you ;-)

I know it's not down to you, but can't you plead the case that Google created Google maps and the API specifically to help people build websites with this kind of functionality.
It's kind of the point behind it - not least a principle of modern web design.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
ok guys, what do u think…we didn’t try the other way????....the project manager almost got his but kicked, by the old hats sitting upstairs….cant argue the big B is always right…or I would say... supposed to be right…, sometimes...
 
Well, it's his money being wasted I guess ;-)

I appreciate where you are coming from... I'm just a restless soul and never give up without a fight.

I know you feel you can't change things so don't take this as a put down or me saying that you are doing it wrong. You aren't, you are over a barrel.

But look at it this way, you are employed for your knowledge and skills... in web design and development.
If "the big B" is a designer/developer then fair enough, but I'll bet he isn't.

Any employer, anyone running a reasonably successfuly business that can afford to employ others does so for their particular skills. It's not common to drag anyone at all in off the street to do a job, one looks for a suitable candidate.

During my career, I've found that if you go about it the right way and present ideas to "big B's" in such a way as to appeal to their business sense then you can instill change.

Don't be a "yes man", be a "what if man" - yuck that sounds horrible but I hope you get the idea :)

Cheaper, Faster, Better is something that bosses tend to like. If Google (and Yahoo for that matter) have already done it and done it in such a way that it's an open system that you are actively encouraged to use, then where is the business sense in redeveloping the same thing?!

Of course, it's different if the project has been sold into a client and they were told "we will not use the Google API. We will develop a proprietery solution for you".

As I said. I fully appreciate your position, but experience has shown me that bosses don't always know best. In fact, quite often, if it's done the correct way, they appreciate being given viable alternatives. After all, they run the business and can't be expected to keep up with the "latest and greatest" things in web development.

Just my 2 pence worth.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top