watson/airplanejs

Find better default map center

watson opened this issue ยท 7 comments

Currently the map is hardcoded to default to Paris as this is where I first gave a demo of AirplaneJS. But this results in a weird "blinking" effect where sometimes first Paris is loaded, but then your current position is loaded.

It would be nicer if the map was either zoomed all the way out until it could determine your location, or if there was a better way to choose a default location, or maybe even wait drawing the map until your location had been found.

Gotchas

  • It have to be taken into account that the first time someone starts the map, they have not yet approved the browser to know their current location.
  • Some browsers (e.g. Safari) will not allow the user to share their current location when running on localhost.

Hey @watson are you set on using Google maps, would you consider ESRI js api?

Not really, I'm totally open to suggestions. Google Maps was just the one I knew, so I defaulted to it. As long as it's nice looking, have the required features, and doesn't cost money, then I'm open to other ideas ๐Ÿ˜ƒ

I've never heard of ESRI - what's the benefits?

It's free and looks really nice ๐Ÿ˜„ it has stream layers, popups and great 3D support...

https://developers.arcgis.com/javascript/

Example
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=scene-elevationinfo

drom commented

Once you received couple airplane beacons you know the location of observer +- 50km

@drom ah, very good point! I can of course just center the map around where the planes are. Why didn't I think of that ๐Ÿคฆโ€โ™‚๏ธ It might not solve the "blinking" issue though as I might not have received any signals by the time the map tries to load (at least how it's implemented today), but it will solve the issue of Safari and other browsers not allowing me to get the users location on localhost ๐Ÿ˜„

drom commented

@watson it is like you designed location device and asking how to find location ;)

Once you received couple airplane beacons you know the location of observer +- 50km

This is a good idea, except if all aircraft fly high in the same direction from the antenna. That is unlikely, and if it happens, centering the map there might be nice. I suggest not averaging all data points, but look for a bounding box, and using the center of that box.