Giter Site home page Giter Site logo

geophpwithfeatures's Issues

Conversion of a single geometry from GPX to JSON and back again loses data.

Converting the following GPX file to geojson:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <metadata>
    <link href="http://www.garmin.com">
      <text>Garmin International</text>
    </link>
    <time>2013-05-27T17:23:57Z</time>
  </metadata>
  <wpt lat="35.466436" lon="-83.920083">
    <ele>573.07</ele>
    <name>Deals Gap</name>
    <sym>Waypoint</sym>
  </wpt>
</gpx>

becomes:

{
   "properties" : {
      "link" : [
         {
            "text" : "Garmin International",
            "href" : "http://www.garmin.com"
         }
      ],
      "time" : "2013-05-27T17:23:57Z"
   },
   "type" : "FeatureCollection",
   "features" : [
      {
         "properties" : {
            "name" : "Deals Gap",
            "sym" : "Waypoint",
            "elevation" : "573.07"
         },
         "geometry" : {
            "coordinates" : [
               -83.920083,
               35.466436,
               573.07,
               {
                  "elevation" : "573.07"
               }
            ],
            "type" : "Point"
         },
         "type" : "Feature"
      }
   ]
}  

Converting it back to GPX yields:

<?xml version="1.0"?>
  <metadata>
    <time>2013-05-27T17:23:57Z</time>
  </metadata>
  <wpt lat="35.466436" lon="-83.920083">
    <time>2013-05-27T17:23:57Z</time>
  </wpt>
</gpx>  

Store a complete Feature entry as a route waypoint

Currently, an abbreviated properties object is included as the fourth position in the route coordinates array.

{
   "features" : [
      {
         "geometry" : {
            "type" : "LineString",
            "coordinates" : [
               [
                  -77.463442,
                  39.526728,
                  null,
                  {
                     "extensions" : {
                        "gpxx_routepointextension" : [
                           [
                              "-77.463442",
                              "39.526642"
                           ],
                           [
                              "-77.463056",
                              "39.526620"
                           ],

This is proving to be inconvenient.

Modify this to store a complete Point Feature in this position to mirror a waypoint entry. The only difference between a standalone waypoint marker entry and this copy will be the presence of the gpxx_routepointextension coordinate array.

e.g.:

               "geometry" : {
                  "coordinates" : [
                     [
                        -83.92005443573,
                        35.466550939862,
                        null,
                        {
                           "name" : "Unnamed",
                           "properties" : {
                              "cmt" : "This is a comment about the Deal's Gap Start Point",
                              "name" : "Deals Gap Start" 
                              "link" : [
                                 {
                                    "href" : "http://dealsgap.com "
                                 }
                              ],
                              "desc" : "This is a test of the deals gap start waypoint",
                              "extensions" : {
                                 "gpxx_routepointextension" : [
                                    [
                                       -83.920013,
                                       35.466556
                                    ],
                                    [
                                       -83.920028,
                                       35.467197
                                    ],

Latest commit breaks GPX Export

The order of elements in GPX export is once again incorrect.

Fix it and add a test to make sure the GPX files generated validate.

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.