I've written a java applet which sends longitudes and latitudes trough POST requests. I need to write a server page which will receive this data and dynamically shows a google map with the received points on it. (php/etc...)
I don't know how to start with this, because I really don't know what to do first.
https://developers.google.com/maps/documentation/imageapis/ has all the information you need.
So you simply need to get a server page to recieve your POST data, parse the longitude and latitude and then get the image result from the URL below (look inside the src attribute).
Should be fairly obvious what all the parameters are, zoom level on google maps and the size of the map in pixels. Alternatively if you just want this map displaying on a webbrowser you just output the img tag shown below
<img src="http://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">
EDIT:
The URL will dynamically generate the map each time you send a POST request. If you need the data to continuously change then maybe using POST requests isnt the best way to do it. POST is best used for data which you want to send off to a server then do something with (generate a single map etc).
As an example...
The user wants a map of where a particular street is that they have clicked on
>
Send POST request
>
Get the map using the Google Maps URL and send this back/output to a webpage.
As an alternative you might want to look at the various Maps APIs on the site. A better link for this would be https://developers.google.com/maps/
It's not quite clear what you are aiming to do so providing an example usage would help with a better answer.
Related
Hi i have a requirement to send a daily email to customers with latest information. This weather information is on an image on the message body. The readings on the image will be dynamic. Any pointers on how i can achieve this.
Same image is below
As seen above all the text will change dynamically based on the weather forecast and this has to go as a mail body.
I use java for programming, but i am ok to use any programming language based on suggestion on how this can be archived quickly
You can create inline images within HTML like this: https://en.wikipedia.org/wiki/Data_URI_scheme .
A little more effort is required to create MIME attachments, which you would reference from your HTML. This also results in inline images. How to create an email with embedded images that is compatible with the most mail clients
These are two alternatives for creating a dynamic image at the time of your email's creation. For more dynamic behaviour, you would either use proper image urls (which will be blocked by clients) or you could use Javascript (which should not work for any client for security reasons).
Is it possible to send extra data attached to a http response via Java or Php?
My Website is a homework-platform: One User enters homeworks into a database, and all users can then see the homeworks on the website. The current load is very inefficient, as the browser makes two requests for eveything to load: One for the index file and one for the homeworks. For the homeworks request the client also sends settings of the user to the server, based on which the returned homeworks are generated by a Php script.
Now, I wonder, if it is possible, to combine those two requests into one? Is it maybe possible to detect the http request with Java or Php on the server, read the cookies (where the settings are saved), then get the homeworks from the database and send the data attached to the http response to the client? Or, even better, firstly only return the index file and as soon as possible and the homework data afterwards as a second response, because the client needs some time to parse the Html & build the DOM-tree when it can't show the homeworks anyway.
While browsing the web I stumbled across terms like "Server-side rendering" and "SPDY", but I don't know if those are the right starting points.
Any help is highly appreciated, as I'm personally very interested in a solution and it would greatly improve the load time of my website.
A simple solution to your problem is to initialize your data in the index file.
You would create a javascript object, and embed it right into the html, rendered by your server. You could place this object in the global namespace (such as under window.initData), so that it can be accessed by the code in your script.
<scipt>
window.initData = {
someVariable: 23,
}; // you could use json_encode if you use php, or Jackson if you use java
</script>
However, it is not a huge problem if your data is fetched in a separate server request. Especially when it takes more time to retrieve the data from the database/web services, you can provide better user experience by first fetching the static content very quickly and displaying a spinner while the (slower) data is being loaded.
Requirement:
1. jsp page contains a field that having a search button.
2. When I click on search, it should send a Http request and Response page should be of Google Map
3. That Google Map should zoom into particular Location, whatever I have typed in Search field.
Please tell me how to write, because I new to this.
And please tell me some tutorials where I can learn Completely about Java Code which is related to Google Map.
I'd like to generate a static google map with several thousand points plotted.
Static maps: https://developers.google.com/maps/documentation/staticmaps/
The url format will hit the URL length restriction REAL quick. So that won't work. Any way to send in an XML document or something that has all the points?
Can that be done?
My main desire is to get an Image file that I can use in a PDF report. But I don't know how to generate an image from the dyanmic report on the server side. The beauty of the static maps api is i can generate the image from the web server.
Any solutions would be great!
I haven't seen a way for you to send an accompanying file with a static maps request though it may exist.
Is it possible for you to use dynamic maps? The javascript API is easy to pickup and makes it very simple to add markers/ points on the map. From my experience, this will allow you to add as many points as you like but may become a big laggy when getting into the 1000's.
I have a facebook application that generates a dynamic HTML output based on the user's profile information. Basically it consists of some pics from user's album and some text too like birthday and location. The entire output is in a HTML table. But it is dynamic. Now I want to post this (dynamic) output on the user's wall.
All the posts which I have come across so far, tell how to post a comment on user's wall, either a plain text or a fixed static image. But I want to post my output onto the wall. I have also seen many such applications where the output is posted on the user's wall as well as stored in the user's photo album too!!!
I thought of taking a runtime screenshot of the output, save it, and post it as a static image. But couldn't get much help on this.
I have designed my application in PHP. If required I can migrate it to JAVA (if no other option is there).
I don't think FB lets you post HTML content (manually and through API). Take a look at this question about how to upload photo using PHP.