Google maps integration

502 views
Skip to first unread message

yevheni...@gmail.com

unread,
May 22, 2016, 11:17:09 AM5/22/16
to Elm Discuss
Hello team,

We are evaluating Elm usage in our project  and before we get our hands dirty with the syntax I want to ask whether are there any conceptual problems with Google Maps integration? 
The interface we are looking forward to implementing in the Elm is similar to the Airbnb's search page:

* there is a filter panel on top, details panel on the left and map on the right
* we have a map movement hook: after user moves a map we send coordinates of the newly displayed area to the server
* in response server sends the updated set of the markers to display 
* markers that ended up outside of visible area are removed and new markers are added

Is that kind of interconnectivity possible? Does anyone have an experience of implementing JS callbacks in Elm? 

Laszlo Pandy

unread,
May 22, 2016, 11:51:04 AM5/22/16
to elm-d...@googlegroups.com
Yes, 0.17 has just been released. It introduces effect modules which are designed for interacting with stateful things like google maps. Unfortunately since the release is brand new, there is little documentation on effect modules. The best way to try it is probably to checkout the websocket example:

The Cmd type would correspond to methods you want to call into the google maps library, and Sub type would correspond to the callbacks that you need to get from the library.

--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon

unread,
May 22, 2016, 2:10:16 PM5/22/16
to Elm Discuss
Here's a very simple example, albeit still based on 0.16 code and ports

Pablo Parga

unread,
May 22, 2016, 2:50:28 PM5/22/16
to Elm Discuss
Here is another example but without ports and with polymer

Farmous

unread,
May 25, 2016, 4:32:28 AM5/25/16
to Elm Discuss
I have updated your example based on 0.17.

Yevhenii Kurtov

unread,
May 25, 2016, 6:01:37 AM5/25/16
to elm-d...@googlegroups.com
Thank you, Farmio! 

That example contains all we need :) 

--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/0tyo4vc5RjY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.

Andrey Kozlov

unread,
Jun 8, 2016, 4:57:57 AM6/8/16
to Elm Discuss
I'm curious if an approach with having a google map with its markers and position as a web component, say, via a Polymer library, will make everything easy.
This way we would somehow able to have a markup like <map lat="32" lng="23" zoom="3"><marker lat="2" lng="3" icon="1.png">Test</marker></map> which itself can be completely controlled from the elm. Of course someone need to add a binding to that map element, but that itself is another issue.
And, as I hope, there is nothing what prevents from making a Polymer or other web component using a compiled elm source!
Any thoughts ?

Andrey Kozlov

unread,
Jun 8, 2016, 5:01:08 AM6/8/16
to Elm Discuss
Heh, it seems all ideas are already implemented, please look at this one!
Reply all
Reply to author
Forward
0 new messages