We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

VR Map: Putting OpenStreetMap Data Into a WebVR World

00:00

Formale Metadaten

Titel
VR Map: Putting OpenStreetMap Data Into a WebVR World
Untertitel
Simple GeoData Visualization with A-Frame
Serientitel
Anzahl der Teile
561
Autor
Lizenz
CC-Namensnennung 2.0 Belgien:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
Mixed Reality (XR), i.e. Virtual and Augmented Reality, opens up new possibilities for 3D visualizations of OpenStreetMap data (OSM). With WebXR and Mozilla's A-Frame library, it's really simple to create cross-device XR experiences running right in the browser with very little code. VR Map brings all that together and allows you to walk or "fly" through a virtual model of the real world courtesy of live OSM data. The talk will describe WebXR as Mixed Reality APIs for the browser and A-Frame as Mozilla's library to make it really simple to build WebXR scenes. Then, it will dive into how those technologies were used together with live OSM data to create the VR Map demo and show how it enables people to move through virtual models built from that real-world data to give an interesting new perspective on OpenStreetMap - and hopefully inspire developers to build similar experiences.
10
58
80
111
137
Vorschaubild
15:21
159
Vorschaubild
18:51
168
Vorschaubild
26:18
213
221
Vorschaubild
15:22
234
Vorschaubild
49:51
248
Vorschaubild
23:06
256
268
283
Vorschaubild
28:38
313
Vorschaubild
1:00:10
318
Vorschaubild
21:35
343
345
Vorschaubild
36:13
353
Vorschaubild
18:44
369
370
373
Vorschaubild
44:37
396
Vorschaubild
28:21
413
Vorschaubild
16:24
439
455
Vorschaubild
25:10
529
Vorschaubild
15:36
535
Vorschaubild
28:04
552
RahmenproblemVisualisierungZeitrichtungRechenschieberSchlüsselverwaltungVerschlingungFirefox <Programm>SpieltheorieVirtuelle RealitätErweiterte Realität <Informatik>Mixed RealityMereologieStandardabweichungOffene MengeBenutzerfreundlichkeitATMBrowserDemoszene <Programmierung>GamecontrollerGeradeMAPOffene MengeTablet PCRechenschieberBrowserComputerspielSpieltheorieMultiplikationsoperatorATMStandardabweichungGeradeGruppenoperationImplementierungHead-mounted DisplayMereologieSoftwareentwicklerNatürliche ZahlBenutzerbeteiligungBenutzerfreundlichkeitInternetworkingGamecontrollerBitFluss <Mathematik>CodeMixed RealityBeamerStützpunkt <Mathematik>BildschirmfensterBetafunktionEinsTelepräsenzSoundverarbeitungRechter WinkelPunktFreiheitsgradEntscheidungstheorieReelle ZahlDefaultOnline-KatalogKontrollstrukturVollständigkeitVerschlingungTreiber <Programm>SoftwaretestProgrammbibliothekDemo <Programm>Web-SeiteProgram SlicingPatch <Software>AggregatzustandFacebookKoordinatenMinimalgradVirtuelle RealitätVisualisierungComputeranimation
ServerAxonometrieRahmenproblemProgrammbibliothekGebäude <Mathematik>KugelKreisbewegungWürfelEbeneKugelWürfelTesselationMetropolitan area networkKoordinatenAutomatische IndexierungMultiplikationsoperatorStandardabweichungTopologieDurchmesserDemo <Programm>MAPSuite <Programmpaket>Gebäude <Mathematik>FlächeninhaltDatenbankFormation <Mathematik>UnrundheitDienst <Informatik>Güte der AnpassungComputerspielProgrammbibliothekSichtenkonzeptGraphfärbungDemoszene <Programmierung>MereologieDefaultWeg <Topologie>Automatische HandlungsplanungKrümmungsmaßElektronische PublikationMathematikMinkowski-MetrikKreiszylinderCodeOffene MengeEndliche ModelltheorieSchlüsselverwaltungTermGamecontrollerRechenbuchHill-DifferentialgleichungWeb SiteDivergente ReiheSchätzfunktionBitTextur-MappingNichtlinearer OperatorMinimalgradOrtsoperatorMeterRadiusBildgebendes VerfahrenSystem-on-ChipKategorie <Mathematik>Projektive EbeneAuswahlaxiomVolumenvisualisierungCachingEbeneComputeranimation
PolygonnetzLastSichtenkonzeptBitWürfelDefaultCodeVerschlingungSchlüsselverwaltungDemoszene <Programmierung>KreisbewegungProgrammbibliothekComputeranimationVorlesung/Konferenz
KugelWürfelKreisbewegungEbeneSichtenkonzeptVerschlingungQuick-SortGraphfärbungBenutzerfreundlichkeitVollständiger VerbandMessage-PassingKartesische KoordinatenXML
KugelWürfelKreisbewegungEbeneSichtenkonzeptVariableObjekt <Kategorie>Umsetzung <Informatik>VektorrechnungTypentheorieCodeIkosaederMachsches PrinzipDemo <Programm>Physikalisches SystemRelativitätstheoriePunktElektronische PublikationTopologieRahmenproblemLastAbfrageOrtsoperatorQuaderKoordinatenZeichenketteObjekt <Kategorie>Zusammenhängender GraphStichprobenumfangE-MailGebäude <Mathematik>TesselationCodeMultiplikationsoperatorNebenbedingungDatenmodellFunktionalInverser LimesWürfelMereologieUmsetzung <Informatik>Automatische IndexierungBitrateGamecontrollerSkriptspracheTouchscreenDivisionAttributierte GrammatikOffene MengeSchreib-Lese-KopfMeterBitParametersystemDatensichtgerätDemo <Programm>MAPEinfach zusammenhängender RaumSchreiben <Datenverarbeitung>Meta-TagComputeranimation
Konvexe HülleBinärdatenDemo <Programm>Inklusion <Mathematik>Hill-DifferentialgleichungGebäude <Mathematik>OrtsoperatorMAPBitAbfrageMeterSchätzfunktionTurm <Mathematik>ProgrammNP-hartes ProblemGeradeVariableWellenpaketSelbst organisierendes SystemTransformation <Mathematik>Endliche ModelltheorieDefaultMultiplikationsoperatorKiosksystemGraphfärbungCodeATMMaßerweiterungRahmenproblemElement <Gruppentheorie>TopologieMereologieNatürliche ZahlTermAbstraktionsebeneDemoszene <Programmierung>Textur-MappingSchlüsselverwaltungRechter WinkelCASE <Informatik>AutorisierungDigitale PhotographieKorrelationsfunktionFormation <Mathematik>Konstruktor <Informatik>ComputeranimationVorlesung/Konferenz
Computeranimation
Transkript: Englisch(automatisch erzeugt)
So I'm going to talk about VR Map, which is bringing Open Street Map data into Web of VR. So it's actually using the real world data.
One thing I would like to know is, how many people here are Open Street Map users at least? OK, how many of you have worked with the Overpass API? Very few, OK. OK, has anyone been to my talk yesterday?
OK, this will be very similar. I will talk a little bit more about the Open Street Map parts of this, but it will be very similar. It's the same slides. The slides are up at slides.power.at slash positive 2019. I did not get around yet to put it on the main page of
slides.power.at. They will be there, linked there, I think, tomorrow or something, as soon as I get to it. I'm Robert Kaiser. I'm a Mozilla tech speaker. Most people call me Cairo. And I'm also an Open Street Map contributor, and have
been for a long time, mostly in Austria, also pretty active in the Austrian Open Street Map community. So what is this talk about? Mainly, what I want to tell you about is the cross-device nature of those technologies of WebVR or WebXR, the ease of
use of the library I'm using, which is A-Frame, which makes it really easy to get stuff into WebVR, and the ability to use Open Street Map data for this audience, specifically, also a few tricks I'm doing with Open Street Map data for this visualization.
So first, what is WebXR or WebVR? VR is virtual reality done with web technologies, so HTML, JavaScript, and so on.
XR is a very mixed reality. This is a pretty new term. It was crafted to put AR in VR under one phrase, and make one standard that encompasses all of those, VR, VR, and
everything in between. At the W3C, there's a working group for that, and a proposed standard for WebXR. The AR parts of that are still somewhat in flux. The VR parts of that are pretty stable now, and multiple browsers actually have implementations for it.
It bases on WebGL, Web Audio, and for the controllers, on the game paddock EPIs. It can be used on full VR headsets, of course. Both the three degrees of freedom ones, like this one, and the six degrees of freedom, they give you full
immersion, so you can also walk in the scene, with those you can only turn around. And for the desktop devices, for the PC-connected devices, like the HTC Vive and the Oculus Rift, Firefox in release on Windows already supports WebVR completely.
So you just plug in your HTC Vive or whatever, launch the VR tools, launch Firefox, and enter the VR from the browser with the HTML and JavaScript technologies. On Mac, I think it's in beta right now. It was set back to nightly at some point, and then put
back into beta again. Mozilla wants to release it soon, but there have been a few complications with the drivers. On Linux, the drivers for the HTC Vive are still experimental, and Mozilla is also missing a few patches in the graphics stack. So it's not there yet, but it's in works.
For the Oculus Rift, there's no drivers for Mac and Linux. As soon as Facebook bought it, they stopped all development on Mac and Linux. Make your own thing out of it. But that said, the default Oculus browser on the Oculus Go and the Samsung internet browser for their Samsung
devices, those also implement WebVR. And as far as I know, Microsoft has done some support in Edge for development, and I don't know the real state of that. So there is implementations in a few browsers.
Of course, for those standalone headsets, there is Firefox Reality, which also supports it, which is a browser for those standalone headsets. VRMap itself is a demo I did with live OpenStreetMap
data from the Overpass API. That's why I asked before. It's usable in 2D mode even outside of the VR devices. So you can actually use your phone or your tablet or your PC and look into this as well. I will, in the next slide or in the next minutes, show
you the same thing here on the projector just in 2D mode. But when you go into VR device, where you have controllers, where you have a headset, you can immerse yourself completely into it. It's using the Mozilla A-Frame library. I'll be coming back to that.
And it's a very simple demo. It only has about 80 lines of HTML, most of which are the starting dialogue, which we will see. And about 300 lines of JavaScript. And quite a bit of that is code I'll actually show you, because it makes a few decisions about defaults for stuff that comes from StreetMap.
But the code is not very difficult. It's made for people like you to take it and make something out of it yourself. So let's take a look at the demo itself.
When you launch it, this is the start dialogue. And that's what I said takes up quite a bit of that, of those 80 lines of HTML. And most of it is explanations, including, of course, the OpenStreetMap copyright. And you have a few presets of where it can go.
And those are presets that have at least something that looks decent. You can actually enter coordinates. And I did this before in the cafeteria with someone. And he was, oh, wow, it's actually this place where I'm at home. Everybody seems to do where he's at home.
So did I, because this first preset is, what you see in the back there is actually in front of the door of the building I'm living in. This is very new to it. And I already went there to not bore you with flying around too much. So this is the view of very near.
Back there is where I'm living, if you wonder. So this is a view around of a part of this area. I'm not loading more than this area right now in this demo. The code is made in a way that it should be easy to
dynamically load more. But for a demo, I was like, let's not go into the performance aspects of when you have too much loaded. I want to be able to show this off. And if you want to take more out of it, it's not hard to figure out how to do that.
One thing that's nice here, and that's why I like the example of this area, is that in Vienna, we could import some data for the trees. All trees in public areas in Vienna have an open government index. And we imported that into OpenStreetMap. And so we know the height of the trees.
We know the circumference of the leaves and so on. And we know the diameter of the ground, that is, and the circumference of the track. So I can use all that. I still used a very simple model for trees.
But still, you get different sized trees. And that's pretty nice. In that preview picture I have here, you see that for needle leaf trees, I have a different way of displaying them even. Because we have that data as well.
And OpenStreetMap has the taste for it. So you have that with the AWS keys. You can fly around in the scene. You see there's some trees even in there. Those trees have no further tags. Those are just some defaults.
And you see you have different heights of the buildings as well, which, usually in OpenStreetMap, you don't have a lot of heights of buildings. You have some. But then if you have the amount of levels the building has, you can do a pretty good estimate. And then I have a few things. And I'll show you a bit of that, of how I get to two
heights when I don't know much. In this area, I walked around with a sheet, and just printed out OpenStreetMap data, and just wrote, this is six stories, this is five, this is four, this is one, and so we get a pretty nice
picture of a realistic view. So that's the demo, how it looks in principle. So to make that code simple, I had to start with a few simplifications. And one of them was that the world is flat.
Actually, it's flat in two ways in this demo. For one thing, there's no curvature of Earth. That makes it much easier in terms of calculations. And for the other thing, there's no hills and valleys. But before the flat Earth support a series of choice too much, I actually had to respect the latitude and the
curvature of Earth, because I'm using the ground tiles from Mercator projection. And those change size based on latitude. And so the coordinate system inside the VR space is in meters. So I needed the size in meters of those ground tiles.
Those ground tiles I'm just using from the default Mavnik tiles that OpenStreetMap renders. I'm using it via a tile cache that I'm operating myself to not overtax OpenStreetMap service.
The trees and buildings though, I'm taking directly from the Opera Pass API. So that's really live data. If you change it in OpenStreetMap, if you add the tree, a few minutes later, you actually have it in this demo as well. There's a camera and controller setup that the
library has some defaults. But if you want the controllers to work right, you need to put some setup in there to enable this flying navigation and things like that as well. And it's built with the A-Frame library.
So the A-Frame library, I just mentioned that a second time, and now I really should tell you what it is. It's a Mozilla library that makes it really, really easy to create VR scenes. Basically, you include a JavaScript file at the top of
your HTML file, and then you write some text. Those are not in the HTML standard, but the library interprets them and makes something out of them. On the outside, you put an AC tag, and then everything in there is used and rendered in the VR space. Like an A-sphere, an A-cube, an A-cylinder, an A-plane.
The planes are tiles on the floor, of course, even in my example. This here is not the code I'm using. This is an example, and I'll show you in a minute how this example looks. And you can even do animation of things by just putting an animation inside something, and then this something is
animated with those properties. And you just use standard HTML syntax to put properties on those things. So you have a position, you have a radius. That sky with the color is just a sphere that has the
inside painted with that color. And if you put A-sky SRC equals something, then you actually have this image that you put in the SRC projected on the inside of that sphere, so that you can very easily get a texture on it as well.
Or a 360-degree image, if you want. So you only need to know HTML if you can do VR scenes. That's pretty nice, ain't it? To show you how this example looks, I probably need to reload, because it still says loading.
Yeah, and now it's loading. So let's make it a little bit bigger. That's the scene you just saw described, and the code is a bit small, but it's still up here. The default even has the scrolling with the keys, the
ESD keys. And you saw that animation with the tag and the cube is just rotating. We didn't even write any JavaScript, and it's rotating. That's nice. Well, underneath it, it has the 3JS library, which is
heavy JavaScripting, but it's abstracted enough that we can do this. So this is, if you look at the slides, the edit view link is sort of what I just showed you. And you can dynamically try out stuff there as well. So if you want to, you can go in here and say, which
one? This here? This too? Yeah, I can change that.
Let's make this zero. Now it's not animating at all because it's animating by zero, and let's make this 360, and now it's going a different axis. And I can exchange the colors and whatever I like to animate this here.
So it's pretty nice. You can learn more about A-Frame at a-frame.io. It also has a few other samples there. I wanted to get back to my demo.
Take a short look into index HTML, but I went to that more in a similar room. And you can look into it yourself as well. I want to get more to the OpenStreetMap things here. There has the start dialog and this
camera controller theme. Map.js is the main JavaScript file that loads all the stuff and does the fetch from Overpass. Conversions is boring, but it's necessary because you have a lot of coordinates conversions in there.
Position limit is an A-Frame component. I wrote that, and it's a very nice example for how you write an A-Frame component. I went to do this yesterday. I will not do that today to have a bit more time for the OpenStreetMap parts. I had the problem when I was flying, I could fly
through the ground. So I said, let's do it right and write something that prohibits me from going through the ground. It's a very nice example of how to easily do a component. And then I have tiles, trees, and buildings.js that loads
and draws these three tiles, types of objects. So the tiles on the ground, and the trees. It's on GitHub at pyro-at slash vrmap. You will see that URL later.
With that, let's look at the code, then we'll come back to what we learned. So this is still from yesterday. That's the component. The one thing that's interesting in the component is there's a tick function in there. You just write one function, and that's called every time the display updates. And that's the tick. And basically, on every tick, I set back the coordinates if
it's outside of my constraints. It's very easy. So let's go back here and take a short look into index.html. This has a lot of imports of scripts. This is the main A-Frame, and then I have a few additional components.
There is a components indexing on A-Frame IO, where you can find a few things that you can easily plug in, and make it easier to write stuff without JavaScript. That's all the intro dialogue, and then here we have the A scene. That still fits on one screen.
A entity is basically the div of A-Frame. So it's the container that can be anything and can contain it. And actually, an A cube or something is just a specialized A.
So the ground is a workaround, but the map entity has a container for tiles and a container for items, which is trees and buildings. And here's the camera rig. A component enables another attribute here.
So you have movement controls that allow you to fly. And here, I'm putting in my own component that you saw for a minute there. Position limit equals with those parameters. The Y min 0 is the really important one that I cannot go through this floor.
I did not mention the coordinate system. I'm saying Y min just if it was the most natural thing. So if you stand in the VR scene, then X is horizontal, Y is vertical, and C is the component that goes towards you or away from you.
So that's why Y min is 0. And I will not go into the mix-ins here, but you have a head that's 1.6 meters above the ground, which feels pretty natural for most people to have the head around that
above the ground. And then you have a left hand and right hand for the controllers. And it loads those controllers if any of those things is present. So it's not that hard to understand if you take a bit of
time to look at it. I know it's a bit fast now to just have something thrown out here, but it's not hard to understand. And then I want to take a bit of a look. So the tiles are pretty simple.
So yeah, anyone who has worked with Overpass, here's the stuff that looks familiar to those who have used Overpass. Here I'm having the Overpass query. The bounding box string is calculated from whatever
we're displaying. And otherwise, it just loads all nodes with natural equals three. Who has actually edited OpenStreetMap in here? So those of you with natural equals three will be something you have heard about.
And the system of nodes, ways, and relations you probably have heard about as well. For the others, the data model of OpenStreetMap is you have points that are nodes that have coordinates. And you have connections of nodes that are ways. And you can have relations that's just a meta reference
to any object. And any of those can have key value tags. So natural equals three is a tag. And that tells me that's a tree. Very easy to understand in this case. There are some that are not that easy to understand. Find a fetch that, convert that to GeoJSON, because
that's easy to process afterwards. And then here dynamically creating, and you'll see I'm just creating HTML elements. So if you ever created stuff with JavaScript, if you ever
created elements with JavaScript, that's basically how you did it. If you did not use any abstraction layer, you can actually use all kinds of abstractions like AngularJS or jQuery or whatever with this as well.
And then I'm setting all kinds of stuff here. You see I'm pretty much getting to the end. So a very short look into the buildings. That's a bit more difficult, because I had to find out if all heights of buildings.
So actually, if there is a height equals something tag on it, I'm using that height. I'm using the, if there's a building levels on it, I'm actually using that and calculating times three. I think I have that down here somewhere.
Or I have a meters per level variable that I'm multiplying with, which is set up here. So I estimate every level is about three meters, which is pretty OK. Near buildings are usually less, over buildings can even be more.
And if I don't have that, it gets scary. But sometimes there's building equals like kiosk or cabin or something like that, or carport. I can safely assume those are one level high.
Those will not be higher than that, usually. And then I have some special defaults, like the house I'm estimating is two levels, as well as a farm. The transformer tower I'm estimating is 10 meters high. And the water tower I'm estimating is 20 meters high. Just to have something that looks somewhat realistic.
And under construction, I'm even giving the buildings a different color. If I don't have all that, I'm going back to a default. And then I even have some specialty in there that will not, because of time reasons, not go in there.
Very small buildings, I even go lower than normal. So it's not too hard. I hope that's not too hard to understand in terms of code. So what we've seen here is how the cross-device nature of
those technologies, when we are WebXR. We saw it in 2D mode here. You have to believe me right now that it's working in the headset, but you can actually take a look at it afterwards in this one.
It's a user frame. I showed that quite a bit. And the ability to use OpenStreetMap data and a bit of how you're using the OpenStreetMap data. If anyone's interested, you can look it up, which query I'm using for the buildings. And there's a few improvements that can even be done there.
But what I would really encourage you to do is to look at the code, make it your own. Those are two examples where people have done that. One was for finding the right position of an actual model of a building within a scene.
And then you can use that right position and put it back into OpenStreetMap. So it's defined how those buildings should be placed when being rendered somewhere. And OSM rail, someone actually made something where
you can ride along the train line and see everything that's around it. And with that, I'm at the end. If you have any questions, I'm happy for those. And if you want to look at it yourself, the rail is up there, the GitHub is up there.
OK, one and a half minutes for questions. Anybody? If you want to color all the buildings based on the values you got back from OSM, that's in doable, right?
So I actually have in there the color of the building. If there's just a color, it puts something that I'm using that. I do not have the more extended thing with building parts in it. But if the whole building has one color, you actually have that in there right now.
Would it support using a photograph of the building as a texture? You would need to do some programming to set the SRC and whatever. And it's a bit hard because it would just project around it. So you would probably need to do some manipulation. But I think it should be doable.
Well, we have come to the end of this day in this room. Please fill out the feedback either via your app, if you have the right device, and otherwise via the website, that gives the organization some guidance for next year
how to program, and where to program, and what to do with it. Thank you very much.