poissonconsulting / fwapgr

An R Client for BC Freshwater Atlas Web API
https://poissonconsulting.github.io/fwapgr
Other
8 stars 1 forks source link

different CRS output depending on downstream_route_measure value #68

Closed sebdalgarno closed 2 years ago

sebdalgarno commented 2 years ago

The output of the following

https://features.hillcrestgeo.ca/fwa/functions/postgisftw.fwa_locatealong/items.json?blue_line_key=356308001&downstream_route_measure=100

is in lon/lat (although EPSG isn't in the json as below)

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.014985692,49.167195259,9.797745916]},"properties":{}}],"numberReturned":1,"timeStamp":"2022-06-30T16:03:54-07:00","links":[{"href":"https://features.hillcrestgeo.ca/fwa/collections/postgisftw.fwa_locatealong/items","rel":"self","type":"application/json","title":"This document as JSON"},{"href":"https://features.hillcrestgeo.ca/fwa/collections/postgisftw.fwa_locatealong/items.html","rel":"alternate","type":"text/html","title":"This document as HTML"}]}

Whereas with different downstream_route_measure:

https://features.hillcrestgeo.ca/fwa/functions/postgisftw.fwa_locatealong/items.html?blue_line_key=356308001&downstream_route_measure=10000

is bc albers EPSG 3005

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:3005"}},"coordinates":[1295576.091236034,467912.302100455,10.5]},"properties":{}}],"numberReturned":1,"timeStamp":"2022-06-16T17:01:17-07:00","links":[{"href":"https://features.hillcrestgeo.ca/fwa/collections/postgisftw.fwa_locatealong/items","rel":"self","type":"application/json","title":"This document as JSON"},{"href":"https://features.hillcrestgeo.ca/fwa/collections/postgisftw.fwa_locatealong/items.html","rel":"alternate","type":"text/html","title":"This document as HTML"}]}

@smnorris any idea what is going on here?

smnorris commented 2 years ago

The request is hitting the cache - this one looks fine. https://features.hillcrestgeo.ca/fwa/functions/postgisftw.fwa_locatealong/items.html?blue_line_key=356308001&downstream_route_measure=10000&nocache=true

I'll clear out the cache!

smnorris commented 2 years ago

Cache is clear, hopefully all works fine now.

sebdalgarno commented 2 years ago

awesome thanks! all good now. Does that clear the cache for all previous function/collection results? (i.e. not just fwa_locatealong)

smnorris commented 2 years ago

Yes, it is a general cache for every request to the web server. I'm not sure how useful it is for featureserv but the cache is really nice when browsing maps created with tileserv.

sebdalgarno commented 2 years ago

ok great - clearing it should help troubleshoot a couple other remaining issues on our end. Yes I can definitely see how useful caching can be - especially for large requests that are done a lot. I can always request that you clear it if we are running into issues (i.e. after API changes as just occurred).

smnorris commented 2 years ago

Note that I haven't yet upgraded the db. The switchover should be seamless but I'll be sure to give you a heads up and clear the cache when I do make the switch.

Not sure if performance will be noticeably better but for some functions there is potential for good speedups.

sebdalgarno commented 2 years ago

OK great thanks. Also sorry I'm just catching up on the previous discussion between you and Joe on setting nocache=TRUE. I've added another issue to modify our tests so that they aren't cached. That will limit the need to request that you clear the cache in future.