Display a route from Google maps place ID with javascript api - javascript

I have a link to a Map/Place. The urls look like https://www.google.com/maps/d/viewer?mid=18y_Gahydj0rBHluofKO0wxHLBLI&ll=51.16842583802143%2C-0.8371334530562535&z=17 so I'm guessing the place ID is Gahydj0rBHluofKO0wxHLBLI
View the link here
That link has a route on it. I'm trying to display that route on a map using the javascript maps api but I'm struggling to get it working.
Not sure how the route is stored and how I should be accessing it?

Related

NextJS URLs and dynamic routing to index route

I'm trying to route my blog posts from /blog/[slug] to /[slug]. Is there a way to do that? I've looked at the NextJS docs, but the examples show only nested url paths.
For example, on my /blog page, a list of Posts is shown. I want to be able to click on a post and go to localhost:3000/my-blog-post instead of localhost:3000/blog/my-blog-post. How would I go about doing that? I'm using the Link component if that makes a difference.
Edit with updated info:
I've tried the as prop on Link and Next requires it to be in the nested path format otherwise it throws an error.

Google Drive API. Get Shared link (sharedUrl)

Can I somehow get sharedLink without displaying gapi.drive.share.ShareClient() dialog? I just want to make my own Picker dialog to share files.
I've investigated that this dialog connects to external url /sharing/commonshare/
to set shared state and get sharedLinks.
As you see there is "token" prop in POST request. (First picture)
To get it API does another request
I have all data to GET it. But I get 405 Error.
Actually I don't want to try that hard.
Does documentation about it exist? Because I didn't find anything like that.
I just want to share selected file.
Thanks!
You can only get the status "shared": true if you've already shared the drive file before. So if you want get that status just share the file to someone and perform a files.get request. But, I think what you're really after is to get the shareable link. This shareable link used to be alternateLink in Drive V2 but is now webViewLink in V3.
So to get webViewLink (shareable link), perform a files.get and you'll have something that looks like:
"webViewLink": "https://drive.google.com/file/d/abcdefghijklmnopFbVRzT0pkTkk/view?usp=drivesdk"
Note however that this shareable link is viewable only to those who have permission. Use permissions.create to add them. Set 'type' to 'anyone' to share file to everyone.
Also you need to set 'withLink' to true as described in API v2.
Or 'allowFileDiscovery': false in API v3.
So your permissions won't change but file would be shareable by a link.

Facebook API get Fanpage ID inside Page Tab

I created a Facebook App (Page Tab). This App can be added to Fanpages.
In this App, I make a call with Javascript to get the right JSON Data for my App.
The data is specific to the FB-Site where my App was been added.
I.e. when Coca-Cola adds my App to their Fan Page, I need to know that is coca cola - to get the right data.
Now, my Idea is when creating the Page Tab, save the ID from the Page. And when making a call to get the data in the page tab sending the Fanpage ID as a parameter.
I hope it is reasonably clear what I mean.
My Question is, how got access to ID of the Page?
Best with Javascript. Or is this not possible?
I would appreciate any tip!
This would be very easy with the PHP SDK. A signed_request parameter will get passed on to your iframe, and the PHP SDK offers a function called getSignedRequest() to parse it:
https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest/
For example:
$sr = $fb->getSignedRequest();
echo $sr['page']['id'];
With JavaScript it would be a lot more complicated. You could try to get the signed_request parameter like this: How to retrieve GET parameters from javascript? - But you would have to deal with the parameter on your own. HereĀ“s how to parse the parameter on your own with PHP: https://developers.facebook.com/docs/facebook-login/using-login-with-games
No Facebook SDK needed in that case, btw. And it should also work with PHP <5.4.

get a list of facebook pages that has word "xyxyx"

I'm pretty new facebook api. So, i have decided to build an app which displays a list of facebook pages starting has the word "xxyyxxy".
I have looked into facebook documentation and found that i could use Facebook graph API which is public API.
A get request like https://graph.facebook.com/stackoverflow would fetch a JSON array with that particular page details but i need list of all pages with this word in its name.Any suggestions are appreciated.
For example,
I send a get request to facebook api to fetch all pages with keyword "robin"
and facebook should return me all pages which has the word "robin" in it and the respective facebook page link, display picture of the page, number of likes just similarly how https://graph.facebook.com/stackoverflow returns details of particular page.
here the FQL Query:
select page_id, name, pic from page where contains('xyxyxyx')
if you need other data check this page:
https://developers.facebook.com/docs/reference/fql/page/
I believe you are looking for facebook search. You can do it this way:
http://graph.facebook.com/search?q=xyxyx&type=page&limit=10
Make a callback to this URL with your API key. For reference: https://developers.facebook.com/docs/javascript/reference

Show a route on a map

How can i show the following result:
http://maps.googleapis.com/maps/api/directions/json?origin=hadera&destination=haifa&sensor=false
on a map? i want to see the entire route!
please: no use of google's javascript API. just the Web Service
I assume you want to show the route on a Google Map, which is mandatory ;)
You can do this without using the JavaScript API, just use the Static Maps API with the path parameter containing the encoded polyline you'll find in the overview_polyline field of the route of your choice.
Example using the first route (that is, response.routes[0].overview_polyline.points) from your sample request:
"overview_polyline" : {
"points" : "en_eEsoctEa#IuAvHzD~#hGrA~D~#i#vCgAlGa#|BqFp[kBOyBAgADk#Hw#JqBb#cIjAcC`#{Cr#iKrC_Bh#kDhAeCx#}Bn#}IpCcFtAq#Hs#D_A?yAEoAQi#OcA]kAg#}OoKmMqIkCgBoBgA}D{Bm#]ERiAxGoA`IYtAs#hCwAzDsB`EoDhGkDrGkBbDmBbD_CrC{#`AcAn#c#Pm#JUDa#?u#Cq#Mo#Um#c#cC}BmGgGgc#yd#qSmTsNiOwDoDqCmBkCuAcA]oC_AyCw#}Bc#_BO{BOwE#aDNiBRyARyBd#_K|Cag#bPsVdImDhAkBf#qCf#_AJqADeABcBCuAIqC_#kIqAuLaBgNmBuImAqFs#kL_BsEq#qEk#eGo#aFUqEIoOSiLI_DAgQQuDIiEa#u\\iDwBOiGw#yB_#uCy#yPsEaIwBiL_D{Cu#sAUgDk#uCYgAIeBCoEAax#nAgC#qCGcBIeCWmKmAmOaBkH_AqCc#}Aa#{CaAaBs#}BiAwMyGoAk#kBcAqHqDcBs#kC}#_D_AwCu#_BUgC[eDSeFIs#A{BFs`AtA_HH}CAoCIwBMsH]sMm#iMm#wG]qDYiFm#eFw#iCg#{Cs#cFsAwI}BqJgC{C{#cKmCuLaDuXmHwT_GuCu#sBc#wGkAqB[kDa#gE]eDQeGO{CCmC#}CFmCHcG\\yLx#wN`AcEXkETyDHiH#_DGgEO_F]sFi#oNuAgP_BwWgCsO{AuCa#eCe#eBa#wBm#uCaA}EwBwBiAaCyAsAaAyDcDoN_NmWqVgA_AiDeCwD_CyAy#wD_BeEyAsBk#kDs#uB]_CYyCU{AIyFOyCGyTW{SYiEEsJQ}ECyA#mDLyFVoCVyBZyCd#aDv#kDdAkA^gAh#qDrAsLtFmInDoBt#oAd#eATcG`AmCLo#Ds#?oCEeAG{lB_VaM{AyGs#aHYuISeB?gHMiLYyJe#gO{AwCUwGs#yf#_FaFc#u#KqI{#{Iy#wEa#{De#gO{AqC]mHk#gEOoPUoOQ_S[kKOmBIkBWs#Q}#[}#e#eAy#{AkBoAgBqDmHi#eAs#_Ae#e#sAaAcAm#_Ac#}#U_AM_BK}BM]#eCEyBJaALs#LsA\\_Bv#{BlAiBhAyAx#{Ap#wCtAaFjC_CfAwBv#cB\\kDt#_LnBwJbBmEb#gJp#M#{BLcD`#cDX}E`#_CLuBCcEWmKk#{Dg#cCYaEgAqCoAoBwAcCgC}EmGg#m#gDkEuE{FiBwBoBsCkAwB}#wBo#gCa#sCMqAMoD#uIBkDFuQ#qDBy#"
},
Resulting map:
Full request, requires URL-encoding the encoded polyline:
http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&path=weight:3%7Ccolor:red%7Cenc:en_eEsoctEa%40IuAvHzD~%40hGrA~D~%40i%40vCgAlGa%40%7CBqFp%5BkBOyBAgADk%40Hw%40JqBb%40cIjAcC%60%40%7BCr%40iKrC_Bh%40kDhAeCx%40%7DBn%40%7DIpCcFtAq%40Hs%40D_A%3FyAEoAQi%40OcA%5DkAg%40%7DOoKmMqIkCgBoBgA%7DD%7BBm%40%5DERiAxGoA%60IYtAs%40hCwAzDsB%60EoDhGkDrGkBbDmBbD_CrC%7B%40%60AcAn%40c%40Pm%40JUDa%40%3Fu%40Cq%40Mo%40Um%40c%40cC%7DBmGgGgc%40yd%40qSmTsNiOwDoDqCmBkCuAcA%5DoC_AyCw%40%7DBc%40_BO%7BBOwE%40aDNiBRyARyBd%40_K%7CCag%40bPsVdImDhAkBf%40qCf%40_AJqADeABcBCuAIqC_%40kIqAuLaBgNmBuImAqFs%40kL_BsEq%40qEk%40eGo%40aFUqEIoOSiLI_DAgQQuDIiEa%40u%5CiDwBOiGw%40yB_%40uCy%40yPsEaIwBiL_D%7BCu%40sAUgDk%40uCYgAIeBCoEAax%40nAgC%40qCGcBIeCWmKmAmOaBkH_AqCc%40%7DAa%40%7BCaAaBs%40%7DBiAwMyGoAk%40kBcAqHqDcBs%40kC%7D%40_D_AwCu%40_BUgC%5BeDSeFIs%40A%7BBFs%60AtA_HH%7DCAoCIwBMsH%5DsMm%40iMm%40wG%5DqDYiFm%40eFw%40iCg%40%7BCs%40cFsAwI%7DBqJgC%7BC%7B%40cKmCuLaDuXmHwT_GuCu%40sBc%40wGkAqB%5BkDa%40gE%5DeDQeGO%7BCCmC%40%7DCFmCHcG%5CyLx%40wN%60AcEXkETyDHiH%40_DGgEO_F%5DsFi%40oNuAgP_BwWgCsO%7BAuCa%40eCe%40eBa%40wBm%40uCaA%7DEwBwBiAaCyAsAaAyDcDoN_NmWqVgA_AiDeCwD_CyAy%40wD_BeEyAsBk%40kDs%40uB%5D_CYyCU%7BAIyFOyCGyTW%7BSYiEEsJQ%7DECyA%40mDLyFVoCVyBZyCd%40aDv%40kDdAkA%5EgAh%40qDrAsLtFmInDoBt%40oAd%40eATcG%60AmCLo%40Ds%40%3FoCEeAG%7BlB_VaM%7BAyGs%40aHYuISeB%3FgHMiLYyJe%40gO%7BAwCUwGs%40yf%40_FaFc%40u%40KqI%7B%40%7BIy%40wEa%40%7BDe%40gO%7BAqC%5DmHk%40gEOoPUoOQ_S%5BkKOmBIkBWs%40Q%7D%40%5B%7D%40e%40eAy%40%7BAkBoAgBqDmHi%40eAs%40_Ae%40e%40sAaAcAm%40_Ac%40%7D%40U_AM_BK%7DBM%5D%40eCEyBJaALs%40LsA%5C_Bv%40%7BBlAiBhAyAx%40%7BAp%40wCtAaFjC_CfAwBv%40cB%5CkDt%40_LnBwJbBmEb%40gJp%40M%40%7BBLcD%60%40cDX%7DE%60%40_CLuBCcEWmKk%40%7BDg%40cCYaEgAqCoAoBwAcCgC%7DEmGg%40m%40gDkEuE%7BFiBwBoBsCkAwB%7D%40wBo%40gCa%40sCMqAMoD%40uIBkDFuQ%40qDBy%40
how about google's support for embedding?
or how to add google maps to your website
the easiest way to use it is go to actual google maps and use the link button, then use the link in your site/whatever

Categories

Resources