Re: A "How would you do this" type of question.



Korto wrote:
Imagine you are writing a program that will display a map of the United

States. Your program will ask a user to input their ZIP code. Once
they do, a dot will appear on the map to indicate where that ZIP code
is located.

My question is, how would you go about doing something like this, in
general?
Would you have a file of all ZIP codes and their longitude, latitude
coords and extrapolate those to x,y coords on your graphic map? Or, is

there an easier way?

This is just something that I was thinking about
today and I have no idea what mechanism anyone would use to accomplish
it.

Right now, I'm thinking the easiest way is using the file set-up I
mentioned above. Does anyone else have a different mechansim that
would be better?

Unless the data table is huge make the program parse it into a data
structure then lookup from the data structure. A hash-map of structs
would be suitable for example.

Also, if speed is of the essence consider precalculating the mapping
between longitude, latitude & the spatial coordinates on your map and
keep that in memory too.

.



Relevant Pages

  • Re: Postcode mapping
    ... With it giving the latitude and longitude from a UK map perspective, ... how to relate this to the pixels on my map. ... I still need to do longitude, but it should follow the same method. ...
    (comp.lang.pascal.delphi.misc)
  • Re: London Calling ~Twittering~
    ... But then I wonder what Latitude ... Latitude was, or Longitude either, ... My map, my gift to you, ... Very well, O, a very nice sea, I saw, ...
    (rec.running)
  • Re: OT: Online map utilities
    ... > Does anyone know of a database/lookup utility that will translate a ... The map will display the latitude and longitude of the ...
    (sci.electronics.design)
  • Re: Calculating intermediate latitude
    ... > I have a raster map with a few points of known latitude and longitude. ... > What I need is to calculate geographical coordinations for any other ...
    (sci.geo.satellite-nav)
  • Re: Calculating intermediate latitude
    ... > I have a raster map with a few points of known latitude and longitude. ... > What I need is to calculate geographical coordinations for any other ...
    (sci.geo.satellite-nav)