johnmckerrell / OpenStreetView

An open licensed repository of street level photography, with metadata.
http://www.openstreetview.org/
32 stars 16 forks source link

oEmbed Support #22

Closed panzi closed 13 years ago

panzi commented 13 years ago

It would be really great to have oEmbed support. It shouldn't be hard to implement. Everything needed is supported, only the JSON endpoint needs to be implemented.

See: http://www.oembed.com/

johnmckerrell commented 13 years ago

Sorry for taking so long to get back to you. I did just have a look but I think that as we don't currently have an actual page for showing a single photo we wouldn't really have anything to return for this API? Obviously a fix for that would be to add a page but then there's lots of other things that need doing too.

panzi commented 13 years ago

oEmbed is not just for photos but also supports the type "rich" which allows arbitrary html (e.g. an iframe). I wrote a quick example in JavaScript that generates an oEmbed object for a given OSM URL: http://web.student.tuwien.ac.at/~e0427417/osm/osm-oembed.html http://web.student.tuwien.ac.at/~e0427417/osm/osm-oembed.js

OSM should then provide an oEmbed endpoint: http://www.openstreetmap.org/export/oembed.html?url=PERMALINK&maxwidth=WIDTH&maxheight=HEIGHT&format=FORMAT

Where FORMAT is "json" or "xml". Of course the JavaScript example only implements JSON (and needs the JSON object supported by the browser).

Note that this implementation does not support OSM shorturls because a simple port of the ruby OSMShortLink module does not work in JavaScript. This is because JavaScripts number type is double which is only compatible with 32bit integers and here 64bit integers are needed. The OSM endpoint should support shorturls nevertheless.

panzi commented 13 years ago

Wait. Where am I here. I think I filed that wish at the wrong place.

Still, your service could also support embeds and oEmbed.

johnmckerrell commented 13 years ago

Ah, oops, I'll probably close this for now though as it's not a specific request.