I have a bit of an issue with loading a dynamically generated KML into google maps api.
The KML file is generated by oracle and is of the format
http://server/oracleservioce.method?parm1=100&parm2=100
If I try and load that uRL (endcoded or decoded) I always get a KMLLayerStatus as INVALID_DOCUMENT.
If I save the resultant file to a local file with a KML extension it works foine, otherwise I get errors.
I even tried renaming the file to .xml and .dat (arbitrary names) and they all fail. It seems that google api need the file to have a .KML extension. This will not work in the dynamic environment. Can anybody suggest a way forward?
Thanks,
PS: I Need to use google maps API, I can not use openlayers or any other solution. The file needs to be loaded into a google.maps.kmllayer object.
I did this, no matter on the extension, but you have to set the mimetype on the http response: https://developers.google.com/kml/documentation/kml_tut#kml_server
Related
I have image upload in my system. I am struggling to understand what is the logic of serving images.
If I upload directly to wwwroot, the files will be accessible to everyone, which is not what I want.
I understand I could save the file contents in the database as base64 but those can be big files, and I would like them on the server in files.
I could convert them on the fly when requested. Most probably getting the path to file, then loading it in a memory stream and spitting out the base64. But seems overkill, and not an elegant solution. I use Automapper for most data and I have to write some crazy custom mappers, which I will If there is no other way.
I could create virtual path, which from what I understand maps physical path on server to a url which doesn't seem any different than option 1
I fancy there is a way to spit out a link/url that this user has access to (or at least logged users) that can be passed to the app so it can load it. Is this impossible or unreasonable? Or am I missing something?
What is the correct way of doing in general?
Also, what is a quick way to do it without spending days for setup?
To protect the specific static files, you can try the solutions explained in this official doc.
Solution A: Store static files you want to authorize outside of wwwroot, and call UseStaticFiles to specify a path and other StaticFileOptions after calling UseAuthorization, then set the fallback authorization policy.
Solution B: Store static files you want to authorize outside of wwwroot, and serve it via a controller action method to which authorization is applied and return a FileResult object.
Do any of the major online photo storage/sharing platforms offer a reasonable way to export a set of image URLs and titles as something like a CSV or fetch them as JSON from a REST API?
I am trying to get any sort of clean list of title, url value pairs for all the images in a particular folder or gallery.
Google Drive/Photos would be my prefered platform, but I would switch to DropBox or other service if I could easily get such an export list.
If you're going to use Google Drive, you'll probably end up using these properties from File Resource:
webViewLink - a link for opening the file in a relevant Google editor
or
webContentLink - a link for downloading the content of the file in a
browser.
You can fetch this properties using files.list or files.get.
For Dropbox, you would use the /2/files/list_folder[/continue] endpoints to list the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
Then, you can use /2/sharing/create_shared_link_with_settings to create shared links for the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
Or, to retrieve existing shared links, use /2/sharing/list_shared_links:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
Those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.
I've tried repeatedly to use the Google Developers Console tools to Create a Transfer that works, but haven't had any luck. My source is in S3.
I tried with the "S3://" URL, but when trying to accept the transfer settings, I consistently get "source bucket doesn't exist". I test my URL by placing it in a browser, and I do get it to resolve, so I don't know what's up.
Even more puzzling is when I try using a text file of URLs. These URLs are all http:// strings, and each of them properly loads in a browser. I figured this would be even more straightforward as there are no permissions to be dealt with, really, since each file in the S3 bucket already has read permissions.
Instead, all I get in the Transfer history is "Failed", with no other information at all.
At first, I was greedy and included all my files. When I got nowhere with that, I cut it down to a single file. Still no go.
Here is the text file.
Any clues, por favor?
It looks like your text file doesn't follow the specified format. You should add the header and size/MD5 of each file as described at https://cloud.google.com/storage/transfer/#urls
Using POI4Xpages which is great LINK
However, I was wondering, at present, when it creates my word document, it simply downloads, like a normal download from the internet, storing it the downloads folder in windows (using Chrome anyways)
Is there a way, using POI4XPages, to instead, dump the file to a specified network location, for example a shared drive?
After that, I would simply build a link to the file using the network location, and a filename variable for example to pick the correct file.
If thats not possible, is it possible to get a handle on the file before or after it is downloaded, and then save it to a field in the xpage?
In short, I want to avoid the user downloading the file, then having to attach it manually to the xpage.
Thanks
POI allows you to get a handle to the file using the variable "workbook". You are also able to provide the specific downloadFileName you wish to use. Using the postGenerationProcess property you should be able to make a call to a Java method that makes the connection to your network drive where you can use the "workbook" variable and downloadFileName value to save your document. If this doesn't work definitely post a question on their project site because the creator does reply.
The PDF files are in my Google Drive. I just got that I can get the number of pages of a PDF sending it as a job to Cloud Print, because Cloud Print will return a JSON object with "numberOfPages" attribute.
Is there any faster and easier way? Thanks in advance.
Well, I actually did like I said.
I take my file, then send it to CloudPrint via its JSON Api. I need to send it to a dummy printer, a printer I registered in CloudPrint but actually is never connected to Internet. Then, I get the number of pages of the PDF file in the value of response's "numberOfPages" attribute. Save this number in some var. Finally, I send a delete petition to JSON Api for my file in the dummy printer, indeed isn't necessary at all.
Thanks!