Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Map not working on Detail page

We are using pawtuket2 and theme (default). Map is not showing on detail page. What are the setting i need to do?
Please advice me.

# --- map
            if($this->request->config->get('ca_objects_map_attribute') && $t_object->get($this->request->config->get('ca_objects_map_attribute'))){
                $o_map = new GeographicMap(285, 200, 'map');
                $o_map->mapFrom($t_object, $this->request->config->get('ca_objects_map_attribute'));
                print "<div class='unit'>".$o_map->render('HTML')."</div>";
            }   

Comments

  • To have a map appear on detail pages, you must configure the georeference metadata
    element in your theme's detail.conf file.  Here is an example
    configuration (line 22): https://github.com/collectiveaccess/pawtucket2/blob/master/themes/default/conf/detail.conf; where "map_attribute" is set to the <tablename>.<elementcode> of the metadata element that has the coordinates.

    You can also enter your google map key in the variable __CA_GOOGLE_MAPS_KEY__ in setup.php
  • Hi
    maybe I tell you nothing new: but did you set a place on the map in providence in coverage bundle. After that it showed up with default theme here.
    Olivier
  • Hi Maria,

    Thank you for your response.
    I have done the setup changes in detail.conf file and setup.php but still not able to show map on detail page.

    I am using pawtucket2.While digging deep in detail controller file i find out that value of $vn_mapped_count is 0. It has to be greater than 0 for map to show.

    $this->view->setVar("map", "");
                if(is_array($va_map_attributes) && sizeof($va_map_attributes)) {
                    $o_map = new GeographicMap((($vn_width = caGetOption('map_width', $va_options, false)) ? $vn_width : 285), (($vn_height = caGetOption('map_height', $va_options, false)) ? $vn_height : 200), 'map');
                       
                    $vn_mapped_count = 0;   
                    foreach($va_map_attributes as $vs_map_attribute) {
                    var_dump($vs_map_attribute);
                        if ($t_subject->get($vs_map_attribute)){
                            $va_ret = $o_map->mapFrom($t_subject, $vs_map_attribute, array('contentTemplate' => caGetOption('mapContentTemplate', $va_options, false)));
                            $vn_mapped_count += $va_ret['items'];
                        }
                    }
                   
                    if ($vn_mapped_count > 0) {
                        $this->view->setVar("map", $o_map->render('HTML', array('zoomLevel' => caGetOption('zoom_level', $va_options, 12))));
                    }
                }


    Please help.
  • That means the map attribute you configured is either wrong or not set on the record.  If you're mapping from a related place (or any related record), make sure the access is available to the public.
  • Hi Maria,

    Please see the all steps which I have used to show map.

    1. After installing collective access, Login like (http://localhost:8082/providence/).
    2. Add new object
    3. add new media image in object
    4. add location like " [41.87811359999997,-87.6297982]"
    5. filled necessary details while creating object
    5. Run front-end like "http://localhost:8082/providence/pawtucket2/index.php/Detail/objects/1574"

    Please see the steps what can be missing in setting/configuration by which map is not showing on details page of pawtuket2.
     
    Here are the details which I have configured map attribute in details conf file.
    detailTypes = {
        objects = {
            displayName = _(Objects),
            table = ca_objects,
            restrictToTypes = [],
            options = {
                nextLink = <i class='fa fa-angle-right'></i><div class='small'>Next</div>,
                previousLink = <i class='fa fa-angle-left'></i><div class='small'>Prev</div>,
                resultsLink = <i class='fa fa-angle-double-left'></i><div class='small'>Back</div>,
                enableComments = 1,
                enableShare = 1,
                enablePDF = 1,
                representationViewerPrimaryOnly = 0,
                representationViewerDontShowPlaceholder = 0,
                #representationViewerCaptionTemplate = <div class='small'>^ca_object_representations.preferred_labels.name</div>,
                map_attribute = ca_objects.georeference,
                map_width = 100%,
                map_height = 200,            
                # -- what appears in map balloon
                #mapContentTemplate = ^ca_objects.georeference,
                
                # Customize export download file names; can be set to a display template or static text
                #pdfExportTitle = ^ca_objects.preferred_labels.name,
                
                # annotations
                
                # display annotations? Valid values are: viewer (in viewer), div (in external div with class #detailAnnotations), none (no display) [Default is none]
                displayAnnotations = div,
                # template used to format annotation in list; evaluated relative to the annotation
                displayAnnotationTemplate = ^ca_representation_annotations.preferred_labels.name (^ca_representation_annotations.duration%asTimecode=hms)
            },
            # --- aliases to this detail page - these map to browses that return this type of detail, only need to be defined if the key of this array differs from the browses that find this record type
            #aliases = []
        },

    Please help...

Sign In or Register to comment.