Closed pitcock closed 4 years ago
Hi pitcock, if you want to solve the problem programmatically I suggest you to take a look at the following library:
https://github.com/RyanMarcus/dirty-json
if instead it is a question of how to fix just a "single" file, try using this tool:
http://ryanmarcus.github.io/dirty-json/
Have a nice day, Raruto
Hi Raruto,
thank you very much for the links. I will test the programmatically solution.
I also found this thread:
https://github.com/MrMufflon/Leaflet.Elevation/issues/63#issue-192998443
Would this be a good addition for your solution?
Currently points without a "z" value are already discarded
But your problem is related to a malformed JSON structure:
Since JSON.parse
is a native function, it could also be more difficult to solve (with just a few lines), but if you are good with regex replace you could also achieve it ...
Hi Raruto,
thank you for the hint.
when I use this method
$array = str_replace( ',]', ',0]', $array );
the total length is correct and I get gaps in the graph
when I use this method
$array = str_replace( ',]', ',]', $array );
the total length is incorrect and I get no gaps in the graph
Is there a way to get the correct total length and no gaps?
when I use this method
$array = str_replace( ',]', ',]', $array );
the total length is incorrect and I get no gaps in the graph
maybe you meant this:
$array = str_replace( ',]', ']', $array );
Is there a way to get the correct total length and no gaps?
First of all make sure you are using the latest available version of this library, if you will still have problems please submit a demo file.
Hi Raruto,
maybe you meant this:
$array = str_replace( ',]', ']', $array );
this was a type you are right, I tried
$array = str_replace( ',]', ']', $array );
First of all make sure you are using the latest available version of this library, if you will still have problems please submit a demo file.
I'm using your latest library. Here is a demo file (data.txt) containing empty altitudes.
[11.74641, 47.55261, ]
For the screenshots I tried:
[11.74641, 47.55261]
and
[11.74641, 47.55261, 0]
this was a type you are right, I tried
$array = str_replace( ',]', ']', $array );
Your file lacks of many z values, but try this again with version 1.3.1
NB currently, all points (starting from the first one) where the z value is missing are discarded (this is just for the algorithm simplicity, anyway, if you have any suggestions pull requests are welcome)
Hi,
using your example leaflet-elevation_string-data.html with my geojson data gives me this error:
I'm using a geojson string which is an automatically generated from a Garmin FIT file. Howerver there is sometimes an empty altitude value like:
The other values look like:
Is there a way to suppress the SyntaxError and ignore the missing altitude?