Message Boards Message Boards

3
|
3745 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Why? CityData vs CountryData lat/long output

Posted 10 years ago

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?

POSTED BY: David Reiss
2 Replies

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"]]}]
POSTED BY: David Reiss
Posted 10 years ago

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}
POSTED BY: Douglas Kubler
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract