Skip to content
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

Projection as part of mapState #204

Open
voinSR opened this issue Sep 8, 2023 · 4 comments
Open

Projection as part of mapState #204

voinSR opened this issue Sep 8, 2023 · 4 comments
Assignees
Labels
enhancement feat: (New feature or request)

Comments

@voinSR
Copy link
Collaborator

voinSR commented Sep 8, 2023

Description

I propose to include current map projection into mapState object, next to the coordiantes, zoom and time.

  • What is it useful for?
    it can be useful for maps with multiple projection. Let's say we want to restore a view that user stored (specific coordinates, layers, time and projection) and/or generate stateful links. Another bonus is that we can listen for projection changes and do some actions. Eg. when projection is changed all features are reprojected automatically, but when we have Webmercator and the new projection is Polar Stereographic all features located in higher that 85 deg lat would have distorted coordinates. Having projection in the mapState we could catch such situations and implement some workarounds.

  • Does this change impact existing behaviors? If so how? --> no

Relevant Package

This feature request is for @dlr-eoc/....

Examples

Are there any examples in other projects that demonstrate this feature or enhancement? --> not yet

Describe alternatives you've considered

Have you considered any alternative solutions or workarounds? --> no alternatives

if you guys give me a green light I would implement this feature and create PR

@voinSR voinSR added the enhancement feat: (New feature or request) label Sep 8, 2023
@voinSR
Copy link
Collaborator Author

voinSR commented Sep 8, 2023

in mapService i found projectionChange: Subject which can do the trick. But think it could make sense to bring this into mapState, isn't it?

@boeckMt
Copy link
Member

boeckMt commented Sep 8, 2023

Yes, that's a good idea.

So would it be enough to extend the MapState with epsg: string e.g.

export class MapState implements IMapState {
  zoom: number;
  center: {
    lat: number;
    lon: number;
  };
  options: IMapStateOptions;
  extent: TGeoExtent;
  time: string;
  epsg: string;
...

or do you need more parameters of a projection?

@voinSR
Copy link
Collaborator Author

voinSR commented Sep 8, 2023

i think we need to store somewhere a container with projection definitions for the map and to move the logic for projection switch to mapState (as we do with coordinates) and then projectionSwitch would not call mapSvc to change projection, but the mapState... ahh it is a bit bigger change than i thought

i have to think a bit

@boeckMt
Copy link
Member

boeckMt commented Sep 11, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feat: (New feature or request)
Projects
None yet
Development

No branches or pull requests

3 participants