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

Provide image URLs for map JSON results #346

Closed
jywarren opened this issue Feb 20, 2019 · 2 comments
Closed

Provide image URLs for map JSON results #346

jywarren opened this issue Feb 20, 2019 · 2 comments

Comments

@jywarren
Copy link
Member

Our API currently shows:

https://mapknitter.org/map/region/Gulf-Coast.json?minlon=-98.8&minlat=23.6&maxlon=-79.1&maxlat=31.8

Which just converts map records to json directly, and results in them having a lot of not very useful content that's not readable; the body attribute especially.

We should remove body and instead include an imageUrl parameter, by appending it like we do here:

# used by leaflet to fetch corner coords of each warpable
def images
map = Map.find params[:id]
warpables = []
map.warpables.each do |warpable|
warpables << warpable
warpables.last[:nodes] = warpable.nodes_array
warpables.last.src = warpable.image.url
warpables.last.srcmedium = warpable.image.url(:medium)
end
render :json => warpables
end

This would let us display an image in the popup on the Leaflet map in Leaflet Environmental Layers: publiclab/leaflet-environmental-layers#112

@kaustubh-nair
Copy link
Member

Hey I'd like to take this issue!
If i understand it correctly, you want to display only the image urls for all warpables in each map right?

@jywarren
Copy link
Member Author

jywarren commented Feb 20, 2019 via email

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

No branches or pull requests

3 participants