Giter VIP home page Giter VIP logo

Comments (4)

Bonkles avatar Bonkles commented on August 29, 2024 1

@voscarmv - prospective issue for you to work on!

from rapid.

Bonkles avatar Bonkles commented on August 29, 2024 1

Oscar- here are some code pointers for you to look at.

Background

The data URL Bryan provided has the following shape in XML:

<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="Garmin Connect" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<script/>
<metadata>
<link href="connect.garmin.com">
<text>Garmin Connect</text>
</link>
<time>2014-07-27T13:25:06.000Z</time>
</metadata>
<trk>
<name>Escarpment Trail Run</name>
  <trkseg>
    <trkpt lon="-74.1896016150713" lat="42.312879441305995">
    <ele>547.5999755859375</ele>
    <time>2014-07-27T13:25:06.000Z</time>
    </trkpt>
    <trkpt lon="-74.18951326981187" lat="42.31288396753371">
    <ele>559.5999755859375</ele>
    <time>2014-07-27T13:25:10.000Z</time>
    </trkpt>
    <trkpt lon="-74.18948912993073" lat="42.31287952512503">
    <ele>555.4000244140625</ele>
    <time>2014-07-27T13:25:11.000Z</time>
    </trkpt>
    ... GPX data continues
  </trkseg>
</trk>

This data is processed by Rapid's custom-data processor and converted to GeoJSON. You won't see coordinateProperties mentioned anywhere in Rapid's code because this processing is done by a third-party module: @tmcw's togeojson module, imported like this:

import { gpx, kml } from '@tmcw/togeojson';

This module takes the gpx track above, ingests the <ele> and <time> tags for each point, and then puts them in a separate CoordinateProperties blob on the geoJSON as per the spec Bryan linked, along with the track name, type, and time the track was saved.

This results in the undesirable display of the 'tags' data up above, where the coordinateProperties is just getting toString() called on it, hence the [object Object] display.
This problem is interesting because coordinateProperties is a special-case blob of data.

If you run Rapid in the debugger, and set a breakpoint at https://github.com/facebook/Rapid/blob/main/modules/ui/sections/raw_tag_editor.js#L163 you will see the rowData being fed to the ui renderer in the sidebar- the coordinate Properties is 700+ entries, one for each 'point' in the GPX track.

The Task

So, the answer here is not to render all 700 points' worth of data in the tag editor- the data would run off the screen. The answer is actually to render the individual points on the map, along with the way that's already being rendered. Then, we must give each of those points the coordinateProperty entry that corresponds to it.

Therefore, we need to do the following:

You can start by extracting the points out of the track and just rendering them as points as well-don't worry about the coordProperties for this step.

  • once you get the points to render, we'll need to attach the coordinate properties data to them. You'll need to augment the points you're asking the renderer to display, and also bind the custom data from the coordinateProperties to each point. This should, in theory, display the individual and data for each point from this example track data provided.

-[ ] Finally, once you have the point data rendering with the coordinateProperties, see if you can figure out how to make the points rendering conditional on hover/select like the OSM ways already are. Vid:

hover_custom_data_way_vs_osm.mov

See how the points are only revealed when hovered over in the OSM way? Instead of just always rendering every custom data node, we should do the same thing. See if you can figure out how the pixiLayerOSMData.js file conditionally renders the node data on hover, then implement some similar logic in your renderer for the custom data.

from rapid.

Bonkles avatar Bonkles commented on August 29, 2024

@bhousel can you supply a dataset URL with some of this data? I would like to get oscar started with this.

from rapid.

bhousel avatar bhousel commented on August 29, 2024

This one includes some extra trackpoint data for the elevation values:
https://rapideditor.org/rapid#background=Bing&gpx=https://sonny.7thposition.com/osm/escarpment_trail.gpx

from rapid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.