How to convert svg path to list of points in flutter - flutter

I wrote code to find in SVG string specific path with proper id.
How can I transform the SVG path into a list of points?
Or svg_path_parser's Path can be magically decrypted into list of Offsets? Because Path.contains(offset) method refers to native implementation.

Related

Extrapolate Coordinates form Leaflet map

I'm planning a climbing trip and I wanted to retrieve the climbing locations from a leaflet map.
I thought I could use chromedriver and selenium to get the information I wanted but I'm having difficulty scanning through all markers since I can't understand where all the informations are stored.
Could someone guide me through how I could get the information? (also without using selenium)
The map in question is: https://www.climbingsardinia.com/topos/maps/
Thank you in advance.
in that page you will see a global variable called cttm_markers, it contains all markers informations and relative coordinates.
For example, cttm_markers[0][[0].additionalData.title evaluates "M.te Arci – Trebina Longa".Further, cttm_markers[0][[0]._latlng is an object {lat,lng} that contains coordinates.
Try to open console and paste this: JSON.stringify(cttm_markers[0].map(c=>({title:c.additionalData.title,latlng:c._latlng}))), it will print a json.
One way to do it is to get some information on one of the markers and use this to search the request reponses made by the page (you can do this in the debug tools, usually opened with F12). One of the markers for example reveals the location "Grighini". The base request redirects to (in my case) https://www.climbingsardinia.com/topos/maps/?doing_wp_cron=1651158093.0027918815612792968750
Searching the response, reveals that in line 1908 there's the string "Grighini". This line contains a serialized JSON array, containing the markers.

Inputfield information to image Unity

Hi everyone dose anybody know in what format data is generated in input field? What i really need to do is take information from input field and generate image with the same text.
Its a string, to get it
string textToParse = gameObjectThatHasInputField.GetComponent<InputField>().text;
If you put resources in resource folder you can generate with Resources.Load
https://docs.unity3d.com/ScriptReference/Resources.Load.html

Getting routes on openstreetmaps using OSRM

I've been trying to get a list of co-ordinates in a route from point A to B using OSRM with the following request:
GET http://router.project-osrm.org/viaroute?hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760
However, on opening the url, i find the 'via_points' tag containing only two co-ordinates. Surely, that can't be the entire route? Anything I'm missing here? Is there any other way of generating the list of route co-ordinates with OSRM? Thanks
The route is contained in the route_geometry object. It is an encoded polyline. If you don't want to uncompress it yourself you can disable compression via compression=false:
http://router.project-osrm.org/viaroute?compression=false&hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760
Not sure what the via_points contains. OSRM's documentation seems to be outdated. Maybe they are just your start and end points snapped to the nearest road or something similar.

How can I parse *.vector.pbf about Mapbox vector tile map?

*.pbf("Protocolbuffer Binary Format") is primarily intended as an alternative to the XML format.
There are two formats of *.osm.pbf and *.vector.pbf. What tools can I use to open these files? (I know JOSM can open *.osm.pbf files, but it can't open *.vector.pbf files.)
If I want to write own *.vector.pbf files in Mapbox, how do I work for that?
Thanks!
Regarding question #2, extracting PBF data
Using GDAL's ogr2ogr is the easiest method (I found).
Given a file named 1583.vector.pbf decode it to a, for example, shapefile (folder) named output:
# cmd show prog. output format output name input name
ogr2ogr -progress -f "ESRI Shapefile" output 1583.vector.pbf
Regarding question #3, creating PBF data
Use the same command as above but swap the input/outputs and output format:
# example source: https://gdal.org/drivers/vector/mvt.html
ogr2ogr -f MVT mytileset source.gpkg -dsco MAXZOOM=10
The Vector tiles used by Mapbox are serialized as Protocol Buffers.
Protocol Buffers allow you to efficiently compress the vector data inside the tile.
The Mapbox Tile Specification is available on github.
Esri has also adopted the same specification for their products.
You can find a list of parsers, renderers & CLI utilities here: https://github.com/mapbox/awesome-vector-tiles
In the common scenario, you can use mapbox-gl-js to render the vector tiles on the client. To generate vector tiles, you can use Mapbox Studio. This will require uploading your data online in the Studio. You can also use Mapbox Studio Classic (the older version) to generate the tiles locally.
Internally, Mapbox Studio uses the tilelive API, so you can programatically generate the tiles. In the list above there are other good alternatives as well.

renameTo() not working on uploaded image : cos-MutipartRequest

I am trying to get an image uploaded by user, store it in a folder(for which I am providing absolute path), store the path in database(Relative path) abd later use the path from database todisplay the image.
I am using cos-MultipartRequest jar file for this.
I don't want to have spaces in the file name(Since the image with spaces in name is not displayed by <img>)
The code I have written is:
String pathUPLOAD="D:/AdvJava/proimp/WebContent/images/default";
String pathDB="images/default";
MultipartRequest m=new MultipartRequest(request,pathUPLOAD);
String file=m.getFilesystemName("file").replaceAll("\\s+",""); //to remove spaces
m.getFile("file").renameTo(new File(pathDB+file)); // to rename the uploaded file without whitespaces
//(tried this earlier) m.getFile("file").renameTo(new File(file));
the path I am inserting in DB is: pathDB+"/"+file
The upload works fine and later the images are also displayed for those which don't have spaces in name.
But for those having spaces, the path stored in DB is the way I want, but the image uploaded in the specified directory does not has any changes in its name and therefore the place where images are to be displayed shows a missing image.
Any suggestions?