Is there a possibility to send an interactive map to a group with Telethon? - geolocation

I am using telethon 1.23.0 on Ubuntu 18.04 and I would like to send an interactive Google Map to a group (as a bot). I have got longitude and latitude available.
I was searching the documentation for terms like "map" or "location" and also tried stuff like SendLocation or send_location methods, but without any success.
The only hints I found where methods to send the client's geolocation to the bot (via button press), but this is not what I am looking for.
Is there any wrapping telethon method for this?
Thanks
Andy

Thanks to the hint of Marcel, I finally found a working solution:
from telethon.tl import types, functions
geoPoint = types.InputGeoPoint(gps_x, gps_y)
async with bot.action(channel, 'location') as action:
await bot.send_file(channel, types.InputMediaGeoPoint(geoPoint))
I don't know, if this is the finest solution, but it works for me :-)

Related

How to access market cluster for the Google Maps For Rails?

I'm trying to add custom functionality to my map where a user can filter out certain markers. Using simple jquery, I am to just find the marker using css selectors and do something like:
$('.marker').hide()
This works fine...however, when I zoom out, the marker is still considered there in the marker cluster count. I want to adjust the count to take into account that I hid the marker.
Any help would be appreciated. I'm not even sure how to access the marker cluster object as documented here:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/docs/reference.html
Do I do something like:
handler.getCluster()
Thank you for your help!
I dont really understand your jQuery stuff here for google map markers...
You should use the existing methods on the objects returned by the addMarker(s) method:
.show()
.hide()
Anyway, to answer your primary question:
handler.clusterer
as usual the googleObject is available:
handler.clusterer.getServiceObject()

Is it possible to use gmaps4rails without a model/database?

As far as I can tell from the documentation and ReadMe for the gmaps4rails gem, you need to a model to set as acts_as_gmappable in order to use this wrapper.
In my case I am using simple a form_tag and text_field_tag elements in order to gather the addresses I want to display, and then I want to pass it through the wrapper in order to render the Google Map. I am not storing this gathered data in a database or model.
My questions are:
Can this be done with gmaps4rails? If yes can you direct me to an example of a model-less use case or give me any tips on how to do this?
If it can't be done with gmaps4rails, is there another gem/wrapper that would work? (I eventually want to show routes and directions)
I understand that I can use the original Google Maps JS V3 API, however I'm trying to keep it in Rails if possible because I'm a total newbie (business guy that decided to learn Rails and make a proto himself in order to attract a tech co-founder) and it seems like it'd be easier to use a wrapper than try to integrate with the API.
Thank you in advance for your help!
You could do this with gmaps4rails.
No need for acts_as_gmappable which is meant to geocode addresses.
Simply provide the view with something like:
#markers_json = [{lat: , lng:, description: }, {lat: , lng:, description: }].to_json
description will be displayed in infowindow.

Search engine similar to gmail

I'm looking for a search engine, which will let my users to search my website using syntax similar to this gmail's one.
My website is a map-based directory of restaurants and shops so it would be lovely to make it possible to search it using strings like those:
Restaurant's name city:Boston diet:vegetarian
Restaurant's name country:Belgium tags:fast-food
Restaurant's name country:Poland diet:vegan tags:pizza
etc...
Have you any idea what can i use to achieve such a functionality? I've browsed all of the solutions from ruby-toolbox but most of them requires to have some kind of special search server set up. I can do that on my VPS but at first i would love to hear your opinion which one is the most powerfull, dev-friendly and which one covers the functionality described above. Thank you in advance! :)
How about https://github.com/makandra/dusen gem?
It supports gmail-like token search!
You could try to use regexp to extract search params from request:
search_pairs = params[:search].scan(/([a-zA-Z]+):([a-zA-Z]+)/)
>> [ ['country', 'Poland'], ['diet', 'vegan'] ]

is a search for nearest places possible in gmaps4rails?

just wondering if i can search for places near to a specific lat/lang with gmaps4rails. I checked the code but did not find anything. if sbd. does somebody already implemented sth like this ?
like (taken from geocoder gem):
Place.near([40.71, 100.23], 20)
thx
I made gmaps4rails and do not want it to be a copy of what exists and works perfectly.
So keep on using Geocoder or Geokit for search, gmaps4railsis here to display stuff :)
Basically, answer is no!

how to get latitude and longitude for particular landmark?

how to get latitude and longitude for particular landmark/business, i would like to get lat/long for specific address how to i do that? shall i use gps device to get the lat/long?
Very recently, two or three weeks ago, Google released a new API that lets you do just what you want.
This is how it works:
http://maps.google.com/maps/api/geocode/format?address=some_address&sensor=true_or_false
And here is an example:
http://maps.google.com/maps/api/geocode/xml?address=Lenox+Hill&sensor=false
The format can be JSON or XML.
You will need to use a Geolocation API (such as Google or Bing or Yahoo), and there might be others as well. But those are the "free" (with caveats) ones that come to mind.
Just remember they have rather strict Terms-of-use of how you can use their API, so be sure you are on the right side of the law.
http://msdn.microsoft.com/en-us/library/cc981067.aspx
http://code.google.com/apis/maps/documentation/
Can you elaborate a bit more on that? What type of application is that? What is the format of the landmark/business? Basically there are geo web services out there that do this kind of stuff...
Have a look at this for example:
http://www.geonames.org/maps/us-reverse-geocoder.html
http://www.geonames.org/export/ws-overview.html
Yahoo http://developer.yahoo.com/geo/geoplanet/guide/concepts.html
You can query for a free-form name such as address, etc, and it will return what is called a WOEID, then query the WOEID for its lat long.

Resources