[Tutor] Converting a real map to a dictionary
Steven D'Aprano
steve at pearwood.info
Thu Sep 27 02:55:38 CEST 2012
On 26/09/12 11:20, Asmaa wrote:
> Hello,
>
> I wonder if there is possibility to convert a map to a dictionary in python.
> My concern is getting the number of houses for specific area to return
> the coordination of the houses in this area.
What sort of data do you expect to store in the dictionary?
The only thing I can think of is "address" and "coordinates". As you say below,
there is code to convert an address to its latitude and longitude, so you can
map address to coordinates:
d = {}
for address in list_of_addresses:
coord = get_coordinates_from_address(address) # whatever that function is
d[address] = coord
But I don't think this is useful. What do you intend to do with the addresses,
and why do you think a dictionary is where you want to store them?
> I can see that there are some useful codes to convert an address to its
> latitude and longitude (py-googlemaps.sourceforge.net) But I want to
> make a small network design on a real area, so I am looking for
> a way to extract the available houses for this area using a google map
> or something! Is this possible?
This isn't really a Python question. The answer depends on the features that
Google provides via their Maps API. See here to get started:
https://developers.google.com/maps/
--
Steven
More information about the Tutor
mailing list