AtlasOfLivingAustralia / layers-service

Spatial layers - this repo for issues/doc only, not code
3 stars 4 forks source link

Outlier service for expert distribution broken #42

Closed djtfmartin closed 9 years ago

djtfmartin commented 9 years ago

Code is here:

https://github.com/AtlasOfLivingAustralia/layers-store/blob/master/src/main/java/au/org/ala/layers/dao/DistributionDAOImpl.java#L462

Service accepts a x-www-form-urlencoded post with the folllowing request param:

pointsJson=
{"point1":{"decimalLatitude": -37.1,"decimalLongitude": 144.1}}

to the URL

http://spatial.ala.org.au/ws/distribution/outliers/urn:lsid:biodiversity.org.au:afd.taxon:f308a791-3721-4010-87ec-a61868b6ab79

but then blows up with the following exception:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: Incorrect result size: expected 1, actual 3
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
    au.org.ala.web.filter.JsonpFilter.doFilter(JsonpFilter.java:62)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

The code looks like it isnt dealing with the case of when a distribution consists of more than one polygon.

djtfmartin commented 9 years ago

Maybe more to it. This works for the bird Acanthiza (Geobasileus) chrysorrhoa:

http://spatial.ala.org.au/ws/distribution/outliers/urn:lsid:biodiversity.org.au:afd.taxon:8969a0e0-3d46-4c6e-a233-1ba9e82a2886

with

pointsJson=
{"point1":{"decimalLatitude": -18.4,"decimalLongitude": 144.1}}

gives

{
    "point1": 18100.071262463545
}
adam-collins commented 9 years ago

Fixed on prod.