Generating Images from maps - ruby-on-rails

How do you capture an image of a user generated map, like one created using Leaflet.js?
Here is my example:
I have a website that generates a map.
I want to save an image of that map
e.g. when the user shares their profile, the preview image is of their map.
I know facebook, Strava, and most other services show images of a user map in their news feeds instead of showing interactive maps.
The problem
The map is generated client side, so grabbing an image of the map serverside isn't possible
Possible Solution
Once a map is generated, use PhantomJS to capture a screenshot of the map, and crop out the rest of the website.
Question
Since this is such a common thing to do, is anyone aware of a better or more standard way of grabbing these screenshots? I've seen things like the mapbox static API, but that doesn't capture the custom pins and line features on my maps.
I'm using rails for the back end.

You can make your map to be able to read the url params and set its state from it. When the user changes something on the map, the map's state is saved as url parameters and then send it/store it on the server for PhantomJS to generate it.
E.g.
&coords=123.123,10.123,54.54,45.11&zoom_level=5&....

Related

Map Kit Location Images

I am using Map kit to display a bunch of locations and data related to it.
When I use Apple Maps I can see that locations have related images provided by Yelp.
Does map kit provide a way to access those images? Is there any way to obtain images from a respective location??
Thanks.
Those images are not part of the SDK and you can't use them within your app directly, but you can use Yelp API to get business information, including images. Check https://www.yelp.com/developers/documentation/v3/business for more information.

Capturing an image from leaflet map and saving it to S3

I have a rails website where people can create custom maps using Leaflet JS. When they share those maps, I want the preview image to be an image of that map.
Right now, when a users map updates, I cache the GeoJSON that defines their map look. When I cache that GeoJSON, I would also like to grab an image of their map and save it to S3 so I can use it when they share their map.
The problem is, all the plugins I've found are designed for the user to capture their own image. Since leaflet runs in the browser, is there an easy way to capture this image, or do I need to setup a server hosted version of Leaflet?

iOS MKMapView filter all Museums

I was trying to display a MKMapView showing all the museums in a city. I haven't understood if this is a built in feature of the maps or I need to get the data somewhere else. Online I was seeing an example of government databases providing the information and location and then this was being added to the map. Does the map have this feature built in?
Nope, this is not built-in feature of the map (in apple map). But you have to make a filter (Query) that can fetch response what you needs (response will be in JSON format) and manipulate it in your map as a Annotaion.

Options for displaying multiple routes on iPhone Map (iOS 4+)

I am trying to develop an iPhone app (with map routing function), and I need everyone's suggestions (guidance).
Below are a few specs:
The app will be running on iPhone with iOS 4+.
The app will have Map functionality.
In the app, given a "few locations" in a given order (to make things less complicated), the Map will draw routes between each locations on the Map.
Clicking on any location will display another page that shows some information about that location.
Can choose alternative route between two location (which I don't think is possible, but let me know if anyone know any framework that can do this).
I did some research, using Map on iPhone is easy using MapKit (and it's available after iOS 3.0). I followed this tutorial, and everything seems easy. However, if I want to draw routes on my map, I will need routes data in a CSV format. However, I do not have those data (yes! I suck).
And prior to iOS 5.1, MapKit use Google Maps, and I read somewhere that in Google Map's term and condition of use, it prohibit people from drawing on the Map (correct me if I am wrong).
In order to retrieve route data, I would imagine that I will have to get it through Google or Apple (I don't know if it's possible). I'm just wondering if Apple Map or Google Map have API to retrieve these?
If not, an alternative I came up with is to use a webview, and display my Map routes on Google Map. I'm just wondering if Google Map API will allow me to insert multiple locations and display all the routes?
I really need some suggestions... I am getting buried in all these problems.... thank you
Follow this sample - MKOverlay is the way to go. One more example is here.

Issues with Filemaker IWP working with hyperlinks on images

I have a filemaker database that I need to be able to link records and all associated data (including container field data) to various points placed on a large PDF image, and then make that data appear via instant web publishing when someone clicks on the marker for that area on the PDF. For example the PDF may be an image of a car, and then I would have various close up images of issues with the car and descriptions of those images as records in the database. I would then want to drop points on the base PDF image and when you clicked on those points be able to see the close up images and other data related to those images.
I'm being told this is too much for IWP because:
I need to place the markers outside filemaker via PDF annotation
Filemaker IWP can't handle the number of markers that may be necessary (it could be up to 1,000 on an E sized image.
Does anyone have a work around or explanation why this is a problem?
If I understand correctly, you would like to setup a PDF with links that will open a browser and show data related to what was clicked. Assuming that is the case, the reason this wont work is because IWP does not provide a unique URL for a unique page. For example, here on StackOverflow you can directly link to any question based on its URL:
http://stackoverflow.com/questions/3207775/ -- this question
http://stackoverflow.com/questions/4973921/ -- some other question
IWP uses Javascript and session variables to manipulate the output to the screen, so there is no way to link to a specific section of your IWP site, since the URL is always something like:
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product A
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product B
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product C
Because of the limited nature of IWP, you will not be able to workaround this issue. You'll need to build your own web-interface using the Custom Web Publishing Engine, either using the built-in PHP extensions or some other technology where you invoke the XML publishing API.
I agree with Nate
IWP is the wrong solution to this problem. You'd be better off simply hosting those images on a webserver.
Now here comes the plug, you can use SuperContainer to really simplify the management of the images from FileMaker.

Resources