create a path element on a map

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

create a path element on a map

Andy W

I have a quick question about superimposing a path element on a reference map. Is it possible? Currently I have a workaround of creating "Coordinates on a Map", and then post-hoc editing the graph in the output to change the "point" element to a "path" element (example syntax given at the end of the post). Ultimately though this is a limited approach, for instance say I had a series of paths (in long format), I would like to use something like the split modifier in GPL to render them seperate lines instead of a color. For an example use you can see the great circle lines used in the facebook friends map. Great circle lines are made by breaking up the straight line into many smaller segments.

I also have two more general (but related) questions I'm hoping the same people can answer. 1) Can you specify a reference map in inline GPL statements, or 2) can you make a viz template from a graph produced by a reference map. I thought I would be able to export the graph xml in the below map example, but I don't see how this is possible (you can export the graph xml created with inline GPL, but not with graphs created already with templates). Also I couldn't even find the map templates on my computer, and you can not edit the created .smz files to produce any new template. Also maps are not in the list of templates in the Viz Designer. Ergo, I do not know how to make a template to make a path element on a map.


set seed = 10.
input program.
loop i = 1 to 100.
compute lat = RV.UNIFORM(33,45).
compute lon = RV.UNIFORM(-118,-76).
compute rand_x = RV.NORM(0,1).
end case.
end loop.
end file.
end input program.
dataset name test_coord.
exe.


DATASET ACTIVATE test_coord.
RANK VARIABLES=rand_x (A)
  /RANK
  /NTILES(3)
  /PRINT=YES
  /TIES=LOW.

*Then just edit this map to change the point element to a path element.  
GGRAPH
  /GRAPHDATASET NAME="graphdataset"
    VARIABLES=Nrand_x[LEVEL=ordinal] lat[LEVEL=ratio] lon[LEVEL=ratio] 
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Coordinates on a Map"[LOCATION=LOCAL]
    MAPPING( "color"="Nrand_x"[DATASET="graphdataset"] "latitude"="lat"[DATASET="graphdataset"] 
    "longitude"="lon"[DATASET="graphdataset"]))
    VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
    LABEL='COORDINATES ON A REFERENCE MAP: lon-lat'
    DEFAULTTEMPLATE=NO
    VIZMAP="UnitedStates"[LOCATION=LOCAL TYPE=REFERENCE ].

Andy
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/