# Geodesy without units?

Suppose I'm interested in the latitude of Los Angeles and I do the following:

In[1]:= c1 = CityData[{"LosAngeles", "California", "UnitedStates"}];
In[2]:= Latitude[c1]
Out[2]= Quantity[34.0194, "AngularDegrees"]


So the latitude is a Quantity! And if I get the string value I get:

In[4]:= ToString[Latitude[c1]]
Out[4]= "34.0194 degrees"


This seems a little at odds with the documentation where the examples seem to show a plain number being output.

Quantities are all well and good until I want to, say, use the Google Directions Api:

In[6]:= address =
ToString@StringForm[
"http://maps.googleapis.com/maps/api/directions/json?origin=1,2", Latitude[c1], Longitude[c1]]


That's not at all what I want!

I suppose I can get the magnitude of the Quantity to get something more like what I want:

In[7]:= address =
ToString@StringForm[
"http://maps.googleapis.com/maps/api/directions/json?origin=1,2", QuantityMagnitude[Latitude[c1]], QuantityMagnitude[Longitude[c1]]]


• have you tried Latitude[c1][[1]] and Longitude[c1][[1]]? – soandos Jan 1 '15 at 0:58
• The discrepancy between your result and the documentation is probably because those functions didn't return units in previous versions of Mathematica. Re. your question: Try using QuantityMagnitude, for example QuantityMagnitude@Latitude[c1]. – C. E. Jan 1 '15 at 1:11
• Using SetSystemOptions["DataOptions" -> "ReturnQuantities" -> False] you can get back the old behaviour (trick from the 'Possible Issues' section of DateDifference). – Sjoerd C. de Vries Jan 1 '15 at 13:10