Forum OpenACS Development: New package: MAPS (Google Maps integration)

Hi everybody,

We have been working in a package development, and I guess we can put it here so everybody can help and give us some impressions. The package creator is our friend Alessandro Landim, and I'm trying to help him (just trying).

This package intends to use Google Maps API to map any object system, implementing a callback for every object_type. We still don't have enough documentation ad we have done it in a hurry, but I believe it's already usable. In order to make it work, you have to:

- Get a google maps key for your site
- Mount the package somewhere
- Map the objects for the instance

You can get it here through SVN:

svn export http://svn.softwarepublico.gov.br/svn/openacs/branches/spb-2.0/packages/maps

There are also maps-portlet and dotlrn-maps available in the same svn repository. Right now, you can map dotlrn_community, organization and pm_project objects. Take a look at the file maps/tcl/maps-callback-procs to see how you can write your own callbacks.

Please, post any bugs or impressions, even if they are bad, so we can improve it. We'll put a minimum documentation available as soon as possible.

Hi, Eduardo!

Do you have a public demo?

Regards,
Agustin

Collapse
Posted by Eduardo Santos on
Hi Jose,

I don't know if we have something like a public demo, but you can access our test server and see it working in our organizations position maping. Take a look at this address:

http://teste.softwarepublico.gov.br/mpv/organizations

Post here if you have any doubts.

Hi!

Sorry, Eduardo. I think of the server is down.

Agustin

I installed from svn. This is great, Jose.

Can you give us an example of your callback implementation?

My install failed on this line in maps-create.sql because I do not run postgresql as the "postgres" user.

I just commented out line 18:
-- ALTER TABLE maps OWNER TO postgres;

Hi Ryan,

I`m glad you like it. Sorry about these lines; I`m going to remve these from the code.

Actually it`s very simple to write a callback. It`s based on the object_type you want to map. Take a look at the file /tcl/maps-callback-procs.tcl and see the implementations for organization and dotlrn_community. The callback must supply the following fields:

-object_id: The Id of maped object
-url: The URL to access this object (maybe somebody could use the service contract API to get it)
-pname: Object name
-message: Localized message to access this object, meaning something like "Access this object"

These parameter must be upvar'd in an array named map_info.

To insert a maped object, access the link maps_instance/admin and see the options.

Post here if you have any doubts

Ooops. Sorry, my fault. It seems like Apache is doing some nasty redirection. I'm going to fix it at any time and you can access it. Sorry.
Collapse
Posted by Eduardo Santos on
Hi everyone,

We have a provisory documentation at the address http://www.softwarepublico.gov.br/dotlrn/clubs/openacs/xowiki/en/pacote-maps.

Feel free to post here if you have any doubts.

Collapse
Posted by Malte Sussdorff on
Hi Eduardo, this sounds really promising. I don't know when I will get around to it (I already got sidetracked from the video integration I wanted to do ....), but I would love to integrate this with intranet-contacts and intranet-core so you can see the location of your contacts (both company and individuals) based on the location.

Am I right in the assumption that this is what the package wants to do, because from looking at the documentation and the callback I sadly could not for the life of it figure out how you get the map information :). But maybe I should have looked at the sourcecode as well ....

Collapse
Posted by Eduardo Santos on
Hi Malte,

Sorry. We have a lack of documentation that should be solved soon.

The map information is really a tricky thing, but it's not hard to understand. The map is based in two objects: maps and position. Avery time you create a package instance, a new map is created, and this map can have as many positions as you want.

The package is designed to think that you are going to mount the map somewhere and include it in another place. Let's say that you you mount it under /maps: a new map_id will be created for this instance. You are going to include this map_id in any other you want to.

So, what you have to do is:

1 - Create the callback for your object_type. It's pretty simple: it should only supply some info that is specific for this object and we use it when we are maping. I guess this part of documentation is OK.

2 - Include the page /maps/lib/position-view with the maping object_id, return_url and map_id (we have to find a better way to discover this map_id) in the page that you edit the object information. In organizations package, for example, the information page should be organizations/www/one and object_id should be organization_id. This page will show the object's individual position.

3 - Include the page /maps/lib/map-view supplying the map_id (again, there must be a clever way to do it) and you can see all the positions in this map.

I recommend you to run a svn export right now, because we have done a lot of improvements in the last few hours. Let me know if there's any other thing you want to know, so we can put it back in the documentation.

I hope it's useful. :)

Collapse
Posted by Jeff Lu on
Hi Eduardo, the edit-postion page does not seem to work. The google map is not showing.
Same goes with the position-view page.
Collapse
Posted by Eduardo Santos on
Hi Jeff,

Well, if you could supply more info about the error maybe I could help you more. My guess in this case is that you didn't sign out for a Google Maps API Key, as the map is not being shown. Take a look at the docs here:

http://www.softwarepublico.gov.br/dotlrn/clubs/openacs/xowiki/en/pacote-maps

Or just type /doc in your install and click under the maps package. You have to go to /maps/admin/ page and click on the edit parameters link. In this page you have to supply the key that Google gives you here: http://code.google.com/apis/maps/signup.html

If it doesn't work, try to give me more details about the error, such as log messages or something like this, so I can help you better.

I hope it helps.

Collapse
Posted by Claudio Pasolini on
Hi Eduardo,

I'd like to have a look at the MAPS package, but your SVN repository http://svn.softwarepublico.gov.br/svn/openacs/branches/spb-2.0/packages/maps requires username and password.

Could you kindly send me a copy or post it somewhere?

Thanks,

Claudio

Collapse
Posted by Eduardo Santos on
Hi Claudio,

Sorry, my mistake. You could try the SVN at trunk without password:

# svn co http://svn.softwarepublico.gov.br/svn/openacs/trunk/packages/maps