theCrag / website

theCrag.com: Add your voice and help guide the development of the world's largest collaborative rock climbing & bouldering platform
https://www.thecrag.com/
110 stars 8 forks source link

Request to adjust returned json for index detail API call (For Topo field) #2516

Closed stuartin closed 3 years ago

stuartin commented 7 years ago

When making an Index Detail API Call that includes the Topo field, the returned JSON includes the 'width of original topo' and 'height of original topo'. These fields are not very relevant. It would be better if the call would return the 'modified width' and 'modified height' dimensions (these are the dimensions that are used to determine the scale of the points when re-drawing a topo line).

API Call: https://dev.thecrag.com/api/index/detail/11875969?key=abc&withdata=NodeID,Name,Topo

Example JSON (Index 43, nodeId = 13950577) [13950577,"The Gatekeeper",[[938753856,[["R",15697897,"48.9 541,42.9 467,22.2 430.9,11.9 406,1.6 349.2,0.7 284.6,37.7 269.1,59.2 238.2,59.2 137.5,67 107.4"],["R",15697945,"151.3 536.7,139.3 478.2,130.6 435.2,136.7 407.7,140.1 378.4,147.9 353.5,132.4 328.5,128.1 271.7,140.1 226.1,142.7 192.6,135 169.3,119.5 154.7,126.3 132.3,126.3 113.4,115.2 93.6,139.3 68.7,165.9 30.8"],["R",15697993,"376.7 535,326.8 356.1,320.8 277.8,308.8 231.3,294.1 191.7,241.6 164.2,242.5 128.9,242.5 106.5,243.4 82.4,258 65.2,275.2 46.3,254.5 21.3"],["R",15698041,"166.8 535,139.3 478.2,130.6 435.2,136.7 407.7,140.1 378.4,147.9 353.5,132.4 328.5,128.1 271.7,140.1 226.1,142.7 192.6,135 169.3,141 148.7,153 132.3,170.2 106.5,188.3 80.7,189.2 68.7,189.2 54,186.6 34.3,195.2 22.2"]],3120,4160,"a9f9031b2cccf028ec1b9b4355a04b7eb8ca5746",null,625832496]]]

Preferred JSON: [13950577,"The Gatekeeper",[[938753856,[["R",15697897,"48.9 541,42.9 467,22.2 430.9,11.9 406,1.6 349.2,0.7 284.6,37.7 269.1,59.2 238.2,59.2 137.5,67 107.4"],["R",15697945,"151.3 536.7,139.3 478.2,130.6 435.2,136.7 407.7,140.1 378.4,147.9 353.5,132.4 328.5,128.1 271.7,140.1 226.1,142.7 192.6,135 169.3,119.5 154.7,126.3 132.3,126.3 113.4,115.2 93.6,139.3 68.7,165.9 30.8"],["R",15697993,"376.7 535,326.8 356.1,320.8 277.8,308.8 231.3,294.1 191.7,241.6 164.2,242.5 128.9,242.5 106.5,243.4 82.4,258 65.2,275.2 46.3,254.5 21.3"],["R",15698041,"166.8 535,139.3 478.2,130.6 435.2,136.7 407.7,140.1 378.4,147.9 353.5,132.4 328.5,128.1 271.7,140.1 226.1,142.7 192.6,135 169.3,141 148.7,153 132.3,170.2 106.5,188.3 80.7,189.2 68.7,189.2 54,186.6 34.3,195.2 22.2"]],413,550,"a9f9031b2cccf028ec1b9b4355a04b7eb8ca5746",null,625832496]]]

API which has the requested data: https://dev.thecrag.com/api/area/id/13950577/topos?key=abc

Not that the baseDimension has the dimensions that would be preferable to be returned in the index detail call (baseDimension = modified, so get the modified width and height from the dimensions key).

scd commented 3 years ago

I think this was updated with recent topo api review. Closing