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

Shakemap map bounds across date line breaking #1840

Open
dslosky-usgs opened this issue May 1, 2020 · 8 comments
Open

Shakemap map bounds across date line breaking #1840

dslosky-usgs opened this issue May 1, 2020 · 8 comments

Comments

@dslosky-usgs
Copy link
Collaborator

Checkout us1000778i

@jmfee-usgs
Copy link
Contributor

You can probably handle this by normalizing the coordinates around the epicenter, so longitudes are consistent. If event longitude is +, normalize all values to be [0,360); if event longitude is -, normalize all values to be (-360,0]. For the image overlay, something like:

if (maxlon < minlon) {
  maxlon += 360;
}

This was an issue in geojson and @cbworden implemented something to handle this shift. For this event, all longitudes seem to use the - coordinate system even though epicenter is +. This results in contours plotting on "wrong" side of map instead of with epicenter.

@cbworden
Copy link
Member

cbworden commented May 1, 2020

I'm not sure I understand what you mean by "all longitudes". From where are you obtaining the longitudes? The overlay png looks okay, and the png world file correctly gives the upper left corner of the plot and the dx increment is positive and the dy is negative. What needs to change to make the overlay work?

@jmfee-usgs
Copy link
Contributor

Looking in the event feed:
https://earthquake.usgs.gov/fdsnws/event/1/query?eventid=us1000778i&format=geojson

The shakemap product reports:

"maximum-longitude": "-179.65
"minimum-longitude": "165.633",

The image overlay is stretched and reversed because of this. Daniel can probably update the referenced coordinates so the overlay is shown correctly, or they could be updated for internal consistency before sending the product:
https://earthquake.usgs.gov/earthquakes/eventpage/us1000778i/shakemap/intensity

MMI contours file uses negative coordinates, even though the epicenter longitude is reported as (+)173.054. When selecting contours they are plotted on the "other" side of the map at the left edge.

-194.366667,
-47.216771,
-179.68322,
-36.65

https://earthquake.usgs.gov/archive/product/shakemap/us1000778i/atlas/1588366220781/download/cont_mi.json

Coverage JSON is consistent with epicenter longitude and looks good:

"start": 165.63333333333333,
"stop": 180.29999999999998,
"num": 111

@cbworden
Copy link
Member

cbworden commented May 1, 2020

I guess I'm lost. It seems like in one case longitudes that go beyond +/-180 are okay, and in the other they are not. Is everything relative to the epicenter, or are longitudes absolute? Why is -179 different from 181? And when?

So, if my epicenter is 179.0 and the map spans 4 degrees (+/- 2 degrees on either side of the epicenter), what are its max/min longitudes? And if the epicenter is -179.0, what are its max/min longitudes? For everything. The properties, the contours, the stations, everything.

@jmfee-usgs
Copy link
Contributor

The main problem is when we use the data in leaflet. It's longitudes continue, but it only wraps at 360 instead of 180.

Using coordinates that are close to the reported epicenter helps keep all the data in a similar view. So if the epicenter was at +179, use coordinates [+177, +181]; for -179, use coordinates[-181, -178]; etc. It's okay if the values extend beyond +/- 180 as long as they are centered on the epicenter. Generally this should keep longitudes within (-360,360] and better to be consistent even if there's a little overflow.

There's a whole other issue if the origin is on one side, and shakemap on the other, but it's much easier to shift individual points than polygons with many points.

@cbworden
Copy link
Member

cbworden commented May 1, 2020

Okay, thanks. I'll go through the code and try to keep things consistent with the epicenter. If only the world was flat this would all be easier.

@cbworden
Copy link
Member

cbworden commented May 5, 2020

Are we reasonably safe at the zero line? So, e.g., if the min longitude is -2 and the max is +2 I can leave it?

@jmfee-usgs
Copy link
Contributor

yes, because those are both close to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants