Skip to content

Add satellite and various projection types to geo subplots #5801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/5801_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add satellite and various projection types to geo subplots [[#5801](https://github.com/plotly/plotly.js/pull/5801)]
73 changes: 35 additions & 38 deletions src/plots/geo/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,22 @@ exports.projNames = {
'winkel tripel': 'winkel3',
'aitoff': 'aitoff',
'sinusoidal': 'sinusoidal',
/*
// potential projections that could be added to the API

'airy': 'airy',
// 'albers': 'albers',
'armadillo': 'armadillo',
// 'armadillo': 'armadillo',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a pattern to the ones we're still omitting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these are now enabled by eb30073.
Let me see if I could easily fix the clipping issue for some other remaining ones...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the remaining ones are interrupted-projections and polyhedral-projections as well as two-point projections , require extra work and attributes and we could say it is outside the scope of this PR.

'august': 'august',
'baker': 'baker',
'berghaus': 'berghaus',
'bertin1953': 'bertin1953',
// 'baker': 'baker',
// 'berghaus': 'berghaus',
// 'bertin1953': 'bertin1953',
'boggs': 'boggs',
'bonne': 'bonne',
'bottomley': 'bottomley',
// 'bonne': 'bonne',
// 'bottomley': 'bottomley',
'bromley': 'bromley',
// 'chamberlin': 'chamberlin',
'chamberlin africa': 'chamberlinAfrica',
// 'chamberlin africa': 'chamberlinAfrica',
'collignon': 'collignon',
'craig': 'craig',
// 'craig': 'craig',
'craster': 'craster',
'cylindrical equal area': 'cylindricalEqualArea',
'cylindrical stereographic': 'cylindricalStereographic',
Expand All @@ -54,32 +52,32 @@ exports.projNames = {
'fahey': 'fahey',
'foucaut': 'foucaut',
'foucaut sinusoidal': 'foucautSinusoidal',
'gilbert': 'gilbert',
'gingery': 'gingery',
'ginzburg4': 'ginzburg4',
// 'gilbert': 'gilbert',
// 'gingery': 'gingery',
// 'ginzburg4': 'ginzburg4',
'ginzburg5': 'ginzburg5',
'ginzburg6': 'ginzburg6',
'ginzburg8': 'ginzburg8',
'ginzburg9': 'ginzburg9',
'gringorten': 'gringorten',
'guyou': 'guyou',
'hammer retroazimuthal': 'hammerRetroazimuthal',
'healpix': 'healpix',
// 'hammer retroazimuthal': 'hammerRetroazimuthal',
// 'healpix': 'healpix',
'hill': 'hill',
'homolosine': 'homolosine',
// 'homolosine': 'homolosine',
'hufnagel': 'hufnagel',
'hyperelliptical': 'hyperelliptical',
'lagrange': 'lagrange',
'larrivee': 'larrivee',
'laskowski': 'laskowski',
'littrow': 'littrow',
'loximuthal': 'loximuthal',
// 'larrivee': 'larrivee',
// 'laskowski': 'laskowski',
// 'littrow': 'littrow',
// 'loximuthal': 'loximuthal',
// 'modified stereographic': 'modifiedStereographic',
'modified stereographic alaska': 'modifiedStereographicAlaska',
'modified stereographic gs48': 'modifiedStereographicGs48',
'modified stereographic gs50': 'modifiedStereographicGs50',
'modified stereographic miller': 'modifiedStereographicMiller',
'modified stereographic lee': 'modifiedStereographicLee',
// 'modified stereographic alaska': 'modifiedStereographicAlaska',
// 'modified stereographic gs48': 'modifiedStereographicGs48',
// 'modified stereographic gs50': 'modifiedStereographicGs50',
// 'modified stereographic miller': 'modifiedStereographicMiller',
// 'modified stereographic lee': 'modifiedStereographicLee',
'mt flat polar parabolic': 'mtFlatPolarParabolic',
'mt flat polar quartic': 'mtFlatPolarQuartic',
'mt flat polar sinusoidal': 'mtFlatPolarSinusoidal',
Expand All @@ -88,10 +86,10 @@ exports.projNames = {
'nell hammer': 'nellHammer',
'nicolosi': 'nicolosi',
'patterson': 'patterson',
'polyconic': 'polyconic',
// 'polyconic': 'polyconic',
'rectangular polyconic': 'rectangularPolyconic',
'satellite': 'satellite',
'sinu mollweide': 'sinuMollweide',
// 'sinu mollweide': 'sinuMollweide',
'times': 'times',
// 'two point azimuthal': 'twoPointAzimuthal',
// 'two point azimuthalUsa': 'twoPointAzimuthalUsa',
Expand All @@ -109,21 +107,20 @@ exports.projNames = {
'winkel3': 'winkel3',

// 'interrupt': 'interrupt',
'interrupted homolosine': 'interruptedHomolosine',
'interrupted sinusoidal': 'interruptedSinusoidal',
'interrupted boggs': 'interruptedBoggs',
'interrupted sinu mollweide': 'interruptedSinuMollweide',
'interrupted mollweide': 'interruptedMollweide',
'interrupted mollweide hemispheres': 'interruptedMollweideHemispheres',
'interrupted quartic authalic': 'interruptedQuarticAuthalic',
// 'interrupted homolosine': 'interruptedHomolosine',
// 'interrupted sinusoidal': 'interruptedSinusoidal',
// 'interrupted boggs': 'interruptedBoggs',
// 'interrupted sinu mollweide': 'interruptedSinuMollweide',
// 'interrupted mollweide': 'interruptedMollweide',
// 'interrupted mollweide hemispheres': 'interruptedMollweideHemispheres',
// 'interrupted quartic authalic': 'interruptedQuarticAuthalic',

'polyhedral butterfly': 'polyhedralButterfly',
'polyhedral collignon': 'polyhedralCollignon',
'polyhedral waterman': 'polyhedralWaterman',
// 'polyhedral butterfly': 'polyhedralButterfly',
// 'polyhedral collignon': 'polyhedralCollignon',
// 'polyhedral waterman': 'polyhedralWaterman',

'gringorten quincuncial': 'gringortenQuincuncial',
'peirce quincuncial': 'peirceQuincuncial',
*/
};

// name of the axes
Expand Down
6 changes: 3 additions & 3 deletions src/plots/geo/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,9 @@ function getProjection(geoLayout) {
var projFn = geo[projName] || geoProjection[projName];
var projection = projFn();

var clipAngle = geoLayout._isClipped ?
constants.lonaxisSpan[projType] / 2 :
null;
var clipAngle =
projType === 'satellite' ? Math.acos(1 / projection.distance()) * 180 / Math.PI :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does projection.distance() come from? Is that linked to the projection.scale attribute? I imagine users of the satellite would want to be able to fix the satellite's location (height and center lat/lon) and still zoom and pan - to match up with a specific image taken by a satellite. Is that possible as it stands?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The distance and tilt options are now implemented for satellite by d102a47.

geoLayout._isClipped ? constants.lonaxisSpan[projType] / 2 : null;

var methods = ['center', 'rotate', 'parallels', 'clipExtent'];
var dummyFn = function(_) { return _ ? projection : []; };
Expand Down
Binary file added test/image/baselines/canada_geo_projections.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_fitbounds-locations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/image/baselines/various_geo_projections.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading