MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mapping points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119533] Re: Mapping points
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 8 Jun 2011 07:13:53 -0400 (EDT)

I copied and pasted the code from my e-mail into a new notebook in a fresh session on each of two computers (iMac and MacBook Air).  Both ran without exception and the tooltips had all of the requested data.

You can use either the ImageSize or the AspectRatio to alter the perspective. However distortion is unavoidable since the projection is onto a regular grid.


Bob Hanlon

---- DrMajorBob <btreat1 at austin.rr.com> wrote: 

=============
Five minutes later, after SEVERAL updates of the curated data... we get a  
(distorted?) map of the country.

The Tooltips read, for instance, "cd[{Houston,Texas,United  
States},Name,Coordinates,Population" -- exactly like that.

Adding this code beforehand:

Clear[cd]
cd[x_, y_List] := cd[x, #] & /@ y
cd[any__] := CityData[any]

turns the same ToolTip into {Houston,{29.7629,  
-95.3832},Missing[NotAvailable]}, even though

CityData[{"Houston", "Texas", "United States"}, "Population"]

2257926

ALL the populations are Missing[NotAvailable] in the ToolTips.

But THIS works (for what reason, I cannot imagine):

Clear[name, coordinates, pop]
country = "UnitedStates";
large = Take[CityData[{Large, country}], 30];
name[city_] := name[city] = CityData[city, "Name"]
coordinates[city_] := coordinates[city] = CityData[city, "Coordinates"]
pop[city_] := pop[city] = CityData[city, "Population"]
Graphics[{LightGray, CountryData[country, "Polygon"],
   PointSize[Medium], Red,
   Tooltip[Point[Reverse[CityData[#, "Coordinates"]]], {name@#,
       coordinates@#, pop@#}] & /@ large}, Frame -> True,
  ImageSize -> 600]

Bobby

On Tue, 07 Jun 2011 05:45:08 -0500, Bob Hanlon <hanlonr at cox.net> wrote:

>
> cd[city_, prop_List] := CityData[city, #] & /@ prop
>
> Module[{country = "UnitedStates"},
>  Graphics[{
>    LightGray,
>    CountryData[country, "Polygon"],
>    PointSize[Medium],
>    Red,
>    Tooltip[
>       Point[Reverse[
>         CityData[#, "Coordinates"]]],
>       cd[#, {"Name", "Coordinates", "Population"}]] & /@
>     Take[CityData[{Large, country}], 30]},
>   Frame -> True,
>   ImageSize -> 600]]
>
>
> Bob Hanlon
>
> ---- Yako <yako at 11y11.com> wrote:
>
> =============
> Hello,
>
> I been trying to look information on how to do this but couldn't find
> a clue, if someone here can hint me I will really appreciate it.
>
> Given a set of LAT, LON points I have to map them inside a white
> graph. My en result will need to be a white graph full of dots in its
> correspondent lat, lon location.
>
> Can I achieve something like this using mathematica? Can someone hint
> me in the right direction?
>
> Thanks a lot!
>
>
>
>


-- 
DrMajorBob at yahoo.com

--

Bob Hanlon



  • Prev by Date: Re: Mapping points
  • Next by Date: Re: How show axes labels with AxesOrigin->{0,0,0} in 3D?
  • Previous by thread: Re: Mapping points
  • Next by thread: Getting a chess with circles