ucsdlib / damsrepo

DAMS Repository
Other
4 stars 2 forks source link

Add geolocation data to DOI functions #74

Closed hjsyoo closed 5 years ago

hjsyoo commented 5 years ago

For both the Mint DOI and Update DOI Record functions, push geographic coordinate data from the DAMS record to the EZID record.

Point In the DAMS, points are listed as a pair of values: latitude, longitude. EZID has a separate labeled field for each of these values.

Line In the DAMS, I believe a line is indicated by two pairs of latitude-longitude values. In EZID, I suspect a line can be indicated in the Polygon field, but I'm not certain.

Polygon In the DAMS, a polygon is represented by a series of latitude-longitude pairs. In EZID, a Box (i.e., a 4-sided polygon) is represented by the 4 bounding latitudes and longitudes. Mapping can be done by extracting the maximum and minimum latitude and longitude values from the lat-long pairs in the DAMS. But a more general solution for any polygon may be to "Enter coordinates of the polygon using either GeoJSON or Keyhole Markup Language (KML) formatted text. Each point is defined by a longitude‐latitude pair. The last point should be the same as the first point."

gamontoya commented 5 years ago

@VivianChu Do you want to work on this one after you're done with #73 ?

VivianChu commented 5 years ago

@gamontoya - Yes, I want to work on this after I'm done with other ticket. Thanks

VivianChu commented 5 years ago

@hjsyoo @gamontoya - I updated the functions to push point and polygon to the EZID record. For example //point https://ezid.cdlib.org/id/doi:10.6075/J0JS9NCJ https://librarytest.ucsd.edu/dc/object/bb7886108t

//polygon https://ezid.cdlib.org/id/doi:10.5072/FK26D5XN6H https://librarytest.ucsd.edu/dc/object/bd3400394d

For the record with line - which fields from EZID record should I use? https://librarytest.ucsd.edu/dc/object/bd6301310g https://ezid.cdlib.org/id/doi:10.6075/J0F18WXQ editezid

Thanks

hjsyoo commented 5 years ago

@VivianChu Thanks for the question - I didn't realize that DataCite/EZID doesn't handle lines. I checked with Greg Janee, and he recommends using the bounding box to depict the general region of the line. This would be easy to compute just by taking the max and min of all the latitude and longitude values in the set (i.e., westbounding = minimum longitude; eastbounding = maximum longitude). If we have a line crossing the poles or 180/-180 meridian, we'll run into problems, because the bounding box will wrap the globe the long way around. Is there a way to apply a conditional, where if the set of points within the line contain both positive and negative longitude values, then the rules are reversed (i.e., westbounding = maximum long.; eastbounding = minimum long.)?

VivianChu commented 5 years ago

@hjsyoo - Is this correct - southBoundLatitude=minimum lat and northBoundLatitude = maximum lat? I think there's a way to apply a conditional that you mentioned above. Thanks

hjsyoo commented 5 years ago

@VivianChu Yes, that's correct. Latitudes don't require a conditional, except at the poles (+90/-90). But if we encounter one of those exceptions, I think it's so complicated that it's better to cross the bridge when we get to it!

hjsyoo commented 5 years ago

@VivianChu I just realized that the conditional rule for longitudes is a little more complicated than I described above. Let's set the rule that IF max(long)-min(long) <= 180, THEN westBounding = min(long) AND eastBounding = max(long). ELSE IF max(long)-min(long) > 180, THEN westBounding = max(long) AND eastBounding = min(long). I believe this makes the assumption that the bounding box encompassing a line should always take the shortest arc around the earth, i.e. no more than half way around.

VivianChu commented 5 years ago

@hjsyoo - The new conditional rule is easier. I got the line working fine without the rule. For example - https://ezid.cdlib.org/id/doi:10.5072/FK26D5XN6H Do you have example set of points in the line that I can use to test that new conditional rule? Thanks

hjsyoo commented 5 years ago

@VivianChu Easier is good! Here's an example that you can test. https://librarytest.ucsd.edu/dc/object/bd0362823k. It's actually a polygon, but you can probably test it anyway? Note that Leaflet draws the polygon incorrectly - it wraps around the globe the long way. I have it on my to-do list to fix this problem for the DAMS as well!

VivianChu commented 5 years ago

@hjsyoo - For the example above with this set - -36.1612,-176.102996826172 -36.1612,174.787994384766 -45.8515,174.787994384766 -45.8515,-176.102996826172 -36.1612,-176.102996826172 The transform result is this: westBounding = max(long) AND eastBounding = min(long)

174.787994384766 -176.102996826172 -45.8515 -36.1612

For This example -
westBounding = min(long) AND eastBounding = max(long) https://ezid.cdlib.org/id/doi:10.5072/FK26D5XN6H

Do they look correct to you? Thanks

hjsyoo commented 5 years ago

@VivianChu The record looks the same as the previous example. I see this: [box (W=-118.9339981, E=-117.1340027, S=32.5834999, N=34.044899)] Maybe it hasn't updated yet?

hjsyoo commented 5 years ago

@VivianChu I think I misunderstood. Yes, the transformed result looks correct!

VivianChu commented 5 years ago

@hjsyoo - That transform result is from my local. The record looks the same because I haven't update the record to use the polygon line set you gave https://librarytest.ucsd.edu/dc/object/bd3400394d Let me update the record and push the update button. I'll let you know when it get updated.

VivianChu commented 5 years ago

@hjsyoo - I updated that dams record to use the line set you gave and here's the ezid record https://ezid.cdlib.org/id/doi:10.5072/FK26D5XN6H

Geolocations: [box (W=174.787994384766, E=-176.102996826172, S=-45.8515, N=-36.1612)]

hjsyoo commented 5 years ago

Perfect. Thank you @VivianChu

VivianChu commented 5 years ago

@hjsyoo - The update has been deployed to production.