adds updateMap function to map.js

This commit is contained in:
unknown 2020-12-08 12:39:59 +01:00
parent 15fa35f0fa
commit 487dabbbf6
6 changed files with 122 additions and 859 deletions

157
.idea/workspace.xml generated
View File

@ -2,81 +2,12 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="70ae6a46-b58b-4192-b69d-37293bd6e2cf" name="Default Changelist" comment=""> <list default="true" id="70ae6a46-b58b-4192-b69d-37293bd6e2cf" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/cmd/serial_only/serial_only.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cmd/server_only/server_only.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/serial_ubx/serial.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/decode.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/messages.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/strings_navpvt.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" /> <change beforePath="$PROJECT_DIR$/cmd/server/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" /> <change beforePath="$PROJECT_DIR$/cmd/server_only/server_only.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server_only/server_only.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hyperimu.json" beforeDir="false" afterPath="$PROJECT_DIR$/hyperimu.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/net/net.go" beforeDir="false" afterPath="$PROJECT_DIR$/net/net.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/net/net.go" beforeDir="false" afterPath="$PROJECT_DIR$/net/net.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/.gitattributes" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/static/scripts/map.js" beforeDir="false" afterPath="$PROJECT_DIR$/static/scripts/map.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/.gitignore" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/static/scripts/websocket.js" beforeDir="false" afterPath="$PROJECT_DIR$/static/scripts/websocket.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/CONTRIBUTING.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/ISSUE_TEMPLATE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/LICENSE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/README.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/Theory.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example1_calibrateSensor/Example1_calibrateSensor.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example2_getIMUData/Example2_getIMUData.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example3_getSensorStatus/Example3_getSensorStatus.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example4_vehicleDynamics/Example4_vehicleDynamics.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example10_AltitudeMSL/Example10_AltitudeMSL.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example11_ResetModule/Example1_FactoryDefaultviaI2C/Example1_FactoryDefaultviaI2C.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example11_ResetModule/Example2_FactoryDefaultsviaSerial/Example2_FactoryDefaultsviaSerial.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example12_UseUart/Example12_UseUart.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example2_AutoPVT_ExplicitUpdate/Example2_AutoPVT_ExplicitUpdate.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example3_AssumeAutoPVTviaUart/Example3_AssumeAutoPVTviaUart.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example14_DebugOutput/Example14_DebugOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example15_GetDateTime/Example15_GetDateTime.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example16_Nanosecond_MaxOutput/Example16_Nanosecond_MaxOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example16_PartialSecond_MaxOutput/Example16_PartialSecond_MaxOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example17_Geofence/Example17_Geofence.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example18_PowerSaveMode/Example18_PowerSaveMode.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example19_DynamicModel/Example19_DynamicModel.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example1_BasicNMEARead/Example1_BasicNMEARead.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example21_ModuleInfo/Example21_ModuleInfo.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example22_PowerOff/Example22_PowerOff.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example2_NMEAParsing/Example2_NMEAParsing.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example3_GetPosition/Example3_GetPosition.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example4_FixType/Example4_FixType.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example5_SpeedHeadingPrecision/Example5_SpeedHeadingPrecision.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example6_EnableNMEASentences/Example6_EnableNMEASentences.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example7_OutputRate/Example7_OutputRate.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example8_GetProtocolVersion/Example8_GetProtocolVersion.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example9_ChangeI2CAddress/Example9_ChangeI2CAddress.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example1_EnableRTCM/Example1_EnableRTCM.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example2_StartRTCMBase/Example2_StartRTCMBase.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example3_BaseWithLCD/Example3_BaseWithLCD.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/Example1_GetPositionAndTime_Series_6_7.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/SparkFun_Ublox_Arduino_Library_Series_6_7.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/SparkFun_Ublox_Arduino_Library_Series_6_7.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example10_GetHighPrecisionPositionAndAccuracy/Example10_GetHighPrecisionPositionAndAccuracy.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_GetHighPrecisionPositionUsingDouble/Example11_GetHighPrecisionPositionUsingDouble.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_autoHPPOSLLH/Example11_autoHPPOSLLH.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_setStaticPosition/Example11_setStaticPosition.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example1_GetPositionAccuracy/Example1_GetPositionAccuracy.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example2_ValConfigurationMethod/Example2_ValConfigurationMethod.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example3_StartRTCMBase/Example3_StartRTCMBase.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example4_BaseWithLCD/Example4_BaseWithLCD.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example5_RelativePositioningInformation/Example5_RelativePositioningInformation.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example6_GetVal/Example6_GetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example7_SetVal/Example7_SetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example8_GetSetPortSettings/Example8_GetSetPortSettings.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example9_multiSetVal/Example9_multiSetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/keywords.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/library.properties" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/SparkFun_Ublox_Arduino_Library.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/SparkFun_Ublox_Arduino_Library.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/u-blox_config_keys.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/serial.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/server.go" beforeDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -87,21 +18,101 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="GoLibraries">
<option name="indexEntireGoPath" value="false" />
</component>
<component name="ProjectId" id="1l4NBsO3Y7UF6i7T6TL4EsARWQm" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
</component>
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/server">
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/server" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/cmd/server/server.go" />
<package value="git.timovolkmann.de/gyrogpsc/cmd/server" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="index.html" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/gyrogpsc/index.html" useBuiltInWebServerPort="true">
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/server" />
<item itemvalue="JavaScript Debug.index.html" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="70ae6a46-b58b-4192-b69d-37293bd6e2cf" name="Default Changelist" comment="" />
<created>1606852272847</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1606852272847</updated>
<workItem from="1606852274006" duration="9755000" />
<workItem from="1606894728295" duration="599000" />
<workItem from="1607244448990" duration="217000" />
<workItem from="1607244781024" duration="2248000" />
<workItem from="1607419204431" duration="595000" />
</task>
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="752" y="451" key="#GOROOT" timestamp="1606385156675"> <state x="752" y="451" key="#GOROOT" timestamp="1606385156675">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state x="752" y="451" key="#GOROOT/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606385156675" /> <state x="752" y="451" key="#GOROOT/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606385156675" />
<state x="640" y="256" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1607244535893">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="640" y="256" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1607244535893" />
<state width="1877" height="282" key="GridCell.Tab.0.bottom" timestamp="1606865976622">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="282" key="GridCell.Tab.0.bottom/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606865976622" />
<state width="1877" height="282" key="GridCell.Tab.0.center" timestamp="1606865976622">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="282" key="GridCell.Tab.0.center/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606865976622" />
<state width="1877" height="282" key="GridCell.Tab.0.left" timestamp="1606865976622">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="282" key="GridCell.Tab.0.left/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606865976622" />
<state width="1877" height="282" key="GridCell.Tab.0.right" timestamp="1606865976622">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="282" key="GridCell.Tab.0.right/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606865976622" />
<state x="540" y="263" key="IDE.errors.dialog" timestamp="1606385007112"> <state x="540" y="263" key="IDE.errors.dialog" timestamp="1606385007112">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state x="540" y="263" key="IDE.errors.dialog/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606385007112" /> <state x="540" y="263" key="IDE.errors.dialog/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606385007112" />
<state x="461" y="165" key="SettingsEditor" timestamp="1606563366122">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="461" y="165" key="SettingsEditor/0.0.1920.1040/-1440.113.1440.860@0.0.1920.1040" timestamp="1606563366122" />
</component> </component>
</project> </project>

View File

@ -8,7 +8,7 @@ import (
const ( const (
TCP_PORT = ":3010" TCP_PORT = ":3010"
HTTP_PORT = ":3011" HTTP_PORT = ":3011"
SERIAL_PORT = "/dev/tty.usbmodem14201" //SERIAL_PORT = "/dev/tty.usbmodem14201"
) )
func main() { func main() {
@ -19,7 +19,7 @@ func main() {
func collectRoutines(d *dispatcher.Dispatcher) { func collectRoutines(d *dispatcher.Dispatcher) {
// collectRoutines Serial UBX Sensor Data // collectRoutines Serial UBX Sensor Data
go gnet.SerialUbxCollector(d, SERIAL_PORT) //go gnet.SerialUbxCollector(d, SERIAL_PORT)
// collectRoutines TCP JSON Sensor Data // collectRoutines TCP JSON Sensor Data
go gnet.TcpJsonCollector(d, TCP_PORT) go gnet.TcpJsonCollector(d, TCP_PORT)
} }

View File

@ -70,7 +70,7 @@ func NewHttpServer(d *dispatcher.Dispatcher, httpPort string) {
//<<<<<<< HEAD:server.go //<<<<<<< HEAD:server.go
// http.Handle("/static/", http.FileServer(http.Dir("."))) // http.Handle("/static/", http.FileServer(http.Dir(".")))
// log.Fatal(http.ListenAndServe(":3011", nil)) // log.Fatal(http.ListenAndServe(":3011", nil))
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(".")))) http.Handle("/static/", http.FileServer(http.Dir(".")))
log.Fatal(http.ListenAndServe(httpPort, nil)) log.Fatal(http.ListenAndServe(httpPort, nil))
} }

View File

@ -17,14 +17,6 @@ var empty = {
} }
map.on('load', function () { map.on('load', function () {
// We use D3 to fetch the JSON here so that we can parse and use it separately
// from GL JS's use in the added source. You can use any request method (library
// or otherwise) that you want.
//d3.json(
//'static/scripts/hike.geo.json',
//function (err, data) {
//if (err) throw err;
// save full coordinate list for later // save full coordinate list for later
//var coordinates = data.features[0].geometry.coordinates; //var coordinates = data.features[0].geometry.coordinates;
@ -34,744 +26,7 @@ map.on('load', function () {
// add it to the map // add it to the map
//map.addSource('trace', { type: 'geojson', data: data }); //map.addSource('trace', { type: 'geojson', data: data });
map.addSource('route', { 'type': 'geojson', 'data': { map.addSource('route', { 'type': 'geojson', 'data': empty })
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
9.196275472640991,
49.12280972701122
],
[
9.19629693031311,
49.122757066649065
],
[
9.196267426013947,
49.1227219597099
],
[
9.196237921714783,
49.12268685274588
],
[
9.196205735206604,
49.122642969005895
],
[
9.196168184280396,
49.12259908522708
],
[
9.196090400218964,
49.122556956762885
],
[
9.196015298366547,
49.12252536039125
],
[
9.195816814899445,
49.122421794365344
],
[
9.19578731060028,
49.12246041223081
],
[
9.195752441883085,
49.122495519355134
],
[
9.195720255374908,
49.1225306264546
],
[
9.195685386657715,
49.12257099958827
],
[
9.195658564567566,
49.122602595930815
],
[
9.195634424686432,
49.12263419225324
],
[
9.195604920387268,
49.12266052250654
],
[
9.19557273387909,
49.12268334204809
],
[
9.195548593997955,
49.12271318297122
],
[
9.195532500743866,
49.12273951318259
],
[
9.195497632026672,
49.12276057734161
],
[
9.19557273387909,
49.12281850373281
],
[
9.195524454116821,
49.12285712128936
],
[
9.195497632026672,
49.12287818539843
],
[
9.195476174354553,
49.122904515522194
],
[
9.195586144924162,
49.12300983587742
],
[
9.195840954780579,
49.1232152099268
],
[
9.19605016708374,
49.1233942532759
],
[
9.196152091026306,
49.1235346789797
],
[
9.196280837059021,
49.12368212554077
],
[
9.196393489837646,
49.12382606104651
],
[
9.196511507034302,
49.123924358225025
],
[
9.196581244468689,
49.12404371882266
],
[
9.196720719337463,
49.124173610911306
],
[
9.196838736534119,
49.12435967195905
],
[
9.196951389312744,
49.124501850213676
],
[
9.197013080120087,
49.1245896143649
],
[
9.19705867767334,
49.12465280445759
],
[
9.19714719057083,
49.12476865275172
],
[
9.197292029857635,
49.12495120102961
],
[
9.197361767292023,
49.12506529336202
],
[
9.197455644607544,
49.125175874910624
],
[
9.197522699832916,
49.12529347723932
],
[
9.197605848312378,
49.12543565281655
],
[
9.197745323181152,
49.125690163634275
],
[
9.197841882705688,
49.12584989044582
],
[
9.19790893793106,
49.12598328826778
],
[
9.197978675365448,
49.12612195141281
],
[
9.198064506053925,
49.12627290072483
],
[
9.19819325208664,
49.126525652032335
],
[
9.198254942893982,
49.12668011053043
],
[
9.198305904865265,
49.12679770929164
],
[
9.198405146598816,
49.12695743253551
],
[
9.198488295078278,
49.12716981099699
],
[
9.198619723320007,
49.12720315959838
],
[
9.198799431324005,
49.127229487425765
],
[
9.199027419090271,
49.12716630061657
],
[
9.19931173324585,
49.127129441607394
],
[
9.199504852294922,
49.12708556179883
],
[
9.19965773820877,
49.12704870272959
],
[
9.199883043766022,
49.12700482284956
],
[
9.200116395950317,
49.1269732293119
],
[
9.200357794761658,
49.12690653177737
],
[
9.200548231601715,
49.12688546937944
],
[
9.20065551996231,
49.126911797375485
],
[
9.200770854949951,
49.12695743253551
],
[
9.200899600982666,
49.12702061961085
],
[
9.20103371143341,
49.12706800986451
],
[
9.201240241527557,
49.12711891045688
],
[
9.20141190290451,
49.12714874871086
],
[
9.2015540599823,
49.127191750868846
],
[
9.201587587594986,
49.127187362895256
],
[
9.201736450195312,
49.1271601574503
],
[
9.201810210943222,
49.127157524664504
],
[
9.201871901750565,
49.12715313668789
],
[
9.201933592557907,
49.12710925690026
],
[
9.202055633068085,
49.12697498450896
],
[
9.20224204659462,
49.12691530777389
],
[
9.20237347483635,
49.126887224579605
],
[
9.202480763196945,
49.126842466955814
],
[
9.20254647731781,
49.12681613892294
],
[
9.202671200037003,
49.126769626030736
],
[
9.202869683504105,
49.126692396981234
],
[
9.202970266342163,
49.12665729282806
],
[
9.203054755926132,
49.12662218865002
],
[
9.203156679868698,
49.12659147247387
],
[
9.203227758407593,
49.126569532336404
],
[
9.203289449214935,
49.126551980219446
],
[
9.203341752290726,
49.12653179527724
],
[
9.203158020973206,
49.126483526903876
],
[
9.203088283538818,
49.12646334193381
],
[
9.203002452850342,
49.12644140173965
],
[
9.202857613563538,
49.12640278697433
],
[
9.202712774276733,
49.126357151303814
],
[
9.202632308006287,
49.126325557353475
],
[
9.202412366867065,
49.12626236939239
],
[
9.202256798744202,
49.126213223144774
],
[
9.202122688293455,
49.12616758729978
],
[
9.201961755752563,
49.12612546186714
],
[
9.2018061876297,
49.12607982594142
],
[
9.201698899269104,
49.126037700434225
],
[
9.201596975326538,
49.125999085354515
],
[
9.20129120349884,
49.125883239934964
],
[
9.201119542121887,
49.125827072361396
],
[
9.200921058654785,
49.12578143616102
],
[
9.200685024261473,
49.125676121692166
],
[
9.200513362884521,
49.12560591192202
],
[
9.200336337089539,
49.12554623353922
],
[
9.199842810630798,
49.125360176943595
],
[
9.199681878089905,
49.12527592467067
],
[
9.1995370388031,
49.12522677744532
],
[
9.199456572532654,
49.12518816173411
],
[
9.19932246208191,
49.12513199337321
],
[
9.199220538139343,
49.12508635653314
],
[
9.199113249778748,
49.125023166992925
],
[
9.199016690254211,
49.12496699844514
],
[
9.198925495147705,
49.1248932771296
],
[
9.198732376098633,
49.12480551351584
],
[
9.198582172393799,
49.124721260300475
],
[
9.198474884033203,
49.124647538619605
],
[
9.198367595672607,
49.12459839077146
],
[
9.198265671730042,
49.12455626400573
],
[
9.198126196861267,
49.124542221742516
],
[
9.198099374771118,
49.12450360549822
],
[
9.198126196861267,
49.12441584119478
],
[
9.198174476623533,
49.12433509789843
],
[
9.19828176498413,
49.12430701324279
],
[
9.19831931591034,
49.12427190740087
],
[
9.198254942893982,
49.12420871682283
],
[
9.198115468025208,
49.124149036758475
],
[
9.197981357574463,
49.124085846023824
],
[
9.197836518287659,
49.124026165811614
],
[
9.197707772254944,
49.12395595370529
],
[
9.197557568550108,
49.12386467781845
],
[
9.197487831115723,
49.12381201857656
],
[
9.197385907173157,
49.123717231800214
],
[
9.197214245796204,
49.12367510428589
],
[
9.197010397911072,
49.123566274708274
],
[
9.196908473968506,
49.123474998104186
],
[
9.196704626083374,
49.123401274570526
],
[
9.196602702140808,
49.123348614836544
],
[
9.196484684944153,
49.123260848488954
],
[
9.196339845657349,
49.12319414596088
],
[
9.196216464042664,
49.12313095400942
],
[
9.196135997772217,
49.12306776197748
],
[
9.19607162475586,
49.12299754851418
],
[
9.195937514305115,
49.12295893106699
],
[
9.195835590362549,
49.12289222813283
],
[
9.195733666419983,
49.12282903579667
],
[
9.195638447999954,
49.122754433629495
],
[
9.195600226521492,
49.12273293063105
],
[
9.195574074983597,
49.122708355764296
],
[
9.195574074983597,
49.12269431297779
],
[
9.195623695850372,
49.1226412136555
],
[
9.195666611194609,
49.12260961733753
],
[
9.195688739418983,
49.12258021519025
],
[
9.195733666419983,
49.12253106529318
],
[
9.19575646519661,
49.12250034658276
],
[
9.195783287286758,
49.12247269972715
],
[
9.195801392197609,
49.12244988008865
],
[
9.195815473794937,
49.122438470265486
],
[
9.195830225944519,
49.12242047784666
],
[
9.195859730243683,
49.122431887674
],
[
9.195901304483414,
49.122448563570735
],
[
9.195931479334831,
49.12246787249679
],
[
9.195965006947517,
49.12248367070343
],
[
9.195998534560204,
49.122498152388445
],
[
9.19603407382965,
49.12251307290797
],
[
9.196063578128815,
49.12253501484029
],
[
9.196093752980232,
49.122546424641236
],
[
9.196127280592918,
49.1225600286313
],
[
9.19615812599659,
49.12258109286655
],
[
9.196201711893082,
49.12261927177015
],
[
9.196238592267036,
49.12267237111598
],
[
9.196262061595917,
49.12270045669739
],
[
9.196281507611275,
49.122722837383684
],
[
9.196305647492409,
49.122746534569934
],
[
9.196302965283394,
49.1227693540719
],
[
9.196292236447334,
49.12279392890845
],
[
9.196286201477049,
49.122811482355665
],
[
9.19628955423832,
49.12282815812477
],
[
9.196309000253677,
49.1228479057388
]
]
}
}
]
}
});
map.addLayer({ map.addLayer({
'id': 'route', 'id': 'route',
@ -785,23 +40,18 @@ map.on('load', function () {
}); });
// setup the viewport // setup the viewport
map.jumpTo({ 'center': coordinates[0], 'zoom': 15 }); map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 15 });
map.setPitch(30); map.setPitch(30);
// on a regular basis, add more coordinates from the saved list and update the map // on a regular basis, add more coordinates from the saved list and update the map
var i = 0; //var i = 0;
var timer = window.setInterval(function () { //var timer = window.setInterval(, 10);
if (i < coordinates.length) {
data.features[0].geometry.coordinates.push(
coordinates[i]
);
map.getSource('trace').setData(data);
map.panTo(coordinates[i]);
i++;
} else {
window.clearInterval(timer);
}
}, 10);
//}
//);
}) })
function updateMap (coordinates) {
empty.features[0].geometry.coordinates.push(coordinates);
map.getSource('route').setData(empty);
map.panTo(coordinates);
}

View File

@ -37,7 +37,8 @@ window.addEventListener("load", function(evt) {
// let dat = JSON.parse(evt.data)["lsm6dsm gyroscope"] // let dat = JSON.parse(evt.data)["lsm6dsm gyroscope"]
//let dat = JSON.parse(evt.data)["lsm6ds3c gyroscope"] //let dat = JSON.parse(evt.data)["lsm6ds3c gyroscope"]
let dat = JSON.parse(evt.data) let dat = JSON.parse(evt.data)
//console.log(dat) console.log(evt.data)
console.log("JSON geparsed onmessage", dat)
//console.log(dat.orientation) //console.log(dat.orientation)
document.getElementById("gyroscope").style.transform = `rotateX(${-((dat.orientation[1]+90)%360)}deg) rotateY(${dat.orientation[0]}deg) rotateZ(${-dat.orientation[2]}deg)` document.getElementById("gyroscope").style.transform = `rotateX(${-((dat.orientation[1]+90)%360)}deg) rotateY(${dat.orientation[0]}deg) rotateZ(${-dat.orientation[2]}deg)`
@ -54,6 +55,7 @@ window.addEventListener("load", function(evt) {
// addData(orientation[0] / multiplier) // addData(orientation[0] / multiplier)
*/ */
addData(dat.orientation[0]) addData(dat.orientation[0])
setData(dat.GPS[0], dat.GPS[1])
// addData(dat[0]) // addData(dat[0])
//document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)` //document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)`
} }