[OSM-dev] OSM in-browser JavaScript editor

Paul Hartmann phaaurlt at googlemail.com
Sun Apr 8 16:35:48 BST 2012


On 04/08/2012 11:11 AM, Alex Morega wrote:
> That's an interesting approach, to use JOSM code recompiled for the
> browser. I see you ran into the same-origin-policy problem too. Can
> it be fixed in the API, to allow cross-origin requests?

Yes, I believe so. One solution would be Cross-origin resource sharing
(CORS). [1]
It is currently a W3C Working Draft and according to Wikipedia, all
major browsers support it. Notable exceptions are IE 7 and earlier and
all versions of Opera (but support is under way). The technical details
and the implementation still have to be sorted out, but it sounds
promising to me.

For downloads, you can also use JSONP, but I think it does not work for
uploading data to a remote server.

A third option would be to deploy the editor on openstreetmap.org when
it is finished / usable. ;)

> [...] depends on a thin server proxy to perform OAuth and upload
> changesets to the API. It should work well on mobile browsers;

The Beboj proxy currently does XML<->JSON conversion so it is a little
thicker.

> I'll keep working on the pure-JavaScript implementation, because it
> should be easier to maintain on the long run (simpler code, no GWT
> required on a developer's machine) and perhaps more flexible (because
> it's not constrained to the assumptions already made by JOSM). Also,
> writing a map editor from scratch is fun :)

I agree, it is worthwhile to follow both approaches. Although the goals
are similar, both projects (Lawn and Beboj) are very different from a
technical point of view. It will be interesting to see how they develop
over time...

[1] https://developer.mozilla.org/en/http_access_control

Best, Paul



More information about the dev mailing list