How to export a GPX file from OSMdroid? - export

I would like to know how can we export a path that we generated on OSMdroid in GPX, KML or Shapefile?
Thank you !

You can use OSMBonusPack, an add-on to osmdroid with KML capabilities.

Related

Why can I get an image from public folder but not a json file

I learn Reactjs and came across this
I have an images folder in the public React project created with create-react-app.
I place a json file and a jpg in it and I can use the jpg but not the json.
let photo = "./images/some.jpg";
let file = "./images/somejson.json";
The image works out of the box like
<img alt="image" src={photo} />
But the json cant be read I get Cannot read property 'label' of undefined
<h1 className="title">{file.basics.label}</h1>
And this is the json
{
"basics": {
"name": "Foo Bar",
"label": "Some label"
}
}
Please advice what is wrong?
You should import JSON file before use its properties, your file variable is just a path to a JSON file. If you are using create-react-app it has json-loader, if not you have to install it and configure your Webpack, I can assume you already use it, and then you can import JSON file and use it.
import json from "./images/somejson.json"
...
<img src={json.someSrc} />
you have to replace .json from public to src folder. And also you should export your variable file in the somejson.json file. and also you should import this variable too.
In your JS file, import your json file with correct path.
import file from './somejson.json';
If you need to retain this file in public/ and also use it in React app, add this library.
https://github.com/oklas/react-app-rewire-alias
import file from '../public/images/somejson.json';

React export table as pdf

I am trying to export data from table to pdf in order to let user download it.
However, I try this solution, it didn't worked
My npm install faced an error during installation
Is there any solution to this?
Try this
var tableExport = require('table-export');
tableExport('myTable', 'myName', 'pdf');
Following attributes from tableExport are tablename, filename, the file type

How to get all files from a media library in kentico?

I want to save all files paths inside of a media library folder in kentico.
I found this code for one file but I don't know which Class to use to get all content any advice, please.
MediaFileInfo updateFile = MediaFileInfoProvider.GetMediaFileInfo(library.LibraryID, "NewFolder/Image.png");
This should get all the files in a specific media library.
var files = MediaFileInfoProvider.GetMediaFiles().Where("FileLibraryID",QueryOperator.Equals, library.LibraryID);

React Leaflet map to PDF

I can generate PNG file by using
https://www.npmjs.com/package/react-leaflet-easyprint
I need to generate PDF from PNG file.
How can I prevent download of the file and use this content to generate PDF file before download PNG file?
Is there maybe better library for this purpose?
There is also an option to use nodeJs and phantomJs, but in this case there will be code duplication.
The leaflet-easyprint library leverages the dom-to-image library.
https://github.com/rowanwins/leaflet-easyPrint/blob/gh-pages/src/index.js#L127
I suggest copying a bit of the code from there and using dom-to-image + filesaver to convert the dom to a base64 blob export as a pdf.
https://github.com/tsayen/dom-to-image#usage
For reference:
I used a combination of dom-to-image library and https://react-pdf.org/
Got a reference of the map, got its container. And passed it into dom-to-image and used the result in the reactPdf. I used an A4 landscape size and orientation.
const _a4PageSize= { height: 715, width: 1045 }
domtoimage
.toPng(mapRef.current.leafletElement.getContainer(), _a4PageSize)
.then(dataUrl => {
//pass dataUrl to reactpdf document here
})
.catch(err => console.log("to img err", err));
// reactpdf document
<Document >
<Page size="A4" orientation="landscape">
<Image src={{uri: dataUrl}}/>
</Page>
</Document>

Could not load image of .JPG format

I was trying to load image from local resource whose format is .JPG. But every time it gives me following error.
Do react native support .JPG format ? Can anyone help me on this ? Thanks...
If you are sure that your image_path is right then you could rename the Image in your folder from the capital letters (.JPG) to lower case letters (.jpg).
Tested this case for Windows and could reproduce and fix it with the above solution.
react-native version: 0.23.1
For clarification:
var yourPicture = require('./yourPathToYourPicture/picture.jpg); //Working
var yourPicture = require('./yourPathToYourPicture/picture.JPG); //Not-Working
Solution to solve the capital letter problem: Save your picture in your project folder with lower case letters yourPicture.JPG -> yourPicture.jpg
Use your image
render(){
return(
<Image source={yourPicture}/>
);
}
You must use Image from react-native
import {
Image,
} from 'react-native';
...
Image have a prop called source
<Image source={require('./img/fotofondo_app.jpg')}/>
If the error still, try to execute react-native run-android beacuse the image files aren't read in hot.

Resources