dreiss
(David Reiss)
August 17, 2014, 5:50pm
1
CityData gives the lat/long coordinates as a simple two-element list:
In[1]:= CityData[Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}], "Coordinates"]
Out[1]= {51.5, -0.116667}
Whereas CountryData gives the lat/long as a GeoPosition object:
In[2]:= CountryData[ Entity["Country", "UnitedKingdom"], "CenterCoordinates"]
Out[2]= GeoPosition[{54., -2.}]
This seems an oddly inconsistent design. Is there a reason that I am missing? Are there other examples of output form inconstancies across overlaps of data types between different curated data areas?
seebonk
(Douglas Kubler)
August 17, 2014, 6:24pm
2
Strange indeed the documentation says it should be:
In[1]:= CityData["London", "Coordinates"]
Out[1]= GeoPosition[{51.5, -0.116667}]
But upon execution:
In[1]:= CityData["London", "Coordinates"]
Out[1]= {51.5, -0.116667}
dreiss
(David Reiss)
August 18, 2014, 12:33am
3
The usage is consistent with, for example
CountryData[Entity["Country", "UnitedKingdom"], "Coordinates"]
which can then be used in a Graphics like this
Graphics[{Line[
CountryData[Entity["Country", "UnitedKingdom"], "Coordinates"]]}]
or
Graphics[{Polygon[
CountryData[Entity["Country", "UnitedKingdom"], "Coordinates"]]}]
or more usefully by inserting a GeoPosition into a GeoGraphics as in this
GeoGraphics[{GeoPosition[
CountryData[Entity["Country", "UnitedKingdom"], "Coordinates"]]}]