Pick a location from Google Maps

1
Is this possible to pick a location from a map? Just like the 'What's here' option on the Google maps site?
asked
4 answers
3

Added some code to the widget that invokes a microflow with a location object when a map is clicked: XML:

    <property key="EventEntity" type="entity">
        <caption>Event</caption>
        <category>Data source</category>
        <description>Event entity</description>
    </property>
<property key="onChange" type="microflow" required="false" entityProperty="EventEntity">
    <caption>On change</caption>
    <category>Behavior</category>
    <description>Microflow to trigger on change.</description>
    <returnType type="Boolean"/>
</property>

(Extra attribute microflow and entity

displayMap : function (callback) {
        // added cdg 10-10-11
        var onClickMicroflow = this.onClickEvent;
        var ctxt = this.createContext();

And behind creating the map

// cdg 10-10-2011
            google.maps.event.addListener(this.googleMap, 'click', function(event) {
                if (onClickMicroflow) {
                    mx.processor.createObject({
                        className   : "GoogleMaps.Location",
                        error       : function () {
                                        logger.debug("Create object failed.");
                                    },
                        callback    : dojo.hitch(this, fillAttributesAfterCreate)
                    });
                }           
                function fillAttributesAfterCreate(mxObj){
                    mxObj.setAttribute("Longitude", event.latLng.lng());
                    mxObj.setAttribute("Latitude", event.latLng.lat());
                    ctxt.setContext(mxObj.getClass(), mxObj.getGUID());
                    // invoke microflow
                    mx.xas.action({
                        actionname  : onClickMicroflow,
                        context     : ctxt,
                        callback    : function() {
                        },                                      
                        error       : function(e) {
                            logger.error('Could not execute microflow: ' + onChangeMicroflow + 'with error: '+e&&e);
                        }
                    });
                };

            });
            //cdg 10-10-2011
answered
2

not possible with the standard widget ...

You would need to extend the widget, to use AddMarker functionality.

answered
1

This is not possible with the current widget no.

The Google Maps API is pretty big though, so I'm sure it can be made. You'll need to either file a Support Ticket or edit the Google Maps widget yourself though.

If all you want is to add a marker wherever the user clicks, that should be easy to add, as the AddMarker functionality is already used for making markers for the Mendix objects that are loaded in.

answered
0

is this feature still unavailable?

answered