Google Maps show location from selected item in datagrid

0
Hi, I have a datagrid with latitude en logitude (from entity / non persistent as I call the data from a webservice. I have a dataview set, listens to widget (datagrid). When I click a line in the datagrid I get the values lat/lon in my dataview. In this dataview I have the google maps add on. I would like to show the location of the lat lon in Google maps however I don't get it to work. In google maps I cannot select my entity (because it is non persistent) so I created an associated entity that is persistent and use this object but that doesn't work either. Not sure if this is the way to go but I have no clue what else I could do. Anybody ??? Andy.
asked
4 answers
1

Andy

In the Google Maps module, there is an event handler on the Location entity called BCo_Location. This is where the Lat/Lng are populated from Google Maps api. As long as your entity that contains Lat/Lng is inherited from this entity, the Lat/Lng will be calculated correctly. Note that the Lat/Lng calculation happens when the entity is committed.

Hope that helps,

Mike

answered
1

Okay I found the solution.

I created a datagrid with a list of lat / lon. Under the grid I have a dataview that listens to the datagrid. In this dataview I have another dataview that calls a microflow. In this microflow I create an object that fills the entity Location (entity in the googlemaps module) lat / lon with the lat and lon that is passed as object from my datagrid. When I create the object the eventhandler in the google location entity is triggered. So when I select a line in the datagrid it shows the location of the lat and lon data in the google map.

For questions send me a message.

answered
0

Hi Mike, I do have a feeling what you mean but somehow I think the way the sample works is quite a bit different. I don't have an address but Lat and Lon coordinates only. I cannot find where these are generated trough the calculation and must be in JAVA. I assume the object $Location has two attributes Latitude and Longitude with decimal values. Still doesn't get me much further...

Any more pointers ?

answered
0

In GMaps module, there is a Java action called CalculateGeo, which takes an address string and Location objects as arguments and populates the Lat/Lng attributes in Location object. So if you don't have an address string, I am not sure where your Lat/Lng are generated either. Passing an object to the GMaps widget and pointing to lat and lng attributes should display a location. Perhaps you can manually populate an entity with some lat / lng attributes to give you some insight into what is happening in your app.

answered